diff options
author | Christian Pfeiffer <cpfeiffer@live.de> | 2017-04-25 15:41:05 (GMT) |
---|---|---|
committer | Christian Pfeiffer <cpfeiffer@live.de> | 2017-09-15 12:55:08 (GMT) |
commit | 9a58e69cc8a9eea2e4f4ff0e65e7b1df909221ac (patch) | |
tree | 6a8e89b0d89c97588373d233c70e66355d857c4d /Modules/FindMPI | |
parent | 3ea87bce69d1b6120b227fed3838f1bc9ab45db1 (diff) | |
download | CMake-9a58e69cc8a9eea2e4f4ff0e65e7b1df909221ac.zip CMake-9a58e69cc8a9eea2e4f4ff0e65e7b1df909221ac.tar.gz CMake-9a58e69cc8a9eea2e4f4ff0e65e7b1df909221ac.tar.bz2 |
FindMPI: Modernization from ground up
This is a near-total rewrite of FindMPI implementing the following
features:
Environmental improvements:
- C++ settings can now be picked from C settings if no dedicated C++
settings are found (some installs of IBM Platform MPI)
- Fortran settings can now be found on MPICH-1, MVAPICH-1, Microsoft
MPI and MPICH-2 on Windows.
- Improved flag procession logic: Flags related to security enhancements
of MPI itself, and unrelated to MPI usage (-fstack-protector-strong on
e.g. RHEL 7 for MPICH and MVAPICH) will be filtered out properly now.
-pthread is now being handled. -fno-strict-aliasing, which may be needed
while compiling MVAPICH (e.g. RHEL 7's MVAPICH package) is also
filtered.
Features added:
- MPI version can be determined for each language and is exposed as the
package version
- MPI functionality is being tested to ensure the correctness of
settings
- MPI-2 C++ bindings can be suppressed if desired by the project or
user. For older MPIs, this often resolves issues and eliminated the
infamous SEEK_SET trouble.
- MPI-2 C++ bindings are now being searched for and exposed by a
variable if detected.
- Fortran support now does not make assumptions over the MPI present and
works with ILP64 MPI implementations.
- Fortran now exposes which bindings (mpif.h, mpi/mpi_f08 modules) are
available
- MPI detection can now work hybridly, which for example permits using the
Fortran modules shipped with some compiler suites together with MPI
(e.g. PGI on Windows shipping MSMPI modules)
- Ability to determine MPI library version (*requires* try_run, caution)
upon request
- Ability to determine Fortran capabilities from MPI-3 for each of the
bindings (subarrays, asynchronous attribute protecting entities) (also
requires try_run)
Fine grained control over the search process:
- Possibility to selectively enable and disable steps like compiler
wrapper search and guessing. Permits picking Microsoft MPI over Intel
MPI if both are loaded (previously not possible without removing the
IMPI compiler wrappers from the environment)
- Ability to pick MPICH2 over MSMPI (previously the first one located
was taken)
- A user may now pass compiler flags to the compiler wrapper script,
enabling much more flexibility. This permits for example linking the
Intel MPI debug runtime, static linking, ILP64 with Fortran,
linking tracing, ...
- A user may define a suffix for all MPI binaries that are being looked
for (useful on Debian/Ubuntu where the alternative MPI installs are each
appended with their name, e.g. mpicc.mpich and mpicc.lam)
Cache variable improvements
- Instead of the previous plural cache variables a list-of-variables
approach is now in place. Permits correcting individual variables
instead of having to wade through a list, also speeds up the search
process and increases comfort by eliminating duplicate entries in
LIBRARIES over languages
- MPIEXEC was corrected to MPIEXEC_EXECUTABLE in order to fix the
grouping in the CMake GUI for the variable (previously ungrouped)
Diffstat (limited to 'Modules/FindMPI')
-rw-r--r-- | Modules/FindMPI/fortranparam_mpi.f90.in | 4 | ||||
-rw-r--r-- | Modules/FindMPI/libver_mpi.c | 19 | ||||
-rw-r--r-- | Modules/FindMPI/libver_mpi.f90.in | 7 | ||||
-rw-r--r-- | Modules/FindMPI/mpiver.f90.in | 10 | ||||
-rw-r--r-- | Modules/FindMPI/test_mpi.c | 37 | ||||
-rw-r--r-- | Modules/FindMPI/test_mpi.f90.in | 6 |
6 files changed, 83 insertions, 0 deletions
diff --git a/Modules/FindMPI/fortranparam_mpi.f90.in b/Modules/FindMPI/fortranparam_mpi.f90.in new file mode 100644 index 0000000..30f912c --- /dev/null +++ b/Modules/FindMPI/fortranparam_mpi.f90.in @@ -0,0 +1,4 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + print *, 'INFO:SUBARRAYS[', MPI_SUBARRAYS_SUPPORTED, ']-ASYNCPROT[', MPI_ASYNC_PROTECTS_NONBLOCKING, ']' + end program mpi_ver diff --git a/Modules/FindMPI/libver_mpi.c b/Modules/FindMPI/libver_mpi.c new file mode 100644 index 0000000..be9d19d --- /dev/null +++ b/Modules/FindMPI/libver_mpi.c @@ -0,0 +1,19 @@ +#include <mpi.h> + +#ifdef __cplusplus +#include <cstdio> +#else +#include <stdio.h> +#endif + +int main(int argc, char* argv[]) +{ + char mpilibver_str[MPI_MAX_LIBRARY_VERSION_STRING]; + int mpilibver_len; + MPI_Get_library_version(mpilibver_str, &mpilibver_len); +#ifdef __cplusplus + std::puts(mpilibver_str); +#else + puts(mpilibver_str); +#endif +} diff --git a/Modules/FindMPI/libver_mpi.f90.in b/Modules/FindMPI/libver_mpi.f90.in new file mode 100644 index 0000000..7938587 --- /dev/null +++ b/Modules/FindMPI/libver_mpi.f90.in @@ -0,0 +1,7 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: mpilibver_str + integer(kind=MPI_INTEGER_KIND) :: ierror, reslen + call MPI_GET_LIBRARY_VERSION(mpilibver_str, reslen, ierror) + print *, mpilibver_str + end program mpi_ver diff --git a/Modules/FindMPI/mpiver.f90.in b/Modules/FindMPI/mpiver.f90.in new file mode 100644 index 0000000..a254523 --- /dev/null +++ b/Modules/FindMPI/mpiver.f90.in @@ -0,0 +1,10 @@ + program mpi_ver + @MPI_Fortran_INCLUDE_LINE@ + integer(kind=kind(MPI_VERSION)), parameter :: zero = ichar('0') + character, dimension(17), parameter :: mpiver_str =& + (/ 'I', 'N', 'F', 'O', ':', 'M', 'P', 'I', '-', 'V', 'E', 'R', '[', & + char(zero + MPI_VERSION), & + '.', & + char(zero + MPI_SUBVERSION), ']' /) + print *, mpiver_str + end program mpi_ver diff --git a/Modules/FindMPI/test_mpi.c b/Modules/FindMPI/test_mpi.c new file mode 100644 index 0000000..b8a308a --- /dev/null +++ b/Modules/FindMPI/test_mpi.c @@ -0,0 +1,37 @@ +#include <mpi.h> + +#ifdef __cplusplus +#include <cstdio> +#else +#include <stdio.h> +#endif + +#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) +const char mpiver_str[] = { 'I', 'N', + 'F', 'O', + ':', 'M', + 'P', 'I', + '-', 'V', + 'E', 'R', + '[', ('0' + MPI_VERSION), + '.', ('0' + MPI_SUBVERSION), + ']', '\0' }; +#endif + +int main(int argc, char* argv[]) +{ +#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) +#ifdef __cplusplus + std::puts(mpiver_str); +#else + puts(mpiver_str); +#endif +#endif +#ifdef TEST_MPI_MPICXX + MPI::MPI_Init(&argc, &argv); + MPI::MPI_Finalize(); +#else + MPI_Init(&argc, &argv); + MPI_Finalize(); +#endif +} diff --git a/Modules/FindMPI/test_mpi.f90.in b/Modules/FindMPI/test_mpi.f90.in new file mode 100644 index 0000000..4d43a04 --- /dev/null +++ b/Modules/FindMPI/test_mpi.f90.in @@ -0,0 +1,6 @@ + program hello + @MPI_Fortran_INCLUDE_LINE@ + integer@MPI_Fortran_INTEGER_LINE@ ierror + call MPI_INIT(ierror) + call MPI_FINALIZE(ierror) + end program |