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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# Copyright 2013-2024 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
from spack.package import *
from spack.util.module_cmd import get_path_args_from_module_line, module
class CrayMpich(Package):
"""Cray's MPICH is a high performance and widely portable implementation of
the Message Passing Interface (MPI) standard."""
homepage = "https://docs.nersc.gov/development/compilers/wrappers/"
has_code = False # Skip attempts to fetch source that is not available
maintainers("haampie")
version("8.1.7")
version("8.1.0")
version("8.0.16")
version("8.0.14")
version("8.0.11")
version("8.0.9")
version("7.7.16")
version("7.7.15")
version("7.7.14")
version("7.7.13")
depends_on("cray-pmi")
depends_on("libfabric")
# cray-mpich 8.1.7: features MPI compiler wrappers
variant("wrappers", default=True, when="@8.1.7:", description="enable MPI wrappers")
provides("mpi@3")
canonical_names = {
"gcc": "GNU",
"cce": "CRAY",
"intel": "INTEL",
"clang": "ALLINEA",
"aocc": "AOCC",
}
@property
def modname(self):
return "cray-mpich/{0}".format(self.version)
@property
def external_prefix(self):
mpich_module = module("show", self.modname).splitlines()
for line in mpich_module:
if "CRAY_MPICH_DIR" in line:
return get_path_args_from_module_line(line)[0]
# Fixes an issue on Archer2 cray-mpich/8.0.16 where there is
# no CRAY_MPICH_DIR variable in the module file.
for line in mpich_module:
if "CRAY_LD_LIBRARY_PATH" in line:
libdir = get_path_args_from_module_line(line)[0]
return os.path.dirname(os.path.normpath(libdir))
def setup_run_environment(self, env):
if "+wrappers" in self.spec:
env.set("MPICC", join_path(self.prefix.bin, "mpicc"))
env.set("MPICXX", join_path(self.prefix.bin, "mpicxx"))
env.set("MPIF77", join_path(self.prefix.bin, "mpif77"))
env.set("MPIF90", join_path(self.prefix.bin, "mpif90"))
else:
env.set("MPICC", spack_cc)
env.set("MPICXX", spack_cxx)
env.set("MPIF77", spack_fc)
env.set("MPIF90", spack_fc)
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
env.set("MPICH_CC", spack_cc)
env.set("MPICH_CXX", spack_cxx)
env.set("MPICH_F77", spack_f77)
env.set("MPICH_F90", spack_fc)
env.set("MPICH_FC", spack_fc)
def setup_dependent_package(self, module, dependent_spec):
spec = self.spec
if "+wrappers" in spec:
spec.mpicc = join_path(self.prefix.bin, "mpicc")
spec.mpicxx = join_path(self.prefix.bin, "mpicxx")
spec.mpifc = join_path(self.prefix.bin, "mpif90")
spec.mpif77 = join_path(self.prefix.bin, "mpif77")
else:
spec.mpicc = spack_cc
spec.mpicxx = spack_cxx
spec.mpifc = spack_fc
spec.mpif77 = spack_f77
def install(self, spec, prefix):
raise InstallError(
self.spec.format(
"{name} is not installable, you need to specify "
"it as an external package in packages.yaml"
)
)
@property
def headers(self):
hdrs = find_headers("mpi", self.prefix.include, recursive=True)
hdrs.directories = os.path.dirname(hdrs[0])
return hdrs
@property
def libs(self):
query_parameters = self.spec.last_query.extra_parameters
libraries = ["libmpich"]
if "cxx" in query_parameters:
libraries.extend(["libmpicxx", "libmpichcxx"])
if "f77" in query_parameters:
libraries.extend(["libmpifort", "libmpichfort", "libfmpi", "libfmpich"])
if "f90" in query_parameters:
libraries.extend(["libmpif90", "libmpichf90"])
libs = find_libraries(libraries, root=self.prefix.lib, recursive=True)
libs += find_libraries(libraries, root=self.prefix.lib64, recursive=True)
return libs
|