tau: fix (cray) compiler names/paths (#46104)

fixes a build issue on cray ci
This commit is contained in:
Harmen Stoppels 2024-08-29 11:24:58 +02:00 committed by GitHub
parent f9065f0c7e
commit fe8f631b7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -204,25 +204,21 @@ def set_compiler_options(self, spec):
# ('CC', 'CXX' and 'FC')
# 4 - if no -cc=<compiler> -cxx=<compiler> is passed tau is built with
# system compiler silently
# (regardless of what %<compiler> is used in the spec)
# 5 - On cray gnu compilers are not provied by self.compilers
# Checking GCC_PATH will work if spack loads the gcc module
#
# In the following we give TAU what he expects and put compilers into
# PATH
compiler_path = os.path.dirname(self.compiler.cc)
if not compiler_path and self.compiler.cc_names[0] == "gcc":
compiler_path = os.environ.get("GCC_PATH", "")
if compiler_path:
compiler_path = compiler_path + "/bin/"
os.environ["PATH"] = ":".join([compiler_path, os.environ["PATH"]])
compiler_options = [
"-c++=%s" % os.path.basename(self.compiler.cxx),
"-cc=%s" % os.path.basename(self.compiler.cc),
]
compiler_flags: Dict[str, str] = {
flag: os.path.basename(getattr(self.compiler, compiler))
for flag, compiler in (("-cc", "cc"), ("-c++", "cxx"), ("-fortran", "fc"))
if getattr(self.compiler, compiler)
}
if "+fortran" in spec and self.compiler.fc:
compiler_options.append("-fortran=%s" % os.path.basename(self.compiler.fc))
if "~fortran" in spec:
compiler_flags.pop("-fortran", None)
# tau does not understand `craycc`, `crayCC`, `crayftn`, strip off the `cray` prefix
for flag, value in compiler_flags.items():
if value.startswith("cray"):
compiler_flags[flag] = value[4:]
compiler_options = [f"{flag}={value}" for flag, value in compiler_flags.items()]
##########