summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/mpi/package.py
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin/packages/mpi/package.py')
-rw-r--r--var/spack/repos/builtin/packages/mpi/package.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/mpi/package.py b/var/spack/repos/builtin/packages/mpi/package.py
new file mode 100644
index 0000000000..731a5ac731
--- /dev/null
+++ b/var/spack/repos/builtin/packages/mpi/package.py
@@ -0,0 +1,31 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+import os
+
+
+class Mpi(Package):
+ """Virtual package for the Message Passing Interface."""
+ homepage = 'https://www.mpi-forum.org/'
+ virtual = True
+
+ def test(self):
+ for lang in ('c', 'f'):
+ filename = self.test_suite.current_test_data_dir.join(
+ 'mpi_hello.' + lang)
+
+ compiler_var = 'MPICC' if lang == 'c' else 'MPIF90'
+ compiler = os.environ[compiler_var]
+
+ exe_name = 'mpi_hello_%s' % lang
+ mpirun = join_path(self.prefix.bin, 'mpirun')
+
+ compiled = self.run_test(compiler,
+ options=['-o', exe_name, filename])
+ if compiled:
+ self.run_test(mpirun,
+ options=['-np', '1', exe_name],
+ expected=[r'Hello world! From rank \s*0 of \s*1']
+ )