aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorMichael Hirsch, Ph.D <scivision@users.noreply.github.com>2019-11-24 00:13:54 -0500
committerMichael Hirsch, Ph.D <scivision@users.noreply.github.com>2019-11-30 21:29:49 -0500
commit92b77cb3210280315c47d18f3c87cdd2c59021bc (patch)
tree6d2e5196aab7a1d6827ad1416761bbfbc135e226 /test cases
parent818c92003c41b72194cdc668a3346a4b7247bd23 (diff)
downloadmeson-92b77cb3210280315c47d18f3c87cdd2c59021bc.zip
meson-92b77cb3210280315c47d18f3c87cdd2c59021bc.tar.gz
meson-92b77cb3210280315c47d18f3c87cdd2c59021bc.tar.bz2
deps: add scalapack
Scalapack uses a library stack that can be challenging to manage. Not least of all since many Scalapacks ship with broken / incomplete pkg-config files and CMake FindScalapack.cmake This resolves those issues for typical Scalapack setups including: * Linux: Intel MKL or OpenMPI + Netlib * MacOS: Intel MKL or OpenMPI + Netlib * Windows: Intel MKL (OpenMPI not available on Windows)
Diffstat (limited to 'test cases')
-rw-r--r--test cases/frameworks/30 scalapack/main.c34
-rw-r--r--test cases/frameworks/30 scalapack/main.f9025
-rw-r--r--test cases/frameworks/30 scalapack/meson.build42
3 files changed, 101 insertions, 0 deletions
diff --git a/test cases/frameworks/30 scalapack/main.c b/test cases/frameworks/30 scalapack/main.c
new file mode 100644
index 0000000..ca01977
--- /dev/null
+++ b/test cases/frameworks/30 scalapack/main.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+
+// #include <mkl.h>
+// #include <mkl_scalapack.h>
+// #include <mkl_blacs.h>
+
+extern float pslamch_(const int *, const char *);
+extern void blacs_pinfo_(int *, int *);
+extern void blacs_get_(const int *, const int *, int *);
+extern void blacs_gridinit_(int *, const char *, const int *, const int *);
+extern void blacs_gridinfo_(const int *, int *, int *, int *, int *);
+extern void blacs_gridexit_(const int *);
+extern void blacs_exit_(const int *);
+
+int main(void){
+
+int myid, nprocs, ictxt, mycol, myrow, npcol=2, nprow=2;
+const int i0=0, i1=1, in1=-1;
+
+blacs_pinfo_(&myid, &nprocs);
+blacs_get_(&in1, &i0, &ictxt);
+blacs_gridinit_(&ictxt, "C", &nprocs, &i1);
+
+blacs_gridinfo_(&ictxt, &nprow, &npcol, &myrow, &mycol);
+
+float eps = pslamch_(&ictxt, "E");
+
+if (myrow == mycol) printf("OK: Scalapack C: eps= %f\n", eps);
+
+blacs_gridexit_(&ictxt);
+blacs_exit_(&i0);
+
+return 0;
+} \ No newline at end of file
diff --git a/test cases/frameworks/30 scalapack/main.f90 b/test cases/frameworks/30 scalapack/main.f90
new file mode 100644
index 0000000..5e3a192
--- /dev/null
+++ b/test cases/frameworks/30 scalapack/main.f90
@@ -0,0 +1,25 @@
+! minimal Scalapack demo
+implicit none
+
+integer :: ictxt, myid, nprocs, mycol, myrow, npcol, nprow
+real :: eps
+real, external :: pslamch
+
+! arbitrary test parameters
+npcol = 2
+nprow = 2
+
+call blacs_pinfo(myid, nprocs)
+call blacs_get(-1, 0, ictxt)
+call blacs_gridinit(ictxt, "C", nprocs, 1)
+
+call blacs_gridinfo(ictxt, nprow, npcol, myrow, mycol)
+
+eps = pslamch(ictxt, 'E')
+
+if(myrow == mycol) print '(A, F10.6)', "OK: Scalapack Fortran eps=", eps
+
+call blacs_gridexit(ictxt)
+call blacs_exit(0)
+
+end program \ No newline at end of file
diff --git a/test cases/frameworks/30 scalapack/meson.build b/test cases/frameworks/30 scalapack/meson.build
new file mode 100644
index 0000000..f9c453f
--- /dev/null
+++ b/test cases/frameworks/30 scalapack/meson.build
@@ -0,0 +1,42 @@
+project('test scalapack', 'c')
+
+cc = meson.get_compiler('c')
+
+mpiexec = find_program('mpiexec', required: false)
+if not mpiexec.found()
+ error('MESON_SKIP_TEST: mpiexec not found')
+endif
+
+mpi_c = dependency('mpi', language: 'c', required: false)
+if not mpi_c.found()
+ error('MESON_SKIP_TEST: MPI library not available')
+endif
+
+# examples can run with any number of MPI images.
+mpi_args = ['-np', '1']
+
+scalapack = dependency('scalapack', required: false)
+if not scalapack.found()
+ error('MESON_SKIP_TEST: scalapack library not available')
+endif
+
+# https://software.intel.com/en-us/mkl-developer-reference-c-scalapack-routines
+c_exe = executable('scalapack_c', 'main.c',
+ dependencies: [scalapack, mpi_c])
+test('scalapack_c', mpiexec,
+ args: [mpi_args, c_exe],
+ timeout: 30)
+
+if add_languages('fortran')
+ mpi_f = dependency('mpi', language: 'fortran', required: false)
+ if not mpi_f.found()
+ error('MESON_SKIP_TEST: MPI Fortran library not available')
+ endif
+
+ # https://software.intel.com/en-us/mkl-developer-reference-fortran-scalapack-routines
+ f_exe = executable('scalapack_fortran', 'main.f90',
+ dependencies: [scalapack, mpi_f])
+ test('scalapack_fortran', mpiexec,
+ args: [mpi_args, f_exe],
+ timeout: 30)
+endif \ No newline at end of file