summaryrefslogtreecommitdiffstats
path: root/config/cmake_ext_mod/FindMPI
diff options
context:
space:
mode:
Diffstat (limited to 'config/cmake_ext_mod/FindMPI')
-rw-r--r--config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in4
-rw-r--r--config/cmake_ext_mod/FindMPI/libver_mpi.c19
-rw-r--r--config/cmake_ext_mod/FindMPI/libver_mpi.f90.in7
-rw-r--r--config/cmake_ext_mod/FindMPI/mpiver.f90.in10
-rw-r--r--config/cmake_ext_mod/FindMPI/test_mpi.c37
-rw-r--r--config/cmake_ext_mod/FindMPI/test_mpi.f90.in6
6 files changed, 83 insertions, 0 deletions
diff --git a/config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in b/config/cmake_ext_mod/FindMPI/fortranparam_mpi.f90.in
new file mode 100644
index 0000000..30f912c
--- /dev/null
+++ b/config/cmake_ext_mod/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/config/cmake_ext_mod/FindMPI/libver_mpi.c b/config/cmake_ext_mod/FindMPI/libver_mpi.c
new file mode 100644
index 0000000..be9d19d
--- /dev/null
+++ b/config/cmake_ext_mod/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/config/cmake_ext_mod/FindMPI/libver_mpi.f90.in b/config/cmake_ext_mod/FindMPI/libver_mpi.f90.in
new file mode 100644
index 0000000..7938587
--- /dev/null
+++ b/config/cmake_ext_mod/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/config/cmake_ext_mod/FindMPI/mpiver.f90.in b/config/cmake_ext_mod/FindMPI/mpiver.f90.in
new file mode 100644
index 0000000..a254523
--- /dev/null
+++ b/config/cmake_ext_mod/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/config/cmake_ext_mod/FindMPI/test_mpi.c b/config/cmake_ext_mod/FindMPI/test_mpi.c
new file mode 100644
index 0000000..b8a308a
--- /dev/null
+++ b/config/cmake_ext_mod/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/config/cmake_ext_mod/FindMPI/test_mpi.f90.in b/config/cmake_ext_mod/FindMPI/test_mpi.f90.in
new file mode 100644
index 0000000..4d43a04
--- /dev/null
+++ b/config/cmake_ext_mod/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