summaryrefslogtreecommitdiffstats
path: root/config/cmake_ext_mod/FindMPI/test_mpi.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-11-02 16:24:24 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-11-02 16:24:24 (GMT)
commit1b94b971051a8c890796cdfb661630b75ef05707 (patch)
treed7cd8f21de6aed6bb66141d446ad9c40a97559c8 /config/cmake_ext_mod/FindMPI/test_mpi.c
parentafba1a0045d135c17ea5f5c86d14f4ae7123ac59 (diff)
downloadhdf5-1b94b971051a8c890796cdfb661630b75ef05707.zip
hdf5-1b94b971051a8c890796cdfb661630b75ef05707.tar.gz
hdf5-1b94b971051a8c890796cdfb661630b75ef05707.tar.bz2
HDFFV-10321 merge from develop
Diffstat (limited to 'config/cmake_ext_mod/FindMPI/test_mpi.c')
-rw-r--r--config/cmake_ext_mod/FindMPI/test_mpi.c37
1 files changed, 37 insertions, 0 deletions
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
+}