
Any package `X` used as `depends_on("x", type="build")` will have `X.setup_run_environment(env)` called, because it has to be able to "run" in the build environment. So there is no point in calling `setup_run_environment` from `setup_dependent_build_environment`. Also it's redundant to call `setup_run_environment` in `setup_dependent_run_environment`, cause (a) the latter is called _for every parent edge_ instead of once per node, and (b) it's only called after `setup_run_environment` is called anyways. Better to call `setup_run_environment` once and only once.
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
# 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 *
|
|
|
|
|
|
class FujitsuMpi(Package):
|
|
"""Fujitsu MPI implementation only for Fujitsu compiler."""
|
|
|
|
homepage = "https://www.fujitsu.com/us/"
|
|
|
|
provides("mpi@3.1:")
|
|
requires("%fj")
|
|
|
|
def install(self, spec, prefix):
|
|
raise InstallError("Fujitsu MPI is not installable; it is vendor supplied")
|
|
|
|
@property
|
|
def headers(self):
|
|
hdrs = find_headers("mpi", self.prefix.include, recursive=True)
|
|
hdrs.directories = os.path.dirname(hdrs[0])
|
|
return hdrs or None
|
|
|
|
@property
|
|
def libs(self):
|
|
query_parameters = self.spec.last_query.extra_parameters
|
|
libraries = ["libmpi"]
|
|
|
|
if "cxx" in query_parameters:
|
|
libraries = ["libmpi_cxx"] + libraries
|
|
|
|
return find_libraries(libraries, root=self.prefix, shared=True, recursive=True)
|
|
|
|
def setup_dependent_package(self, module, dependent_spec):
|
|
self.spec.mpicc = self.prefix.bin.mpifcc
|
|
self.spec.mpicxx = self.prefix.bin.mpiFCC
|
|
self.spec.mpif77 = self.prefix.bin.mpifrt
|
|
self.spec.mpifc = self.prefix.bin.mpifrt
|
|
|
|
def setup_run_environment(self, env):
|
|
# Because MPI are both compilers and runtimes, we set up the compilers
|
|
# as part of run environment
|
|
env.set("MPICC", self.prefix.bin.mpifcc)
|
|
env.set("MPICXX", self.prefix.bin.mpiFCC)
|
|
env.set("MPIF77", self.prefix.bin.mpifrt)
|
|
env.set("MPIF90", self.prefix.bin.mpifrt)
|