upcxx: Fixes for Cray targets (#36708)

* upcxx: Enhance auto-detection for HPE Cray EX platforms

1. Some Cray EX systems use ALPS instead of SLURM, ensure we default
   the pmi-runcmd appropriately.

2. Some Cray EX systems run a stock kernel and lack a Cray PrgEnv
   (yes, really), so add a check for libfabric CXI provider as a
   last resort for detecting Cray EX, and ensure we don't choke on
   a lack of `$CRAYPE_DIR`.

* upcxx: Cray XC improvements

1. Future-proof Cray XC detection, in case Spack ever starts reporting
   it as "linux".
2. Revert cray-libsci workaround for ALCF Theta. The workaround no longer
   appears to be necessary, and is actually causing failures on Theta now.

* upcxx: Add level_zero variant detection
This commit is contained in:
Dan Bonachea 2023-04-14 19:17:41 -04:00 committed by GitHub
parent 5efd689803
commit b7c2cc9b85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,15 +10,21 @@
def is_CrayXC():
return (spack.platforms.host().name == "cray") and (
return (spack.platforms.host().name in ["linux", "cray"]) and (
os.environ.get("CRAYPE_NETWORK_TARGET") == "aries"
)
def is_CrayEX():
return (spack.platforms.host().name in ["linux", "cray"]) and (
os.environ.get("CRAYPE_NETWORK_TARGET") in ["ofi", "ucx"]
)
if spack.platforms.host().name in ["linux", "cray"]:
target = os.environ.get("CRAYPE_NETWORK_TARGET")
if target in ["ofi", "ucx"]: # normal case
return True
elif target is None: # but some systems lack Cray PrgEnv
fi_info = which("fi_info")
if fi_info and fi_info("-l", output=str).find("cxi") >= 0:
return True
return False
def cross_detect():
@ -150,15 +156,7 @@ def install(self, spec, prefix):
else:
options.append("--with-cross=" + spec.variants["cross"].value)
if is_CrayXC():
# Spack loads the cray-libsci module incorrectly on ALCF theta,
# breaking the Cray compiler wrappers
# cray-libsci is irrelevant to our build, so disable it
for var in ["PE_PKGCONFIG_PRODUCTS", "PE_PKGCONFIG_LIBS"]:
env[var] = ":".join(
filter(lambda x: "libsci" not in x.lower(), env[var].split(":"))
)
if is_CrayXC() or is_CrayEX():
if (is_CrayXC() or is_CrayEX()) and env.get("CRAYPE_DIR"):
# Undo spack compiler wrappers:
# the C/C++ compilers must work post-install
real_cc = join_path(env["CRAYPE_DIR"], "bin", "cc")
@ -188,7 +186,10 @@ def install(self, spec, prefix):
# Append the recommended options for Cray Shasta
# This list can be pruned once the floor version reaches 2022.9.0
options.append("--with-pmi-version=cray")
options.append("--with-pmi-runcmd='srun -n %N -- %C'")
if which("srun"):
options.append("--with-pmi-runcmd=srun -n %N -- %C")
elif which("aprun"):
options.append("--with-pmi-runcmd=aprun -n %N %C")
options.append("--disable-ibv")
options.append("--enable-ofi")
options.append("--with-default-network=ofi")
@ -286,4 +287,8 @@ def determine_variants(cls, exes, version_str):
variants += "+rocm"
else:
variants += "~rocm"
if re.search(r"-DUPCXXI_ZE_ENABLED=1", output):
variants += "+level_zero"
else:
variants += "~level_zero"
return variants