aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2017-06-03 23:38:52 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2017-08-04 20:06:47 -0400
commit5a7e06a64f90f24b7cf642b43a81faf300bfc2fe (patch)
treeb7611866f9c271abf5bf3c848046fa105bc98b48 /test cases
parent58bd1e83b4e24eaab3cf18deb635a057d6bfefb7 (diff)
downloadmeson-5a7e06a64f90f24b7cf642b43a81faf300bfc2fe.zip
meson-5a7e06a64f90f24b7cf642b43a81faf300bfc2fe.tar.gz
meson-5a7e06a64f90f24b7cf642b43a81faf300bfc2fe.tar.bz2
Add MPI dependency.
We prefer pkg-config files, though only OpenMPI supplies them. Otherwise, check environment variables and search for wrappers and ask them for what to do.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/157 mpi/main.c27
-rw-r--r--test cases/common/157 mpi/main.cpp11
-rw-r--r--test cases/common/157 mpi/main.f9021
-rw-r--r--test cases/common/157 mpi/meson.build24
4 files changed, 83 insertions, 0 deletions
diff --git a/test cases/common/157 mpi/main.c b/test cases/common/157 mpi/main.c
new file mode 100644
index 0000000..e44357a
--- /dev/null
+++ b/test cases/common/157 mpi/main.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <mpi.h>
+
+int main(int argc, char **argv)
+{
+ int ier, flag;
+ ier = MPI_Init(&argc, &argv);
+ if (ier) {
+ printf("Unable to initialize MPI: %d\n", ier);
+ return 1;
+ }
+ ier = MPI_Initialized(&flag);
+ if (ier) {
+ printf("Unable to check MPI initialization state: %d\n", ier);
+ return 1;
+ }
+ if (!flag) {
+ printf("MPI did not initialize!\n");
+ return 1;
+ }
+ ier = MPI_Finalize();
+ if (ier) {
+ printf("Unable to finalize MPI: %d\n", ier);
+ return 1;
+ }
+ return 0;
+}
diff --git a/test cases/common/157 mpi/main.cpp b/test cases/common/157 mpi/main.cpp
new file mode 100644
index 0000000..0e0b621
--- /dev/null
+++ b/test cases/common/157 mpi/main.cpp
@@ -0,0 +1,11 @@
+#include <mpi.h>
+
+int main(int argc, char **argv)
+{
+ MPI::Init(argc, argv);
+ if (!MPI::Is_initialized()) {
+ printf("MPI did not initialize!\n");
+ return 1;
+ }
+ MPI::Finalize();
+}
diff --git a/test cases/common/157 mpi/main.f90 b/test cases/common/157 mpi/main.f90
new file mode 100644
index 0000000..d379e96
--- /dev/null
+++ b/test cases/common/157 mpi/main.f90
@@ -0,0 +1,21 @@
+program mpitest
+ implicit none
+ include 'mpif.h'
+ logical :: flag
+ integer :: ier
+ call MPI_Init(ier)
+ if (ier /= 0) then
+ print *, 'Unable to initialize MPI: ', ier
+ stop 1
+ endif
+ call MPI_Initialized(flag, ier)
+ if (ier /= 0) then
+ print *, 'Unable to check MPI initialization state: ', ier
+ stop 1
+ endif
+ call MPI_Finalize(ier)
+ if (ier /= 0) then
+ print *, 'Unable to finalize MPI: ', ier
+ stop 1
+ endif
+end program mpitest
diff --git a/test cases/common/157 mpi/meson.build b/test cases/common/157 mpi/meson.build
new file mode 100644
index 0000000..f36b039
--- /dev/null
+++ b/test cases/common/157 mpi/meson.build
@@ -0,0 +1,24 @@
+project('mpi', 'c', 'cpp')
+
+mpic = dependency('mpi', language : 'c')
+exec = executable('exec',
+ 'main.c',
+ dependencies : [mpic])
+
+test('MPI C', exec)
+
+mpicpp = dependency('mpi', language : 'cpp')
+execpp = executable('execpp',
+ 'main.cpp',
+ dependencies : [mpicpp])
+
+test('MPI C++', execpp)
+
+if add_languages('fortran', required : false)
+ mpifort = dependency('mpi', language : 'fortran')
+ exef = executable('exef',
+ 'main.f90',
+ dependencies : [mpifort])
+
+ test('MPI Fortran', exef)
+endif