From b7c2cc9b85493b44147e730d2e8b8413f625b92d Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Fri, 14 Apr 2023 19:17:41 -0400 Subject: 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 --- var/spack/repos/builtin/packages/upcxx/package.py | 33 +++++++++++++---------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/upcxx/package.py b/var/spack/repos/builtin/packages/upcxx/package.py index 3cb89840e8..80dfa66d83 100644 --- a/var/spack/repos/builtin/packages/upcxx/package.py +++ b/var/spack/repos/builtin/packages/upcxx/package.py @@ -10,15 +10,21 @@ from spack.package import * 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 @@ class Upcxx(Package, CudaPackage, ROCmPackage): 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 @@ class Upcxx(Package, CudaPackage, ROCmPackage): # 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 @@ class Upcxx(Package, CudaPackage, ROCmPackage): variants += "+rocm" else: variants += "~rocm" + if re.search(r"-DUPCXXI_ZE_ENABLED=1", output): + variants += "+level_zero" + else: + variants += "~level_zero" return variants -- cgit v1.2.3-70-g09d2