blob: 731a5ac731b96b1e63a4f17d94f0b5f6f122b087 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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']
)
|