diff --git a/.gitlab/tests/non_shared.yml b/.gitlab/tests/non_shared.yml index 0689ce7c4..abdb92348 100644 --- a/.gitlab/tests/non_shared.yml +++ b/.gitlab/tests/non_shared.yml @@ -17,7 +17,7 @@ workflow: - HOST: lassen ARCHCONFIG: llnl-sierra SCHEDULER_PARAMETERS: -nnodes 1 -W 40 -q pci - BENCHMARK: [amg2023, kripke] + BENCHMARK: [amg2023] VARIANT: [+cuda, +openmp] run_tests_nonshared: resource_group: $HOST diff --git a/.gitlab/utils/run-experiment.sh b/.gitlab/utils/run-experiment.sh index 8ab4468bf..f5be50942 100755 --- a/.gitlab/utils/run-experiment.sh +++ b/.gitlab/utils/run-experiment.sh @@ -4,6 +4,20 @@ set -e # Activate Virtual Environment . /usr/workspace/benchpark-dev/benchpark-venv/$SYS_TYPE/bin/activate + +if [ "$HOST" == "lassen" ]; then + echo "./bin/benchpark system init --dest=${HOST} ${ARCHCONFIG} $SYSTEM_ARGS" +else + echo "./bin/benchpark system init --dest=${HOST} ${ARCHCONFIG} cluster=$HOST $SYSTEM_ARGS" +fi +echo "./bin/benchpark experiment init --dest=${BENCHMARK} --system=${HOST} ${BENCHMARK} ${VARIANT}" +echo "./bin/benchpark setup ${BENCHMARK} wkp/" +echo ". wkp/setup.sh" +echo "cd ./wkp/${BENCHMARK}/${HOST}/workspace/" +echo "ramble --disable-logger --workspace-dir . workspace setup" +echo "ramble --disable-logger --workspace-dir . on --executor '{execute_experiment}' --where '{n_nodes} == 1'" +echo "ramble --disable-logger --workspace-dir . workspace analyze --format json yaml text" + # Initialize System if [ "$HOST" == "lassen" ]; then ./bin/benchpark system init --dest=${HOST} ${ARCHCONFIG} $SYSTEM_ARGS diff --git a/checkout-versions.yaml b/checkout-versions.yaml index 851198578..f1fb4f775 100644 --- a/checkout-versions.yaml +++ b/checkout-versions.yaml @@ -4,4 +4,5 @@ # SPDX-License-Identifier: Apache-2.0 versions: ramble: 6b4ecac # develop on 5/06/2025 (newer than 0.6.0 release) - spack: 7e4b8aa # develop on 2/22/2025 (pre-breaking changes on 1.0) + spack: 7eeef1f + spack-packages: a1941c9 diff --git a/experiments/amg2023/experiment.py b/experiments/amg2023/experiment.py index 51a9d0b54..3cc8aa8de 100644 --- a/experiments/amg2023/experiment.py +++ b/experiments/amg2023/experiment.py @@ -115,3 +115,4 @@ def compute_applications_section(self): def compute_package_section(self): self.add_package_spec(self.name, [f"amg2023{self.determine_version()}"]) + self.add_package_spec("hypre", ["hypre+lapack"]) diff --git a/experiments/kripke/experiment.py b/experiments/kripke/experiment.py index e4f1fc2c1..a482cb95f 100644 --- a/experiments/kripke/experiment.py +++ b/experiments/kripke/experiment.py @@ -156,5 +156,5 @@ def compute_package_section(self): else "~single_memory" ) self.add_package_spec( - self.name, [f"kripke{self.determine_version()} {single_memory} "] + self.name, [f"kripke{self.determine_version()} {single_memory} +mpi"] ) diff --git a/experiments/laghos/experiment.py b/experiments/laghos/experiment.py index 210cd72e6..838339c69 100644 --- a/experiments/laghos/experiment.py +++ b/experiments/laghos/experiment.py @@ -75,3 +75,4 @@ def compute_applications_section(self): def compute_package_section(self): self.add_package_spec(self.name, [f"laghos{self.determine_version()} +metis"]) + self.add_package_spec("hypre", ["hypre@2.32.0: +lapack"]) diff --git a/experiments/raja-perf/experiment.py b/experiments/raja-perf/experiment.py index eb822d6b1..4ea7474de 100644 --- a/experiments/raja-perf/experiment.py +++ b/experiments/raja-perf/experiment.py @@ -91,4 +91,4 @@ def compute_applications_section(self): self.add_experiment_variable("n_ranks", "{n_resources}", True) def compute_package_section(self): - self.add_package_spec(self.name, [f"raja-perf{self.determine_version()}"]) + self.add_package_spec(self.name, [f"raja-perf{self.determine_version()} +mpi"]) diff --git a/lib/benchpark/cmd/setup.py b/lib/benchpark/cmd/setup.py index 167cb7f45..59fabcdc9 100644 --- a/lib/benchpark/cmd/setup.py +++ b/lib/benchpark/cmd/setup.py @@ -173,7 +173,17 @@ def include_fn(fname): if pkg_manager == "spack": spack, first_time_spack = per_workspace_setup.spack_first_time_setup() if first_time_spack: - spack("repo", "add", "--scope=site", f"{source_dir}/repo") + site_repos = ( + per_workspace_setup.spack_location / "etc" / "spack" / "repos.yaml" + ) + with open(site_repos, "w") as f: + f.write( + f"""\ +repos:: + benchpark: {source_dir}/repo + builtin: {per_workspace_setup.pkgs_location}/repos/spack_repo/builtin/ +""" + ) pkg_str = f"""\ . {per_workspace_setup.spack_location}/share/spack/setup-env.sh diff --git a/lib/benchpark/runtime.py b/lib/benchpark/runtime.py index 39865bb50..9d601caec 100644 --- a/lib/benchpark/runtime.py +++ b/lib/benchpark/runtime.py @@ -68,29 +68,43 @@ def __init__(self, dest, upstream=None): self.dest = pathlib.Path(dest) self.upstream = upstream - self.ramble_location, self.spack_location = ( + self.ramble_location, self.spack_location, self.pkgs_location = ( self.dest / "ramble", self.dest / "spack", + self.dest / "spack-packages", ) # Read pinned versions of ramble and spack with open(benchpark.paths.checkout_versions, "r") as yaml_file: data = yaml.safe_load(yaml_file)["versions"] - self.ramble_commit, self.spack_commit = data["ramble"], data["spack"] + self.ramble_commit, self.spack_commit, self.pkgs_commit = ( + data["ramble"], + data["spack"], + data["spack-packages"], + ) # Read remote urls for ramble and spack with open(benchpark.paths.remote_urls, "r") as yaml_file: data = yaml.safe_load(yaml_file)["urls"] - remote_ramble_url, remote_spack_url = data["ramble"], data["spack"] + remote_ramble_url, remote_spack_url, remote_pkgs_url = ( + data["ramble"], + data["spack"], + data["spack-packages"], + ) # If this does not have an upstream, then we will be cloning from the URLs indicated in remote-urls.yaml if self.upstream is None: - self.ramble_url, self.spack_url = remote_ramble_url, remote_spack_url + self.ramble_url, self.spack_url, self.pkgs_url = ( + remote_ramble_url, + remote_spack_url, + remote_pkgs_url, + ) else: # Clone from local "upstream" repository - self.ramble_url, self.spack_url = ( + self.ramble_url, self.spack_url, self.pkgs_url = ( self.upstream.ramble_location, self.upstream.spack_location, + self.upstream.pkgs_location, ) def _check_and_update_bootstrap(self, desired_commit, location): @@ -117,6 +131,11 @@ def bootstrap(self): if internals not in sys.path: sys.path.insert(1, internals) + if not self.pkgs_location.exists(): + self._install_packages() + else: + self._check_and_update_bootstrap(self.pkgs_commit, self.pkgs_location) + # Spack does not go in sys.path, but we will manually access modules from it # The reason for this oddity is that spack modules will compete with the internal # spack modules from ramble @@ -143,6 +162,15 @@ def _install_spack(self): ) debug_print(f"Done cloning Spack ({self.spack_location})") + def _install_packages(self): + print(f"Cloning packages to {self.pkgs_location}") + git_clone_commit( + self.pkgs_url, + self.pkgs_commit, + self.pkgs_location, + ) + debug_print(f"Done cloning spack-packages ({self.pkgs_location})") + def _ramble(self): first_time = False if not self.ramble_location.exists(): @@ -151,10 +179,13 @@ def _ramble(self): return Command(self.ramble_location / "bin" / "ramble", env={}), first_time def _spack(self): + if not self.pkgs_location.exists(): + self._install_packages() + env = {"SPACK_DISABLE_LOCAL_CONFIG": "1"} spack = Command(self.spack_location / "bin" / "spack", env) spack_cache_location = self.spack_location / "misc-cache" - bootstrap_cache_location = self.spack_location / "b-c" + bootstrap_cache_location = self.dest / "sbc" first_time = False if not self.spack_location.exists(): first_time = True diff --git a/lib/benchpark/system.py b/lib/benchpark/system.py index c4f6e1532..c06fbef36 100644 --- a/lib/benchpark/system.py +++ b/lib/benchpark/system.py @@ -203,20 +203,22 @@ def compute_software_section(self): def compute_dict(self): # This can be overridden by any subclass that needs more flexibility - compilers = self.compute_compilers_section() + pkg_cfg = self.compute_packages_section() or {} + compiler_cfg = self.compute_compilers_section() + if compiler_cfg: + pkg_cfg = merge_dicts(pkg_cfg, compiler_cfg) + # "'packages:':" syntax is required to enforce spack to use benchpark-defined + # compilers instead of external compilers defined by spack compiler search (from ramble). + if pkg_cfg: + pkg_cfg = {"packages:": pkg_cfg["packages"]} + else: + pkg_cfg = {"packages": {}} return { "system_id": self.compute_system_id(), "variables": self.compute_variables_section(), "software": self.compute_software_section(), "auxiliary_software_files": { - "compilers": ( - # "'compilers:':" syntax is required to enforce spack to use benchpark-defined - # compilers instead of external compilers defined by spack compiler search (from ramble). - {"compilers:": compilers["compilers"]} - if compilers - else None - ), - "packages": self.compute_packages_section(), + "packages": pkg_cfg, }, } @@ -233,3 +235,81 @@ def _write_key_file(destdir, key, sys_dict): _write_key_file(destdir + "/" + key, k, system_dict[key]) else: _write_key_file(destdir, key, system_dict) + + +def merge_dicts(*dicts): + current = {} + for d in dicts: + if not d: + continue + current = _merge_dicts(current, d) + return current + + +def _merge_dicts(d1, d2): + result = dict(d1) + for k, v2 in d2.items(): + if k in result: + v1 = result[k] + if all(isinstance(x, dict) for x in (v1, v2)): + result[k] = _merge_dicts(v1, v2) + elif all(isinstance(x, list) for x in (v1, v2)): + result[k] = v1 + v2 + else: + raise ValueError(f"{k} merge mismatch: {v1}/{v2}") + else: + result[k] = v2 + return result + + +def hybrid_compiler_requirements(c_cmp, f_cmp): + return { + "packages": { + "all": { + "require": [ + { + "spec": rf"%[virtuals=c] {c_cmp}", + "when": r"%c", + }, + {"spec": rf"%[virtuals=cxx] {c_cmp}", "when": r"%cxx"}, + {"spec": rf"^[virtuals=fortran] {f_cmp}", "when": r"^fortran"}, + ] + } + } + } + + +def compiler_section_for(name, entries): + return {"packages": {name: {"externals": entries, "buildable": False}}} + + +def compiler_def( + spec, + prefix, + exes, + env=None, + extra_rpaths=None, + modules=None, + flags=None, + compilers_use_relative_paths=False, +): + lang_map = {} + for lang, exe in exes.items(): + if os.path.isabs(exe) or compilers_use_relative_paths: + lang_map[lang] = exe + else: + lang_map[lang] = os.path.join(prefix, "bin", exe) + entry = { + "spec": spec, + "prefix": prefix, + "extra_attributes": {"compilers": lang_map}, + } + if env: + entry["extra_attributes"]["environment"] = env + if extra_rpaths: + entry["extra_attributes"]["extra_rpaths"] = extra_rpaths + if modules: + entry["modules"] = modules + if flags: + entry["extra_attributes"]["flags"] = flags + return entry diff --git a/remote-urls.yaml b/remote-urls.yaml index 2dbc1050c..7221ad355 100644 --- a/remote-urls.yaml +++ b/remote-urls.yaml @@ -5,3 +5,4 @@ urls: ramble: https://github.com/GoogleCloudPlatform/ramble.git spack: https://github.com/spack/spack.git + spack-packages: https://github.com/spack/spack-packages.git diff --git a/repo/ad/package.py b/repo/ad/package.py index 87a0ad639..83beb4f1c 100644 --- a/repo/ad/package.py +++ b/repo/ad/package.py @@ -19,6 +19,10 @@ class Ad(CMakePackage): version("main", branch="main") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("enzyme") def cmake_args(self): diff --git a/repo/affinity/package.py b/repo/affinity/package.py index 93a492ac0..27b6a6561 100644 --- a/repo/affinity/package.py +++ b/repo/affinity/package.py @@ -20,6 +20,9 @@ class Affinity(CMakePackage, CudaPackage, ROCmPackage): variant("mpi", default=False, description="Build MPI support") variant("rocm", default=False, description="Build ROCm Support") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("mpi", when="+mpi") depends_on("hip", when="+rocm") depends_on("cuda", when="+cuda") diff --git a/repo/amg2023/package.py b/repo/amg2023/package.py index a8c3448a3..a876648c5 100644 --- a/repo/amg2023/package.py +++ b/repo/amg2023/package.py @@ -26,6 +26,9 @@ class Amg2023(CMakePackage, CudaPackage, ROCmPackage): variant("openmp", default=False, description="Enable OpenMP support") variant("caliper", default=False, description="Enable Caliper monitoring") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("mpi", when="+mpi") depends_on("hypre+mpi", when="+mpi") requires("+mpi", when="^hypre+mpi") @@ -36,14 +39,12 @@ class Amg2023(CMakePackage, CudaPackage, ROCmPackage): depends_on("hypre+mixedint~fortran") depends_on("hypre+cuda", when="+cuda") - depends_on("hypre+cublas", when="+cuda") depends_on("hypre+openmp", when="+openmp") requires("+cuda", when="^hypre+cuda") for arch in ("none", "50", "60", "70", "80", "90"): depends_on(f"hypre cuda_arch={arch}", when=f"cuda_arch={arch}") depends_on("hypre+rocm", when="+rocm") - depends_on("hypre+rocblas", when="+rocm") requires("+rocm", when="^hypre+rocm") for target in ("none", "gfx803", "gfx900", "gfx906", "gfx908", "gfx90a", "gfx942"): depends_on(f"hypre amdgpu_target={target}", when=f"amdgpu_target={target}") diff --git a/repo/babelstream/package.py b/repo/babelstream/package.py index 4e06c9164..f66aedaef 100644 --- a/repo/babelstream/package.py +++ b/repo/babelstream/package.py @@ -87,6 +87,11 @@ class Babelstream(CMakePackage, CudaPackage, ROCmPackage): msg="RAJA implementation requires architecture to be specified by dir=", ) + # Confirmed c++ and Fortran + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + # Thrust Conflict # conflicts("~cuda", when="+thrust", msg="Thrust requires +cuda variant") depends_on("thrust", when="+thrust") diff --git a/repo/blt/package.py b/repo/blt/package.py index 5c396a714..0a9c0d2e4 100644 --- a/repo/blt/package.py +++ b/repo/blt/package.py @@ -7,7 +7,8 @@ import re from spack.package import * -from spack.pkg.builtin.blt import Blt as BuiltinBlt +from spack_repo.builtin.packages.blt.package import Blt as BuiltinBlt + class Blt(BuiltinBlt): diff --git a/repo/branson/package.py b/repo/branson/package.py index 14e31c343..b8610b09a 100644 --- a/repo/branson/package.py +++ b/repo/branson/package.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from spack.package import * -from spack.pkg.builtin.boost import Boost +from spack_repo.builtin.packages.boost.package import Boost class Branson(CMakePackage): @@ -30,6 +30,10 @@ class Branson(CMakePackage): ) version("0.81", sha256="493f720904791f06b49ff48c17a681532c6a4d9fa59636522cf3f9700e77efe4") version("0.8", sha256="85ffee110f89be00c37798700508b66b0d15de1d98c54328b6d02a9eb2cf1cb8") + + depends_on("c", type="build") + depends_on("cxx", type="build") + #depends_on("mpi") depends_on("mpi@2:") diff --git a/repo/caliper/package.py b/repo/caliper/package.py index 1b13781bd..94744913a 100644 --- a/repo/caliper/package.py +++ b/repo/caliper/package.py @@ -109,6 +109,10 @@ class Caliper(CachedCMakePackage, CudaPackage, ROCmPackage): variant("tools", default=True, description="Enable tools") variant("python", default=False, when="@v2.12:", description="Build Python bindings") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("adiak@0.1:0", when="@2.2:2.10 +adiak") depends_on("adiak@0.4:0", when="@2.11: +adiak") diff --git a/repo/camp/package.py b/repo/camp/package.py index 7450101ef..c83189138 100644 --- a/repo/camp/package.py +++ b/repo/camp/package.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from spack.package import * -from spack.pkg.builtin.camp import Camp as BuiltinCamp +from spack_repo.builtin.packages.camp.package import Camp as BuiltinCamp class Camp(BuiltinCamp): diff --git a/repo/chai/package.py b/repo/chai/package.py index fd89d4f84..56d228c2f 100644 --- a/repo/chai/package.py +++ b/repo/chai/package.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from spack.package import * -from spack.pkg.builtin.chai import Chai as BuiltinChai +from spack_repo.builtin.packages.chai.package import Chai as BuiltinChai class Chai(BuiltinChai): diff --git a/repo/cray-mpich/package.py b/repo/cray-mpich/package.py index e6b3ec83c..cff4bf129 100644 --- a/repo/cray-mpich/package.py +++ b/repo/cray-mpich/package.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from spack.package import * -from spack.pkg.builtin.cray_mpich import CrayMpich as BuiltinCM +from spack_repo.builtin.packages.cray_mpich.package import CrayMpich as BuiltinCM class CrayMpich(BuiltinCM): diff --git a/repo/cuda/package.py b/repo/cuda/package.py index 2011ea0f1..51945ea5b 100644 --- a/repo/cuda/package.py +++ b/repo/cuda/package.py @@ -7,11 +7,11 @@ import llnl.util.tty as tty from spack.package import * -import spack.pkg.builtin.cuda +import spack_repo.builtin.packages.cuda.package from llnl.util.filesystem import find_headers -class Cuda(spack.pkg.builtin.cuda.Cuda): +class Cuda(spack_repo.builtin.packages.cuda.package.Cuda): # Layout of hpc-sdk puts some headers in sibling directories: # cuda compiler in /opt/nvidia/hpc_sdk/Linux_aarch64/24.7/cuda/12.5 # cufft in /opt/nvidia/hpc_sdk/Linux_aarch64/24.7/math_libs/12.5 diff --git a/repo/enzyme/package.py b/repo/enzyme/package.py index a2a6519fd..f99ee2b55 100644 --- a/repo/enzyme/package.py +++ b/repo/enzyme/package.py @@ -19,6 +19,10 @@ class Enzyme(CMakePackage): version("patch-1", branch="patch-1") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("llvm@18:") root_cmakelists_dir = "enzyme" diff --git a/repo/essl/package.py b/repo/essl/package.py index e8f433180..1394c97b1 100644 --- a/repo/essl/package.py +++ b/repo/essl/package.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from spack.package import * -from spack.pkg.builtin.essl import Essl as BuiltinEssl +from spack_repo.builtin.packages.essl.package import Essl as BuiltinEssl class Essl(BuiltinEssl): diff --git a/repo/genesis/package.py b/repo/genesis/package.py index 62be4a495..b682ce331 100644 --- a/repo/genesis/package.py +++ b/repo/genesis/package.py @@ -39,6 +39,11 @@ class Genesis(AutotoolsPackage): variant("simd", description="Build with SIMD width.", default="auto", values=("auto", "MIC-AVX512", "CORE-AVX512", "CORE-AVX2"), multi=False) variant("debug", description="Set Debug level", default="0", values=("0", "1", "2", "3", "4"), multi=False) + # Has Fortran but I didn't see c/c++ code + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("mpi", when="+mpi") depends_on("lapack", when="+lapack") depends_on("cuda", when="+gpu") diff --git a/repo/gpcnet/package.py b/repo/gpcnet/package.py index 49caf2a36..5af600c4b 100644 --- a/repo/gpcnet/package.py +++ b/repo/gpcnet/package.py @@ -20,7 +20,9 @@ class Gpcnet(MakefilePackage): version("1.2", tag="1.2") variant("mpi", default=False, description="Build with MPI support") - + + depends_on("c", type="build") + depends_on("mpi", when="+mpi") @property diff --git a/repo/gromacs/package.py b/repo/gromacs/package.py index 3234686ec..abd6feeec 100644 --- a/repo/gromacs/package.py +++ b/repo/gromacs/package.py @@ -7,7 +7,9 @@ import llnl.util.filesystem as fs -import spack.build_systems.cmake +from spack_repo.builtin.build_systems.cmake import CMakePackage, CMakeBuilder +from spack_repo.builtin.build_systems.cuda import CudaPackage +from spack_repo.builtin.build_systems.rocm import ROCmPackage from spack.package import * @@ -203,6 +205,8 @@ class Gromacs(CMakePackage, CudaPackage, ROCmPackage): msg="GROMACS requires oneMKL 2021.3 or later since version 2023", ) + depends_on("c", type="build") + depends_on("mpi", when="+mpi") # Plumed 2.9.0 needs Gromacs 2023, 2022.5, 2021.7, 2020.7 @@ -426,7 +430,7 @@ def setup_build_environment(self, env): for rpath in self.compiler.extra_rpaths: env.prepend_path("LD_LIBRARY_PATH", rpath) -class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder): +class CMakeBuilder(CMakeBuilder): @run_after("build") def build_test_binaries(self): """Build the test binaries. diff --git a/repo/hipsycl/package.py b/repo/hipsycl/package.py index 430cbe465..50660cf89 100644 --- a/repo/hipsycl/package.py +++ b/repo/hipsycl/package.py @@ -40,6 +40,9 @@ class Hipsycl(CMakePackage, CudaPackage, ROCmPackage): variant("sscp", default=False, description="Enable SSCP compiler") variant("intel", default=False, description="Enable Intel Level Zero backend for SYCL kernels") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("cmake@3.5:", type="build") depends_on("boost +filesystem", when="@:0.8") depends_on("boost@1.67.0:1.69.0 +filesystem +fiber +context cxxstd=17", when="@0.9.1:") diff --git a/repo/hpcg/package.py b/repo/hpcg/package.py index 34e62c698..33f39cb06 100644 --- a/repo/hpcg/package.py +++ b/repo/hpcg/package.py @@ -24,12 +24,15 @@ class Hpcg(CMakePackage): variant("openmp", default=True, description="Enable OpenMP support") variant("caliper", default=False, description="Enable Caliper support") - + + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("mpi@1.1:") depends_on("caliper", when="+caliper") depends_on("adiak", when="+caliper") - def cmake_args(self): build_targets = ["all", "docs"] install_targets = ["install", "docs"] diff --git a/repo/hpl/package.py b/repo/hpl/package.py index d6ea7c3c6..993124812 100644 --- a/repo/hpl/package.py +++ b/repo/hpl/package.py @@ -17,17 +17,21 @@ class Hpl(AutotoolsPackage): homepage = "https://www.netlib.org/benchmark/hpl/" url = "https://www.netlib.org/benchmark/hpl/hpl-2.2.tar.gz" + git = "https://github.com/daboehme/HPL-caliper.git" # Note: HPL uses autotools starting with 2.3 version("2.3", sha256="32c5c17d22330e6f2337b681aded51637fb6008d3f0eb7c277b163fadd612830") version("2.2", sha256="ac7534163a09e21a5fa763e4e16dfc119bc84043f6e6a807aba666518f8df440") - version("2.3-caliper", git="https://github.com/daboehme/HPL-caliper.git", branch="master", - preferred=False) + version("2.3-caliper", branch="master", preferred=False) variant("openmp", default=False, description="Enable OpenMP support") variant("caliper", default=False, description="Enable Caliper support") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("mpi@1.1:") depends_on("blas") diff --git a/repo/hypre/package.py b/repo/hypre/package.py index fd2fa7a94..b38c99efd 100644 --- a/repo/hypre/package.py +++ b/repo/hypre/package.py @@ -6,7 +6,7 @@ import os from spack.package import * -from spack.pkg.builtin.hypre import Hypre as BuiltinHypre +from spack_repo.builtin.packages.hypre.package import Hypre as BuiltinHypre class Hypre(BuiltinHypre): @@ -18,17 +18,6 @@ class Hypre(BuiltinHypre): "gcc": "gnu", } - def configure_args(self): - configure_args = super().configure_args() - - if (self.compiler.fc and 'xlf' in self.compiler.fc) or (self.compiler.f77 and 'xlf' in self.compiler.f77): - if not "+fortran" in self.spec: - configure_args.append("--with-fmangle=no-underscores") - configure_args.append("--with-fmangle-blas=no-underscores") - configure_args.append("--with-fmangle-lapack=no-underscores") - - return configure_args - def setup_build_environment(self, env): if self.spec.satisfies('%oneapi'): compiler_version = self.spec.compiler.version diff --git a/repo/kokkos/package.py b/repo/kokkos/package.py index 9577eca43..fe1054438 100644 --- a/repo/kokkos/package.py +++ b/repo/kokkos/package.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from spack.package import * -from spack.pkg.builtin.kokkos import Kokkos as BuiltinKokkos +from spack_repo.builtin.packages.kokkos.package import Kokkos as BuiltinKokkos class Kokkos(BuiltinKokkos): diff --git a/repo/kripke/package.py b/repo/kripke/package.py index 345164243..f0cda3a90 100644 --- a/repo/kripke/package.py +++ b/repo/kripke/package.py @@ -58,6 +58,10 @@ class Kripke(CMakePackage, CudaPackage, ROCmPackage): conflicts("+single_memory", when="~rocm") depends_on("chai+single_memory", when="+single_memory") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("chai@2024.07.0+raja", when="@1.2.7.0:") depends_on("fmt@9.1", when=f"^chai@2024.07.0") @@ -128,8 +132,9 @@ def cmake_args(self): args.append("-DHIP_ROOT_DIR={0}".format(spec["hip"].prefix)) rocm_archs = spec.variants["amdgpu_target"].value if "none" not in rocm_archs: - args.append("-DHIP_HIPCC_FLAGS=--amdgpu-target={0}".format(",".join(rocm_archs))) - args.append("-DCMAKE_HIP_ARCHITECTURES={0}".format(rocm_archs)) + arch_str = ",".join(rocm_archs) + args.append("-DHIP_HIPCC_FLAGS=--amdgpu-target={0}".format(arch_str)) + args.append("-DCMAKE_HIP_ARCHITECTURES={0}".format(arch_str)) else: # Ensure build with hip is disabled args.append("-DENABLE_HIP=OFF") diff --git a/repo/laghos/package.py b/repo/laghos/package.py index 46150fbfd..2adf767a1 100644 --- a/repo/laghos/package.py +++ b/repo/laghos/package.py @@ -28,6 +28,10 @@ class Laghos(MakefilePackage, CudaPackage, ROCmPackage): variant("caliper", default=False, description="Enable/disable Caliper support") variant("ofast", default=False, description="Enable gcc optimization flags") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("mfem+mpi+metis", when="+metis") depends_on("mfem+mpi~metis", when="~metis") depends_on("caliper", when="+caliper") @@ -48,7 +52,7 @@ class Laghos(MakefilePackage, CudaPackage, ROCmPackage): depends_on("mpi") depends_on("hypre+mpi") - depends_on("hypre+cuda+cublas+mpi", when="+cuda") + depends_on("hypre+cuda+mpi", when="+cuda") depends_on("hypre+mixedint~fortran", when="@develop") depends_on("hypre+caliper", when="+caliper") @@ -59,7 +63,7 @@ class Laghos(MakefilePackage, CudaPackage, ROCmPackage): depends_on("mfem +cuda+mpi", when="+cuda") depends_on("mfem +rocm+mpi", when="+rocm") - depends_on("hypre +rocm+rocblas +mpi", when="+rocm") + depends_on("hypre +rocm+mpi", when="+rocm") requires("+rocm", when="^hypre+rocm") for target in ("none", "gfx803", "gfx900", "gfx906", "gfx908", "gfx90a", "gfx942"): depends_on(f"hypre amdgpu_target={target}", when=f"amdgpu_target={target}") diff --git a/repo/lammps/package.py b/repo/lammps/package.py index d4190b5b5..f02adcac6 100644 --- a/repo/lammps/package.py +++ b/repo/lammps/package.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from spack.package import * -from spack.pkg.builtin.lammps import Lammps as BuiltinLammps +from spack_repo.builtin.packages.lammps.package import Lammps as BuiltinLammps class Lammps(BuiltinLammps): diff --git a/repo/mfem/package.py b/repo/mfem/package.py index 5121c50b4..db456df40 100644 --- a/repo/mfem/package.py +++ b/repo/mfem/package.py @@ -8,7 +8,7 @@ import sys from spack.package import * -from spack.pkg.builtin.mfem import Mfem as BuiltinMfem +from spack_repo.builtin.packages.mfem.package import Mfem as BuiltinMfem class Mfem(BuiltinMfem): diff --git a/repo/osu-micro-benchmarks/package.py b/repo/osu-micro-benchmarks/package.py index d94fd9731..2196051cb 100644 --- a/repo/osu-micro-benchmarks/package.py +++ b/repo/osu-micro-benchmarks/package.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from spack.package import * -from spack.pkg.builtin.osu_micro_benchmarks import OsuMicroBenchmarks as BuiltinOsu +from spack_repo.builtin.packages.osu_micro_benchmarks.package import OsuMicroBenchmarks as BuiltinOsu class OsuMicroBenchmarks(BuiltinOsu, ROCmPackage): diff --git a/repo/phloem/package.py b/repo/phloem/package.py index 7fabb80a2..37992ac89 100644 --- a/repo/phloem/package.py +++ b/repo/phloem/package.py @@ -17,7 +17,11 @@ class Phloem(MakefilePackage): version("1.4.5", tag="v1.4.5") variant("mpi", default=False, description="Build with MPI support") - + + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("mpi", when="+mpi") def install(self, spec, prefix): diff --git a/repo/quicksilver/package.py b/repo/quicksilver/package.py index 1a18d1083..e797ae5cc 100644 --- a/repo/quicksilver/package.py +++ b/repo/quicksilver/package.py @@ -29,6 +29,8 @@ class Quicksilver(MakefilePackage): variant("cuda", default=False, description="Build with CUDA support") variant("caliper", default=False, description="Build with Caliper support") + depends_on("c", type="build") + depends_on("mpi", when="+mpi") depends_on("caliper", when="+caliper") depends_on("adiak", when="+caliper") diff --git a/repo/qws/package.py b/repo/qws/package.py index c9403d050..0b7e5d2a8 100644 --- a/repo/qws/package.py +++ b/repo/qws/package.py @@ -19,6 +19,10 @@ class Qws(MakefilePackage): variant("openmp", default=True, description="Build with OpenMP enabled.") variant("caliper", default=False, description="Enable Caliper monitoring") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("mpi", when="+mpi") depends_on("caliper", when="+caliper") depends_on("adiak", when="+caliper") diff --git a/repo/raja-perf/package.py b/repo/raja-perf/package.py index 8bbba7561..2ae7defdf 100644 --- a/repo/raja-perf/package.py +++ b/repo/raja-perf/package.py @@ -35,7 +35,7 @@ def hip_repair_cache(options, spec): options.append( cmake_cache_path( "HIP_CLANG_INCLUDE_PATH", - glob.glob("{}/lib/clang/*/include".format(spec["llvm-amdgpu"].prefix))[0], + glob.glob("{}/llvm/lib/clang/*/include".format(spec["llvm-amdgpu"].prefix))[0], ) ) @@ -153,6 +153,10 @@ class RajaPerf(CachedCMakePackage, CudaPackage, ROCmPackage): variant("caliper",default=False, description="Build with support for Caliper based profiling") variant("kokkos", default=False, description="Include Kokkos implementations of the kernels in RAJAPerf") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("blt") depends_on("blt@0.7.0:", type="build", when="@2025.03.0:") depends_on("blt@0.5.2:", type="build", when="@2022.10.0:") diff --git a/repo/raja/package.py b/repo/raja/package.py index 8243ba748..028b12d30 100644 --- a/repo/raja/package.py +++ b/repo/raja/package.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from spack.package import * -from spack.pkg.builtin.raja import Raja as BuiltinRaja +from spack_repo.builtin.packages.raja.package import Raja as BuiltinRaja class Raja(BuiltinRaja): diff --git a/repo/remhos/package.py b/repo/remhos/package.py index 663c359f8..8120ca172 100644 --- a/repo/remhos/package.py +++ b/repo/remhos/package.py @@ -31,6 +31,10 @@ class Remhos(MakefilePackage, CudaPackage, ROCmPackage): variant("metis", default=True, description="Enable/disable METIS support") variant("caliper", default=False, description="Enable/disable Caliper support") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + depends_on("mfem+mpi+metis", when="+metis") depends_on("mfem+mpi~metis", when="~metis") depends_on("caliper", when="+caliper") diff --git a/repo/salmon-tddft/package.py b/repo/salmon-tddft/package.py index d0d028ebf..0b0ea57c3 100644 --- a/repo/salmon-tddft/package.py +++ b/repo/salmon-tddft/package.py @@ -22,6 +22,10 @@ class SalmonTddft(CMakePackage): version("2.0.0", sha256="c3bb80bc5d338cba21cd8f345acbf2f2d81ef75af069a0a0ddbdc0acf358456c") version("1.2.1", sha256="a5045149e49abe9dd9edefe00cd1508a1323081bc3d034632176b728effdbaeb") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") + variant("mpi", default=False, description="Enable MPI") variant("openmp", default=False, description="Enable OpenMP") variant("libxc", default=False, description="Enable libxc") diff --git a/repo/saxpy/package.py b/repo/saxpy/package.py index 25dc76ce0..59d78e6ce 100644 --- a/repo/saxpy/package.py +++ b/repo/saxpy/package.py @@ -28,6 +28,8 @@ class Saxpy(CMakePackage, CudaPackage, ROCmPackage): conflicts("+rocm", when="+cuda+openmp") conflicts("+openmp", when="+rocm+cuda") + depends_on("c", type="build") + depends_on("cmake") depends_on("mpi") depends_on("caliper", when="+caliper") diff --git a/repo/smb/package.py b/repo/smb/package.py index 0ae0f08e7..656d3ab53 100644 --- a/repo/smb/package.py +++ b/repo/smb/package.py @@ -19,7 +19,11 @@ class Smb(MakefilePackage): variant("mpi", default=False, description="Build with MPI support") variant("rma", default=False, description="Build RMA-MT variant") + + depends_on("c", type="build") + depends_on("mpi", when="+mpi") + build_directory = ["src/mpi_overhead"] def edit(self, spec, prefix): diff --git a/repo/spectrum-mpi/package.py b/repo/spectrum-mpi/package.py index fba38532a..41c2f3fe2 100644 --- a/repo/spectrum-mpi/package.py +++ b/repo/spectrum-mpi/package.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from spack.package import * -from spack.pkg.builtin.spectrum_mpi import SpectrumMpi as BuiltinSM +from spack_repo.builtin.packages.spectrum_mpi.package import SpectrumMpi as BuiltinSM class SpectrumMpi(BuiltinSM): diff --git a/repo/stream/package.py b/repo/stream/package.py index e047fd80f..d57a3069e 100644 --- a/repo/stream/package.py +++ b/repo/stream/package.py @@ -24,6 +24,9 @@ class Stream(CMakePackage): requires("@5.10-caliper", when="+caliper") + depends_on("c", type="build") + depends_on("fortran", type="build") + depends_on("caliper", when="+caliper") depends_on("adiak@0.4:", when="+caliper") diff --git a/repo/umpire/package.py b/repo/umpire/package.py index f9f54f1de..ea3a4f171 100644 --- a/repo/umpire/package.py +++ b/repo/umpire/package.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from spack.package import * -from spack.pkg.builtin.umpire import Umpire as BuiltinUmpire +from spack_repo.builtin.packages.umpire.package import Umpire as BuiltinUmpire class Umpire(BuiltinUmpire): diff --git a/systems/aws-pcluster/system.py b/systems/aws-pcluster/system.py index cb5bc948c..c0d10313d 100644 --- a/systems/aws-pcluster/system.py +++ b/systems/aws-pcluster/system.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 -from benchpark.system import System +from benchpark.system import System, compiler_def, compiler_section_for from benchpark.directives import variant, maintainers from benchpark.openmpsystem import OpenMPCPUOnlySystem from benchpark.paths import hardware_descriptions @@ -101,28 +101,16 @@ def compute_packages_section(self): } def compute_compilers_section(self): - - return { - "compilers": [ - { - "compiler": { - "spec": "gcc@7.3.1", - "paths": { - "cc": "/usr/bin/gcc", - "cxx": "/usr/bin/g++", - "f77": "/usr/bin/gfortran", - "fc": "/usr/bin/gfortran", - }, - "flags": {}, - "operating_system": "alinux2", - "target": "x86_64", - "modules": [], - "environment": {}, - "extra_rpaths": [], - } - } - ] - } + return compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@7.3.1 languages=c,c++,fortran", + "/usr/", + {"c": "gcc", "cxx": "g++", "fortran": "gfortran"}, + ) + ], + ) def compute_software_section(self): return { diff --git a/systems/csc-lumi/system.py b/systems/csc-lumi/system.py index 02ff7d5ce..d9e48fbb4 100644 --- a/systems/csc-lumi/system.py +++ b/systems/csc-lumi/system.py @@ -7,7 +7,7 @@ from benchpark.directives import variant, maintainers from benchpark.paths import hardware_descriptions from benchpark.rocmsystem import ROCmSystem -from benchpark.system import System +from benchpark.system import System, compiler_def, compiler_section_for, merge_dicts from packaging.version import Version @@ -161,107 +161,79 @@ def compute_packages_section(self): return selections def compute_compilers_section(self): - selections = self.rocmcc_cfg() + chosen = [self.rocmcc_cfg()] if "cce" in self.spec.variants["compiler"][0]: - selections["compilers"] += self.cce_compiler_cfg()["compilers"] + chosen.append(self.cce_compiler_cfg()) else: - selections["compilers"] += self.gcc_compiler_cfg()["compilers"] + chosen.append(self.gcc_compiler_cfg()) - return selections + return merge_dicts(*chosen) def rocmcc_cfg(self): - return { - "compilers": [ - { - "compiler": { - "spec": f"rocmcc@{self.rocm_version}", - "paths": { - "cc": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/bin/amdclang", - "cxx": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/bin/amdclang++", - "f77": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/bin/amdflang", - "fc": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/bin/amdflang", - }, - # "flags": " ", # Uncomment if needed - "operating_system": "sles15", - "target": "any", - "modules": [], - "environment": { - "set": {"RFE_811452_DISABLE": "1"}, - "append_path": {"LD_LIBRARY_PATH": "/opt/cray/pe/gcc-libs"}, - "prepend_path": { - "LD_LIBRARY_PATH": "/opt/cray/pe/pmi/6.1.12/lib", - "LIBRARY_PATH": f"/appl/lumi/SW/CrayEnv/EB/rocm/5.6.1/lib:/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/lib64", - }, + return compiler_section_for( + "llvm-amdgpu", + [ + compiler_def( + f"llvm-amdgpu@{self.rocm_version}", + f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/", + {"c": "amdclang", "cxx": "amdclang++", "fortran": "amdflang"}, + env={ + "set": {"RFE_811452_DISABLE": "1"}, + "append_path": {"LD_LIBRARY_PATH": "/opt/cray/pe/gcc-libs"}, + "prepend_path": { + "LD_LIBRARY_PATH": "/opt/cray/pe/pmi/6.1.12/lib", + "LIBRARY_PATH": f"/appl/lumi/SW/CrayEnv/EB/rocm/5.6.1/lib:/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/lib64", }, - "extra_rpaths": [ - f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/lib", - f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/lib64", - "/opt/cray/pe/gcc-libs", - ], - } - } - ] - } + }, + extra_rpaths=[ + f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/lib", + f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/lib64", + "/opt/cray/pe/gcc-libs", + ], + ) + ], + ) def cce_compiler_cfg(self): - return { - "compilers": [ - { - "compiler": { - "spec": f"cce@{self.compiler_version}", - "paths": { - "cc": f"/opt/cray/pe/cce/{self.compiler_version}/bin/craycc", - "cxx": f"/opt/cray/pe/cce/{self.compiler_version}/bin/crayCC", - "f77": f"/opt/cray/pe/cce/{self.compiler_version}/bin/crayftn", - "fc": f"/opt/cray/pe/cce/{self.compiler_version}/bin/crayftn", + return compiler_section_for( + "cce", + [ + compiler_def( + f"cce@{self.compiler_version}", + f"/opt/cray/pe/cce/{self.compiler_version}/", + {"c": "craycc", "cxx": "crayCC", "fortran": "crayftn"}, + env={ + "set": {"RFE_811452_DISABLE": "1"}, + "prepend_path": { + "LD_LIBRARY_PATH": "/opt/cray/pe/pmi/6.1.12/lib" }, - # "flags": "", # Uncomment if needed - "operating_system": "sles15", - "target": "any", - "modules": [], - "environment": { - "set": {"RFE_811452_DISABLE": "1"}, - "prepend_path": { - "LD_LIBRARY_PATH": "/opt/cray/pe/pmi/6.1.12/lib" - }, - "append_path": { - "LD_LIBRARY_PATH": "/opt/cray/pe/gcc-libs", - "PKG_CONFIG_PATH": "/usr/lib64/pkgconfig", - }, + "append_path": { + "LD_LIBRARY_PATH": "/opt/cray/pe/gcc-libs", + "PKG_CONFIG_PATH": "/usr/lib64/pkgconfig", }, - "extra_rpaths": ["/opt/cray/pe/gcc-libs"], - } - } - ] - } + }, + extra_rpaths=["/opt/cray/pe/gcc-libs"], + ) + ], + ) def gcc_compiler_cfg(self): - return { - "compilers": [ - { - "compiler": { - "spec": f"gcc@{self.compiler_version}", - "paths": { - "cc": f"/opt/cray/pe/gcc/{self.compiler_version}/bin/gcc", - "cxx": f"/opt/cray/pe/gcc/{self.compiler_version}/bin/g++", - "f77": f"/opt/cray/pe/gcc/{self.compiler_version}/bin/gfortran", - "fc": f"/opt/cray/pe/gcc/{self.compiler_version}/bin/gfortran", - }, - # "flags": "", # Uncomment if needed - "operating_system": "sles15", - "target": "any", - "modules": [], - "environment": { - "prepend_path": { - "LD_LIBRARY_PATH": "/opt/cray/pe/pmi/6.1.12/lib:/opt/cray/libfabric/1.15.2.0/lib64", - "PKG_CONFIG_PATH": "/usr/lib64/pkgconfig", - } - }, - "extra_rpaths": [], - } - } - ] - } + return compiler_section_for( + "gcc", + [ + compiler_def( + f"gcc@{self.compiler_version} languages:=c,c++,fortran", + f"/opt/cray/pe/gcc/{self.compiler_version}/", + {"c": "gcc", "cxx": "g++", "fortran": "gfortran"}, + env={ + "prepend_path": { + "LD_LIBRARY_PATH": "/opt/cray/pe/pmi/6.1.12/lib:/opt/cray/libfabric/1.15.2.0/lib64", + "PKG_CONFIG_PATH": "/usr/lib64/pkgconfig", + } + }, + ) + ], + ) def rocm_config(self): return { @@ -365,206 +337,205 @@ def rocm_config(self): } ], }, - "llvm-amdgpu": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/llvm", - "spec": f"llvm-amdgpu@{self.rocm_version}", - } - ], - }, - "rccl": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rccl@{self.rocm_version}", - } - ], - }, - "rocalution": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocalution@{self.rocm_version}", - } - ], - }, - "rocblas": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocblas@{self.rocm_version}", - } - ], - }, - "rocfft": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocfft@{self.rocm_version}", - } - ], - "variants": "amdgpu_target=auto amdgpu_target_sram_ecc=auto", - }, - "rocm-clang-ocl": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocm-clang-ocl@{self.rocm_version}", - } - ], - }, - "rocm-cmake": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocm-cmake@{self.rocm_version}", - } - ], - }, - "rocm-device-libs": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocm-device-libs@{self.rocm_version}", - } - ], - }, - "rocm-gdb": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocm-gdb@{self.rocm_version}", - } - ], - }, - "rocm-opencl": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/opencl", - "spec": f"rocm-opencl@{self.rocm_version}", - } - ], - }, - "rocm-opencl-runtime": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/opencl", - "spec": f"rocm-opencl-runtime@{self.rocm_version}", - } - ], - }, - "rocm-openmp-extras": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/llvm", - "spec": f"rocm-openmp-extras@{self.rocm_version}", - } - ], - }, - "rocm-smi": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/rocm_smi", - "spec": f"rocmsmi@{self.rocm_version}", - } - ], - }, - "rocm-smi-lib": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/rocm_smi", - "spec": f"rocm-smi-lib@{self.rocm_version}", - } - ], - }, - "rocminfo": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocminfo@{self.rocm_version}", - } - ], - }, - "rocprim": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocprim@{self.rocm_version}", - } - ], - }, - "rocprofiler-dev": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocprofiler-dev@{self.rocm_version}", - } - ], - }, - "rocrand": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocrand@{self.rocm_version}", - } - ], - }, - "rocsolver": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocsolver@{self.rocm_version}", - } - ], - }, - "rocsparse": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocsparse@{self.rocm_version}", - } - ], - }, - "rocthrust": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"rocthrust@{self.rocm_version}", - } - ], - }, - "roctracer-dev": { - "buildable": False, - "externals": [ - { - "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", - "spec": f"roctracer-dev@{self.rocm_version}", - } - ], - }, - } + # "llvm-amdgpu": { + # "buildable": False, + # "externals": [ + # { + # "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/llvm", + # "spec": f"llvm-amdgpu@{self.rocm_version}", + # } + # ], + }, + "rccl": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rccl@{self.rocm_version}", + } + ], + }, + "rocalution": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocalution@{self.rocm_version}", + } + ], + }, + "rocblas": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocblas@{self.rocm_version}", + } + ], + }, + "rocfft": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocfft@{self.rocm_version}", + } + ], + "variants": "amdgpu_target=auto amdgpu_target_sram_ecc=auto", + }, + "rocm-clang-ocl": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocm-clang-ocl@{self.rocm_version}", + } + ], + }, + "rocm-cmake": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocm-cmake@{self.rocm_version}", + } + ], + }, + "rocm-device-libs": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocm-device-libs@{self.rocm_version}", + } + ], + }, + "rocm-gdb": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocm-gdb@{self.rocm_version}", + } + ], + }, + "rocm-opencl": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/opencl", + "spec": f"rocm-opencl@{self.rocm_version}", + } + ], + }, + "rocm-opencl-runtime": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/opencl", + "spec": f"rocm-opencl-runtime@{self.rocm_version}", + } + ], + }, + "rocm-openmp-extras": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/llvm", + "spec": f"rocm-openmp-extras@{self.rocm_version}", + } + ], + }, + "rocm-smi": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/rocm_smi", + "spec": f"rocmsmi@{self.rocm_version}", + } + ], + }, + "rocm-smi-lib": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}/rocm_smi", + "spec": f"rocm-smi-lib@{self.rocm_version}", + } + ], + }, + "rocminfo": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocminfo@{self.rocm_version}", + } + ], + }, + "rocprim": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocprim@{self.rocm_version}", + } + ], + }, + "rocprofiler-dev": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocprofiler-dev@{self.rocm_version}", + } + ], + }, + "rocrand": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocrand@{self.rocm_version}", + } + ], + }, + "rocsolver": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocsolver@{self.rocm_version}", + } + ], + }, + "rocsparse": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocsparse@{self.rocm_version}", + } + ], + }, + "rocthrust": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"rocthrust@{self.rocm_version}", + } + ], + }, + "roctracer-dev": { + "buildable": False, + "externals": [ + { + "prefix": f"/appl/lumi/SW/CrayEnv/EB/rocm/{self.rocm_version}", + "spec": f"roctracer-dev@{self.rocm_version}", + } + ], + }, } def compute_software_section(self): diff --git a/systems/cscs-daint/system.py b/systems/cscs-daint/system.py index 5521d3516..74df88a5f 100644 --- a/systems/cscs-daint/system.py +++ b/systems/cscs-daint/system.py @@ -5,7 +5,7 @@ from benchpark.directives import variant, maintainers -from benchpark.system import System +from benchpark.system import System, compiler_def, compiler_section_for, merge_dicts from benchpark.cudasystem import CudaSystem from packaging.version import Version from benchpark.paths import hardware_descriptions @@ -142,163 +142,98 @@ def compute_packages_section(self): } def compute_compilers_section(self): - compiler_map = { - "cce": { - "compilers": [ - { - "compiler": { - "spec": "cce@12.0.3", - "paths": { - "cc": "cc", - "cxx": "CC", - "f77": "ftn", - "fc": "ftn", - }, - "flags": {}, - "operating_system": "cnl7", - "target": "any", - "modules": ["PrgEnv-cray", "cce/12.0.3"], - "environment": {}, - "extra_rpaths": [], - } - } - ] - }, - "gcc9": { - "compilers": [ - { - "compiler": { - "spec": "gcc@9.3.0", - "paths": { - "cc": "cc", - "cxx": "CC", - "f77": "ftn", - "fc": "ftn", - }, - "flags": {}, - "operating_system": "cnl7", - "target": "any", - "modules": ["PrgEnv-gnu", "gcc/9.3.0"], - "environment": {}, - "extra_rpaths": [], - } - } - ] - }, - "gcc10": { - "compilers": [ - { - "compiler": { - "spec": "gcc@10.3.0", - "paths": { - "cc": "cc", - "cxx": "CC", - "f77": "ftn", - "fc": "ftn", - }, - "flags": {}, - "operating_system": "cnl7", - "target": "any", - "modules": ["PrgEnv-gnu", "gcc/10.3.0"], - "environment": {}, - "extra_rpaths": [], - } - } - ] - }, - "gcc11": { - "compilers": [ - { - "compiler": { - "spec": "gcc@11.2.0", - "paths": { - "cc": "cc", - "cxx": "CC", - "f77": "ftn", - "fc": "ftn", - }, - "flags": {}, - "operating_system": "cnl7", - "target": "any", - "modules": ["PrgEnv-gnu", "gcc/11.2.0"], - "environment": {}, - "extra_rpaths": [], - } - } - ] - }, - "intel": { - "compilers": [ - { - "compiler": { - "spec": "intel@2021.3.0", - "paths": { - "cc": "cc", - "cxx": "CC", - "f77": "ftn", - "fc": "ftn", - }, - "flags": {}, - "operating_system": "cnl7", - "target": "any", - "modules": ["PrgEnv-intel", "intel/2021.3.0"], - "environment": {}, - "extra_rpaths": [], - } - } - ] - }, - "pgi": { - "compilers": [ - { - "compiler": { - "spec": "pgi@20.1.1", - "paths": { - "cc": "cc", - "cxx": "CC", - "f77": "ftn", - "fc": "ftn", - }, - "flags": {}, - "operating_system": "cnl7", - "target": "any", - "modules": ["PrgEnv-pgi", "pgi/20.1.1"], - "environment": {}, - "extra_rpaths": [], - } - } - ] - }, - "nvhpc": { - "compilers": [ - { - "compiler": { - "spec": "nvhpc@21.3", - "paths": { - "cc": "cc", - "cxx": "CC", - "f77": "ftn", - "fc": "ftn", - }, - "flags": {}, - "operating_system": "cnl7", - "target": "any", - "modules": ["PrgEnv-nvidia", "nvidia/21.3"], - "environment": {}, - "extra_rpaths": [], - } - } - ] - }, - } + compiler_map = {} + compiler_map["cce"] = compiler_section_for( + "cce", + [ + compiler_def( + "cce@12.0.3", + "/path/is/now/needed/", # <-- TODO: this needs to be filled in + {"c": "cc", "cxx": "CC", "fortran": "ftn"}, + modules=["PrgEnv-cray", "cce/12.0.3"], + compilers_use_relative_paths=True, + ) + ], + ) + compiler_map["gcc9"] = compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@9.3.0 languages:=c,c++,fortran", + "/path/is/now/needed/", # <-- TODO: this needs to be filled in + {"c": "cc", "cxx": "CC", "fortran": "ftn"}, + modules=["PrgEnv-gnu", "gcc/9.3.0"], + compilers_use_relative_paths=True, + ) + ], + ) + compiler_map["gcc10"] = compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@10.3.0 languages:=c,c++,fortran", + "/path/is/now/needed/", # <-- TODO: this needs to be filled in + {"c": "cc", "cxx": "CC", "fortran": "ftn"}, + modules=["PrgEnv-gnu", "gcc/10.3.0"], + compilers_use_relative_paths=True, + ) + ], + ) + compiler_map["gcc11"] = compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@11.2.0 languages:=c,c++,fortran", + "/path/is/now/needed/", # <-- TODO: this needs to be filled in + {"c": "cc", "cxx": "CC", "fortran": "ftn"}, + modules=["PrgEnv-gnu", "gcc/11.2.0"], + compilers_use_relative_paths=True, + ) + ], + ) + compiler_map["intel"] = compiler_section_for( + "intel-oneapi-compilers", + [ + compiler_def( + "intel-oneapi-compilers@2021.3.0", + "/path/is/now/needed/", # <-- TODO: this needs to be filled in + {"c": "cc", "cxx": "CC", "fortran": "ftn"}, + modules=["PrgEnv-intel", "intel/2021.3.0"], + compilers_use_relative_paths=True, + ) + ], + ) + compiler_map["pgi"] = compiler_section_for( + "pgi", + [ + compiler_def( + "pgi@20.1.1", + "/path/is/now/needed/", # <-- TODO: this needs to be filled in + {"c": "cc", "cxx": "CC", "fortran": "ftn"}, + modules=["PrgEnv-pgi", "pgi/20.1.1"], + compilers_use_relative_paths=True, + ) + ], + ) + compiler_map["nvhpc"] = compiler_section_for( + "nvhpc", + [ + compiler_def( + "nvhpc@21.3", + "/path/is/now/needed/", # <-- TODO: this needs to be filled in + {"c": "cc", "cxx": "CC", "fortran": "ftn"}, + modules=["PrgEnv-nvidia", "nvidia/21.3"], + compilers_use_relative_paths=True, + ) + ], + ) + collected = list() compiler_variant = self.spec.variants["compiler"][0] - selections = {"compilers": []} - for key, config in compiler_map.items(): + for key, cfg in compiler_map.items(): if key in compiler_variant: - selections["compilers"] += config["compilers"] - - return selections + collected.append(cfg) + return merge_dicts(*collected) def cuda_config(self, cuda_version): if cuda_version == "10.2.89": diff --git a/systems/cscs-eiger/system.py b/systems/cscs-eiger/system.py index f59115e92..8bb459906 100644 --- a/systems/cscs-eiger/system.py +++ b/systems/cscs-eiger/system.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from benchpark.directives import variant, maintainers -from benchpark.system import System +from benchpark.system import System, compiler_def, compiler_section_for from benchpark.openmpsystem import OpenMPCPUOnlySystem from packaging.version import Version from benchpark.paths import hardware_descriptions @@ -42,22 +42,18 @@ def __init__(self, spec): setattr(self, k, v) def compute_compilers_section(self): - return { - "compilers": [ - { - "compiler": { - "spec": "gcc@12.3.0", - "paths": {"cc": "cc", "cxx": "CC", "f77": "ftn", "fc": "ftn"}, - "flags": {}, - "target": "any", - "operating_system": "HPECray", - "modules": ["PrgEnv-gnu", "gcc/12.3.0"], - "environment": {}, - "extra_rpaths": [], - } - } - ] - } + return compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@12.3.0 languages:=c,c++,fortran", + "/path/is/now/needed/", # <-- TODO: this needs to be filled in + {"c": "cc", "cxx": "CC", "fortran": "ftn"}, + modules=["PrgEnv-gnu", "gcc/12.3.0"], + compilers_use_relative_paths=True, + ) + ], + ) def compute_packages_section(self): diff --git a/systems/jsc-juwels/system.py b/systems/jsc-juwels/system.py index ff2773e96..2832cb384 100644 --- a/systems/jsc-juwels/system.py +++ b/systems/jsc-juwels/system.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 from benchpark.directives import variant, maintainers -from benchpark.system import System +from benchpark.system import System, compiler_def, compiler_section_for, merge_dicts from benchpark.cudasystem import CudaSystem from packaging.version import Version from benchpark.paths import hardware_descriptions @@ -60,48 +60,35 @@ def __init__(self, spec): setattr(self, k, v) def compute_compilers_section(self): - selections = { - "compilers": [ - { - "compiler": { - "spec": "nvhpc@23.7", - "paths": { - "cc": "/p/software/juwelsbooster/stages/2024/software/NVHPC/23.7-CUDA-12/Linux_aarch64/23.7/compilers/bin/nvc", - "cxx": "/p/software/juwelsbooster/stages/2024/software/NVHPC/23.7-CUDA-12/Linux_aarch64/23.7/compilers/bin/nvc++", - "f77": "/p/software/juwelsbooster/stages/2024/software/NVHPC/23.7-CUDA-12/Linux_aarch64/23.7/compilers/bin/nvfortran", - "fc": "/p/software/juwelsbooster/stages/2024/software/NVHPC/23.7-CUDA-12/Linux_aarch64/23.7/compilers/bin/nvfortran", - }, - "operating_system": "rocky8", - "target": "x86_64", - "modules": ["Stages/2024", "NVHPC/23.7"], - "environment": {}, - "extra_rpaths": [], - } - } - ] - } + nvhpc_cfg = compiler_section_for( + "nvhpc", + [ + compiler_def( + "nvhpc@23.7", + "/p/software/juwelsbooster/stages/2024/software/NVHPC/23.7-CUDA-12/Linux_aarch64/23.7/compilers/", + {"c": "nvc", "cxx": "nvc++", "fortran": "nvfortran"}, + modules=["Stages/2024", "NVHPC/23.7"], + ) + ], + ) if self.spec.satisfies("compiler=gcc"): - selections["compilers"] += [ - { - "compiler": { - "spec": "gcc@12.3.0", - "paths": { - "cc": "/p/software/juwelsbooster/stages/2024/software/GCCcore/12.3.0/bin/gcc", - "cxx": "/p/software/juwelsbooster/stages/2024/software/GCCcore/12.3.0/bin/g++", - "f77": "/p/software/juwelsbooster/stages/2024/software/GCCcore/12.3.0/bin/gfortran", - "fc": "/p/software/juwelsbooster/stages/2024/software/GCCcore/12.3.0/bin/gfortran", - }, - "operating_system": "rocky9", - "target": "aarch64", - "modules": ["Stages/2024", "GCC/12.3.0"], - "environment": {}, - "extra_rpaths": [], - } - } - ] - - return selections + gcc_cfg = compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@12.3.0 languages:=c,c++,fortran", + "/p/software/juwelsbooster/stages/2024/software/GCCcore/12.3.0/", + {"c": "gcc", "cxx": "g++", "fortran": "gfortran"}, + modules=["Stages/2024", "GCC/12.3.0"], + ) + ], + ) + cfg = merge_dicts(nvhpc_cfg, gcc_cfg) + else: + cfg = nvhpc_cfg + + return cfg def compute_packages_section(self): diff --git a/systems/lanl-venado/system.py b/systems/lanl-venado/system.py index 0247d2564..8563053b2 100644 --- a/systems/lanl-venado/system.py +++ b/systems/lanl-venado/system.py @@ -6,7 +6,7 @@ from benchpark.directives import variant, maintainers from benchpark.cudasystem import CudaSystem -from benchpark.system import System +from benchpark.system import System, compiler_def, compiler_section_for, merge_dicts from benchpark.paths import hardware_descriptions from packaging.version import Version @@ -164,65 +164,52 @@ def compute_packages_section(self): return selections def compute_compilers_section(self): - selections = { - "compilers": [ - { - "compiler": { - "spec": "gcc@12.3.0", - "paths": { - "cc": "/usr/projects/hpcsoft/tce/24-07/cos3-aarch64-cc90/compilers/gcc/12.3.0/bin/gcc", - "cxx": "/usr/projects/hpcsoft/tce/24-07/cos3-aarch64-cc90/compilers/gcc/12.3.0/bin/g++", - "f77": "/usr/projects/hpcsoft/tce/24-07/cos3-aarch64-cc90/compilers/gcc/12.3.0/bin/gfortran", - "fc": "/usr/projects/hpcsoft/tce/24-07/cos3-aarch64-cc90/compilers/gcc/12.3.0/bin/gfortran", - }, - "flags": {}, - "operating_system": "sles15", - "target": "aarch64", - "modules": [], - "environment": {}, - "extra_rpaths": [], - } - } - ] - } + gcc_cfg = compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@12.3.0 languages:=c,c++,fortran", + "/usr/projects/hpcsoft/tce/24-07/cos3-aarch64-cc90/compilers/gcc/12.3.0/", + {"c": "gcc", "cxx": "g++", "fortran": "gfortran"}, + ) + ], + ) + # TODO: Construct/extract/customize compiler information from the working set if self.spec.satisfies("compiler=cce"): - selections["compilers"] += [ - { - "compiler": { - "spec": "cce@18.0.0", - "paths": { - "cc": "/opt/cray/pe/cce/18.0.0/bin/craycc", - "cxx": "/opt/cray/pe/cce/18.0.0/bin/crayCC", - "f77": "/opt/cray/pe/cce/18.0.0/bin/crayftn", - "fc": "/opt/cray/pe/cce/18.0.0/bin/crayftn", - }, - "flags": { + cce_cfg = compiler_section_for( + "cce", + [ + compiler_def( + "cce@18.0.0", + "/opt/cray/pe/cce/18.0.0/", + {"c": "cracc", "cxx": "crayCC", "fortran": "crayftn"}, + flags={ "cflags": "-g -O2 --gcc-toolchain=/usr/projects/hpcsoft/tce/24-07/cos3-aarch64-cc90/compilers/gcc/12.3.0", "cxxflags": "-g -O2 --gcc-toolchain=/usr/projects/hpcsoft/tce/24-07/cos3-aarch64-cc90/compilers/gcc/12.3.0", "fflags": "-g -O2 -hnopattern", "ldflags": "-ldl", }, - "operating_system": "sles15", - "target": "aarch64", - "modules": [], - "environment": { + env={ "prepend_path": { "LD_LIBRARY_PATH": "/opt/cray/pe/cce/18.0.0/cce/aarch64/lib:/opt/cray/libfabric/1.20.1/lib64:/usr/projects/hpcsoft/tce/24-07/cos3-aarch64-cc90/compilers/gcc/12.3.0/lib:/usr/projects/hpcsoft/tce/24-07/cos3-aarch64-cc90/compilers/gcc/12.3.0/lib64:/opt/cray/pe/gcc-libs" } }, - "extra_rpaths": [ + extra_rpaths=[ "/opt/cray/pe/gcc-libs", "/opt/cray/pe/cce/18.0.0/cce/aarch64/lib", "/opt/cray/libfabric/1.20.1/lib64", "/usr/projects/hpcsoft/tce/24-07/cos3-aarch64-cc90/compilers/gcc/12.3.0/lib", "/usr/projects/hpcsoft/tce/24-07/cos3-aarch64-cc90/compilers/gcc/12.3.0/lib64", ], - } - } - ] + ) + ], + ) + cfg = merge_dicts(gcc_cfg, cce_cfg) + else: + cfg = gcc_cfg - return selections + return cfg def mpi_config(self): mpi_version = "8.1.30" diff --git a/systems/llnl-cluster/system.py b/systems/llnl-cluster/system.py index f484a7a41..51152a1be 100644 --- a/systems/llnl-cluster/system.py +++ b/systems/llnl-cluster/system.py @@ -5,7 +5,13 @@ from benchpark.directives import variant, maintainers -from benchpark.system import System, JobQueue +from benchpark.system import ( + System, + JobQueue, + compiler_def, + compiler_section_for, + merge_dicts, +) from benchpark.openmpsystem import OpenMPCPUOnlySystem from benchpark.paths import hardware_descriptions @@ -185,6 +191,8 @@ def compute_packages_section(self): | { "mpi": { "buildable": False, + }, + "mvapich2": { "externals": [ { "spec": "mvapich2@2.3.7-gcc1211", @@ -194,7 +202,7 @@ def compute_packages_section(self): }, } ], - } + }, } } elif self.spec.satisfies("compiler=intel"): @@ -203,6 +211,8 @@ def compute_packages_section(self): | { "mpi": { "buildable": False, + }, + "mvapich2": { "externals": [ { "spec": "mvapich2@2.3.7-intel202160classic", @@ -212,7 +222,7 @@ def compute_packages_section(self): }, } ], - } + }, } } elif self.spec.satisfies("compiler=oneapi"): @@ -221,6 +231,8 @@ def compute_packages_section(self): | { "mpi": { "buildable": False, + }, + "mvapich2": { "externals": [ { "spec": "mvapich2@2.3.7-intel202321", @@ -230,113 +242,73 @@ def compute_packages_section(self): }, } ], - } + }, } } - selections["packages"] |= self.compiler_weighting_cfg()["packages"] - return selections - def compiler_weighting_cfg(self): - if self.spec.satisfies("compiler=oneapi"): - return {"packages": {"all": {"require": [{"one_of": ["%oneapi", "%gcc"]}]}}} - else: - return {"packages": {}} - def compute_compilers_section(self): - selections = {} if self.spec.satisfies("compiler=gcc"): - selections = { - "compilers": [ - { - "compiler": { - "spec": "gcc@12.1.1", - "paths": { - "cc": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gcc", - "cxx": "/usr/tce/packages/gcc/gcc-12.1.1/bin/g++", - "f77": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gfortran", - "fc": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gfortran", - }, - "flags": {}, - "operating_system": "rhel8", - "target": "x86_64", - "modules": [], - "environment": {}, - "extra_rpaths": [], - } - } - ] - } + cfg = compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@12.1.1 languages:=c,c++,fortran", + "/usr/tce/packages/gcc/gcc-12.1.1/", + {"c": "gcc", "cxx": "g++", "fortran": "gfortran"}, + ) + ], + ) elif self.spec.satisfies("compiler=intel"): - selections = { - "compilers": [ - { - "compiler": { - "spec": "intel@2021.6.0-classic", - "paths": { - "cc": "/usr/tce/packages/intel-classic/intel-classic-2021.6.0/bin/icc", - "cxx": "/usr/tce/packages/intel-classic/intel-classic-2021.6.0/bin/icpc", - "f77": "/usr/tce/packages/intel-classic/intel-classic-2021.6.0/bin/ifort", - "fc": "/usr/tce/packages/intel-classic/intel-classic-2021.6.0/bin/ifort", - }, - "flags": {}, - "operating_system": "rhel8", - "target": "x86_64", - "modules": [], - "environment": {}, - "extra_rpaths": [], - } - } - ] - } + cfg = compiler_section_for( + "intel-oneapi-compilers-classic", + [ + compiler_def( + "intel-oneapi-compilers-classic@2021.6.0~envmods", + "/usr/tce/packages/intel-classic/intel-classic-2021.6.0/", + {"c": "icc", "cxx": "icpc", "fortran": "ifort"}, + ) + ], + ) elif self.spec.satisfies("compiler=oneapi"): - selections = { - "compilers": [ - { - "compiler": { - "spec": "gcc@12.1.1", - "paths": { - "cc": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gcc", - "cxx": "/usr/tce/packages/gcc/gcc-12.1.1/bin/g++", - "f77": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gfortran", - "fc": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gfortran", - }, - "flags": {}, - "operating_system": "rhel8", - "target": "x86_64", - "modules": [], - "environment": {}, - "extra_rpaths": [], - } - }, - { - "compiler": { - "spec": "oneapi@2023.2.1", - "paths": { - "cc": "/usr/tce/packages/intel/intel-2023.2.1/compiler/2023.2.1/linux/bin/icx", - "cxx": "/usr/tce/packages/intel/intel-2023.2.1/compiler/2023.2.1/linux/bin/icpx", - "f77": "/usr/tce/packages/intel/intel-2023.2.1/compiler/2023.2.1/linux/bin/ifx", - "fc": "/usr/tce/packages/intel/intel-2023.2.1/compiler/2023.2.1/linux/bin/ifx", - }, - "flags": {}, - "operating_system": "rhel8", - "target": "x86_64", - "modules": [], - "environment": {}, - "extra_rpaths": [], - } - }, - ] - } + gcc_cfg = compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@12.1.1", + "/usr/tce/packages/gcc/gcc-12.1.1/", + {"c": "gcc", "cxx": "g++", "fortran": "gfortran"}, + ) + ], + ) + oneapi_cfg = compiler_section_for( + "intel-oneapi-compilers", + [ + compiler_def( + "intel-oneapi-compilers@2023.2.1~envmods", + "/usr/tce/packages/intel/intel-2023.2.1/compiler/2023.2.1/linux/", + {"c": "icx", "cxx": "icpx", "fortran": "ifx"}, + ) + ], + ) + prefs = {"one_of": ["%oneapi", "%gcc"], "when": "%c"} + weighting_cfg = {"packages": {"all": {"require": [prefs]}}} + cfg = merge_dicts(gcc_cfg, oneapi_cfg, weighting_cfg) - return selections + return cfg def compute_software_section(self): + default_compiler = "gcc" + if self.spec.satisfies("compiler=intel"): + default_compiler = "intel-oneapi-compilers-classic" + elif self.spec.satisfies("compiler=oneapi"): + default_compiler = "intel-oneapi-compilers" + return { "software": { "packages": { - "default-compiler": {"pkg_spec": self.spec.variants["compiler"][0]}, + "default-compiler": {"pkg_spec": default_compiler}, "default-mpi": {"pkg_spec": "mvapich2"}, "compiler-gcc": {"pkg_spec": "gcc"}, "compiler-intel": {"pkg_spec": "intel"}, diff --git a/systems/llnl-elcapitan/system.py b/systems/llnl-elcapitan/system.py index 4939578ec..730fa6a95 100644 --- a/systems/llnl-elcapitan/system.py +++ b/systems/llnl-elcapitan/system.py @@ -7,7 +7,13 @@ from benchpark.directives import variant, maintainers from benchpark.paths import hardware_descriptions from benchpark.rocmsystem import ROCmSystem -from benchpark.system import System, JobQueue +from benchpark.system import ( + System, + JobQueue, + compiler_def, + compiler_section_for, + merge_dicts, +) from benchpark.openmpsystem import OpenMPCPUOnlySystem from packaging.version import Version @@ -181,7 +187,7 @@ def __init__(self, spec): def compute_packages_section(self): selections = { "packages": { - "all": {"require": "target=x86_64:"}, + "all": {"require": [{"spec": "target=x86_64:"}]}, "tar": {"externals": [{"spec": "tar@1.30", "prefix": "/usr"}]}, "coreutils": { "externals": [{"spec": "coreutils@8.30", "prefix": "/usr"}] @@ -324,53 +330,40 @@ def compute_packages_section(self): } } - selections["packages"] |= self.compiler_weighting_cfg()["packages"] - return selections def compiler_weighting_cfg(self): compiler = self.spec.variants["compiler"][0] if compiler == "cce": - return {"packages": {"all": {"require": [{"one_of": ["%cce", "%gcc"]}]}}} + prefs = {"one_of": ["%cce", "%gcc"], "when": "%c"} + return {"packages": {"all": {"require": [prefs]}}} elif compiler == "gcc": return {"packages": {}} elif compiler == "rocmcc": - return {"packages": {"all": {"require": [{"one_of": ["%rocmcc", "%gcc"]}]}}} + prefs = {"one_of": ["%rocmcc", "%gcc"], "when": "%c"} + return {"packages": {"all": {"require": [prefs]}}} else: raise ValueError(f"Unexpected value for compiler: {compiler}") def compute_compilers_section(self): - selections = { - "compilers": [ - { - "compiler": { - "spec": "gcc@12.2.0", - "paths": { - "cc": "/opt/cray/pe/gcc/12.2.0/bin/gcc", - "cxx": "/opt/cray/pe/gcc/12.2.0/bin/g++", - "f77": "/opt/cray/pe/gcc/12.2.0/bin/gfortran", - "fc": "/opt/cray/pe/gcc/12.2.0/bin/gfortran", - }, - "flags": {}, - "operating_system": "rhel8", - "target": "x86_64", - "modules": [], - "environment": {}, - "extra_rpaths": [], - } - } - ] - } + cfg = compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@12.2.0 languages=c,c++,fortran", + "/opt/cray/pe/gcc/12.2.0/", + {"c": "gcc", "cxx": "g++", "fortran": "gfortran"}, + ) + ], + ) + if self.spec.satisfies("compiler=cce") or self.spec.satisfies( "compiler=rocmcc" ): - selections["compilers"] += self.rocm_cce_compiler_cfg()["compilers"] - - # Note: this is always included for some low-level dependencies - # that shouldn't build with %cce + cfg = merge_dicts(cfg, self.rocm_cce_compiler_cfg()) - return selections + return merge_dicts(cfg, self.compiler_weighting_cfg()) def mpi_config(self): gtl = self.spec.variants["gtl"][0] @@ -625,15 +618,6 @@ def rocm_config(self): ], "buildable": False, }, - "llvm-amdgpu": { - "externals": [ - { - "spec": f"llvm-amdgpu@{self.rocm_version}", - "prefix": f"/opt/rocm-{self.rocm_version}/llvm", - } - ], - "buildable": False, - }, "rocblas": { "externals": [ { @@ -662,71 +646,50 @@ def rocm_cce_compiler_cfg(self): f"/opt/cray/pe/cce/{self.cce_version}/cce/x86_64/lib", ] # Avoid libunwind.so.1 error on tioga - if self.spec.variants["cluster"][0] == "tioga": + if self.spec.variants["cluster"][0] in ["tioga", "tuolumne"]: rpaths.append(f"/opt/cray/pe/cce/{self.cce_version}/cce-clang/x86_64/lib/") - if self.spec.satisfies("compiler=rocmcc"): - return { - "compilers": [ - { - "compiler": { - "spec": f"rocmcc@{self.rocm_version}", - "paths": { - "cc": f"/opt/rocm-{self.rocm_version}/bin/amdclang", - "cxx": f"/opt/rocm-{self.rocm_version}/bin/amdclang++", - "f77": f"/opt/rocm-{self.rocm_version}/bin/amdflang", - "fc": f"/opt/rocm-{self.rocm_version}/bin/amdflang", - }, - "flags": {"cflags": "-g -O2", "cxxflags": "-g -O2"}, - "operating_system": "rhel8", - "target": "x86_64", - "modules": [f"cce/{self.cce_version}"], - "environment": { - "set": {"RFE_811452_DISABLE": "1"}, - "append_path": { - "LD_LIBRARY_PATH": "/opt/cray/pe/gcc-libs" - }, - "prepend_path": { - "LD_LIBRARY_PATH": f"/opt/cray/pe/cce/{self.cce_version}/cce/x86_64/lib:/opt/cray/pe/pmi/{self.pmi_version}/lib:/opt/cray/pe/pals/{self.pals_version}/lib", - "LIBRARY_PATH": f"/opt/rocm-{self.rocm_version}/lib", - }, - }, - "extra_rpaths": rpaths, - } - } - ] - } - else: - return { - "compilers": [ - { - "compiler": { - "spec": f"cce@{self.cce_version}-rocm{self.rocm_version}", - "paths": { - "cc": f"/opt/cray/pe/cce/{self.cce_version}/bin/craycc", - "cxx": f"/opt/cray/pe/cce/{self.cce_version}/bin/crayCC", - "f77": f"/opt/cray/pe/cce/{self.cce_version}/bin/crayftn", - "fc": f"/opt/cray/pe/cce/{self.cce_version}/bin/crayftn", - }, - "flags": { - "cflags": "-g -O2", - "cxxflags": "-g -O2 -std=c++14", - "fflags": "-g -O2 -hnopattern", - "ldflags": "-ldl", - }, - "operating_system": "rhel8", - "target": "x86_64", - "modules": [f"cce/{self.cce_version}"], - "environment": { - "prepend_path": { - "LD_LIBRARY_PATH": f"/opt/cray/pe/cce/{self.cce_version}/cce/x86_64/lib:/opt/rocm-{self.rocm_version}/lib:/opt/cray/pe/pmi/{self.pmi_version}/lib:/opt/cray/pe/pals/{self.pals_version}/lib" - } - }, - "extra_rpaths": rpaths, - } + cfgs = [] + # Always need an instance of llvm-gpu as an external. Sometimes as a compiler + # and sometimes just for ROCm support + rocmcc_entry = compiler_def( + f"llvm-amdgpu@{self.rocm_version}", + f"/opt/rocm-{self.rocm_version}/", + {"c": "amdclang", "cxx": "amdclang++", "fortran": "amdflang"}, + modules=[f"cce/{self.cce_version}"], + flags={"cflags": "-g -O2", "cxxflags": "-g -O2"}, + extra_rpaths=list(rpaths), + env={ + "set": {"RFE_811452_DISABLE": "1"}, + "append_path": {"LD_LIBRARY_PATH": "/opt/cray/pe/gcc-libs"}, + "prepend_path": { + "LD_LIBRARY_PATH": f"/opt/cray/pe/cce/{self.cce_version}/cce/x86_64/lib:/opt/cray/pe/pmi/{self.pmi_version}/lib:/opt/cray/pe/pals/{self.pals_version}/lib", + "LIBRARY_PATH": f"/opt/rocm-{self.rocm_version}/lib", + }, + }, + ) + cfgs.append(compiler_section_for("llvm-amdgpu", [rocmcc_entry])) + if self.spec.satisfies("compiler=cce"): + cce_entry = compiler_def( + f"cce@{self.cce_version}-rocm{self.rocm_version}", + f"/opt/cray/pe/cce/{self.cce_version}/", + {"c": "craycc", "cxx": "crayCC", "fortran": "crayftn"}, + modules=[f"cce/{self.cce_version}"], + extra_rpaths=list(rpaths), + env={ + "prepend_path": { + "LD_LIBRARY_PATH": f"/opt/cray/pe/cce/{self.cce_version}/cce/x86_64/lib:/opt/rocm-{self.rocm_version}/lib:/opt/cray/pe/pmi/{self.pmi_version}/lib:/opt/cray/pe/pals/{self.pals_version}/lib" } - ] - } + }, + flags={ + "cflags": "-g -O2", + "cxxflags": "-g -O2 -std=c++14", + "fflags": "-g -O2 -hnopattern", + "ldflags": "-ldl", + }, + ) + cfgs.append(compiler_section_for("cce", [cce_entry])) + return merge_dicts(*cfgs) def system_specific_variables(self): opts = super().system_specific_variables() @@ -759,9 +722,7 @@ def compute_software_section(self): return { "software": { "packages": { - "default-compiler": { - "pkg_spec": f"{self.spec.variants['compiler'][0]}" - }, + "default-compiler": {"pkg_spec": "gcc"}, "default-mpi": {"pkg_spec": "cray-mpich"}, "compiler-rocm": {"pkg_spec": "cce"}, "compiler-amdclang": {"pkg_spec": "clang"}, diff --git a/systems/llnl-matrix/system.py b/systems/llnl-matrix/system.py index 49daed939..3f91dd4fa 100644 --- a/systems/llnl-matrix/system.py +++ b/systems/llnl-matrix/system.py @@ -7,7 +7,13 @@ from benchpark.directives import variant, maintainers from benchpark.cudasystem import CudaSystem from benchpark.paths import hardware_descriptions -from benchpark.system import System, JobQueue +from benchpark.system import ( + System, + JobQueue, + compiler_def, + compiler_section_for, + merge_dicts, +) from benchpark.openmpsystem import OpenMPCPUOnlySystem from packaging.version import Version @@ -215,111 +221,55 @@ def compute_packages_section(self): } } - selections["packages"] |= self.compiler_weighting_cfg()["packages"] - selections["packages"] |= self.cuda_config(self.spec.variants["cuda"][0])[ "packages" ] return selections - def compiler_weighting_cfg(self): - compiler = self.spec.variants["compiler"][0] - - if compiler == "oneapi": - return {"packages": {"all": {"require": [{"one_of": ["%oneapi", "%gcc"]}]}}} - else: - return {"packages": {}} - def compute_compilers_section(self): - selections = {} + gcc_cfg = compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@12.1.1 languages:=c,c++,fortran", + "/usr/tce/packages/gcc/gcc-12.1.1/", + {"c": "gcc", "cxx": "g++", "fortran": "gfortran"}, + ) + ], + ) if self.spec.satisfies("compiler=gcc"): - selections = { - "compilers": [ - { - "compiler": { - "spec": "gcc@12.1.1", - "paths": { - "cc": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gcc", - "cxx": "/usr/tce/packages/gcc/gcc-12.1.1/bin/g++", - "f77": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gfortran", - "fc": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gfortran", - }, - "flags": {}, - "operating_system": "rhel8", - "target": "x86_64", - "modules": [], - "environment": {}, - "extra_rpaths": [], - } - } - ] - } + cfg = gcc_cfg elif self.spec.satisfies("compiler=intel"): - selections = { - "compilers": [ - { - "compiler": { - "spec": "intel@2021.6.0-classic", - "paths": { - "cc": "/usr/tce/packages/intel-classic/intel-classic-2021.6.0/bin/icc", - "cxx": "/usr/tce/packages/intel-classic/intel-classic-2021.6.0/bin/icpc", - "f77": "/usr/tce/packages/intel-classic/intel-classic-2021.6.0/bin/ifort", - "fc": "/usr/tce/packages/intel-classic/intel-classic-2021.6.0/bin/ifort", - }, - "flags": {}, - "operating_system": "rhel8", - "target": "x86_64", - "modules": [], - "environment": {}, - "extra_rpaths": [], - } - } - ] - } + cfg = compiler_section_for( + "intel-oneapi-compilers-classic", + [ + compiler_def( + "intel-oneapi-compilers-classic@2021.6.0 ~envmods", + "/usr/tce/packages/intel-classic/intel-classic-2021.6.0/", + {"c": "icc", "cxx": "icpc", "fortran": "ifort"}, + ) + ], + ) elif self.spec.satisfies("compiler=oneapi"): - selections = { - "compilers": [ - { - "compiler": { - "spec": "gcc@12.1.1", - "paths": { - "cc": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gcc", - "cxx": "/usr/tce/packages/gcc/gcc-12.1.1/bin/g++", - "f77": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gfortran", - "fc": "/usr/tce/packages/gcc/gcc-12.1.1/bin/gfortran", - }, - "flags": {}, - "operating_system": "rhel8", - "target": "x86_64", - "modules": [], - "environment": {}, - "extra_rpaths": [], - } - }, - { - "compiler": { - "spec": "oneapi@2023.2.1", - "paths": { - "cc": "/usr/tce/packages/intel/intel-2023.2.1/compiler/2023.2.1/linux/bin/icx", - "cxx": "/usr/tce/packages/intel/intel-2023.2.1/compiler/2023.2.1/linux/bin/icpx", - "f77": "/usr/tce/packages/intel/intel-2023.2.1/compiler/2023.2.1/linux/bin/ifx", - "fc": "/usr/tce/packages/intel/intel-2023.2.1/compiler/2023.2.1/linux/bin/ifx", - }, - "flags": {}, - "operating_system": "rhel8", - "target": "x86_64", - "modules": [ - f"cuda/{self.cuda_version}", - ], - "environment": {}, - "extra_rpaths": [], - } - }, - ] - } + oneapi_cfg = compiler_section_for( + "intel-oneapi-compilers", + [ + compiler_def( + "intel-oneapi-compilers@2023.2.1 ~envmods", + "/usr/tce/packages/intel/intel-2023.2.1/compiler/2023.2.1/linux/", + {"c": "icx", "cxx": "icpx", "fortran": "ifx"}, + modules=[ + f"cuda/{self.cuda_version}", + ], + ) + ], + ) + prefs = {"one_of": ["%oneapi", "%gcc"], "when": "%c"} + weighting_cfg = {"packages": {"all": {"require": [prefs]}}} + cfg = merge_dicts(gcc_cfg, oneapi_cfg, weighting_cfg) - return selections + return cfg def cuda_config(self, cuda_version): return { @@ -393,10 +343,16 @@ def cuda_config(self, cuda_version): } def compute_software_section(self): + default_compiler = "gcc" + if self.spec.satisfies("compiler=intel"): + default_compiler = "intel-oneapi-compilers-classic" + elif self.spec.satisfies("compiler=oneapi"): + default_compiler = "intel-oneapi-compilers" + return { "software": { "packages": { - "default-compiler": {"pkg_spec": self.spec.variants["compiler"][0]}, + "default-compiler": {"pkg_spec": default_compiler}, "default-mpi": {"pkg_spec": "mvapich2"}, "compiler-gcc": {"pkg_spec": "gcc"}, "compiler-intel": {"pkg_spec": "intel"}, diff --git a/systems/llnl-sierra/system.py b/systems/llnl-sierra/system.py index 7fee36140..9f44acf10 100644 --- a/systems/llnl-sierra/system.py +++ b/systems/llnl-sierra/system.py @@ -6,7 +6,14 @@ from benchpark.directives import variant, maintainers from benchpark.cudasystem import CudaSystem from benchpark.paths import hardware_descriptions -from benchpark.system import System, JobQueue +from benchpark.system import ( + System, + JobQueue, + compiler_def, + compiler_section_for, + merge_dicts, + hybrid_compiler_requirements, +) from benchpark.openmpsystem import OpenMPCPUOnlySystem from packaging.version import Version @@ -427,150 +434,117 @@ def compute_packages_section(self): def compute_compilers_section(self): # values=("clang-ibm", "xl", "xl-gcc", "clang"), + compiler = self.spec.variants["compiler"][0] # values=("11-8-0", "10-1-243"), - compiler_cfgs = { - ( - "clang-ibm", - "11-8-0", - ): [ - { - "compiler": { - "spec": "clang@16.0.6-ibm-cuda-11.8.0-gcc-11.2.1", - "paths": { - "cc": "/usr/tce/packages/clang/clang-ibm-16.0.6-cuda-11.8.0-gcc-11.2.1/bin/clang", - "cxx": "/usr/tce/packages/clang/clang-ibm-16.0.6-cuda-11.8.0-gcc-11.2.1/bin/clang++", - "f77": "/usr/tce/packages/xl/xl-2023.06.28-cuda-11.8.0-gcc-11.2.1/bin/xlf_r", - "fc": "/usr/tce/packages/xl/xl-2023.06.28-cuda-11.8.0-gcc-11.2.1/bin/xlf_r", - }, - "flags": { - "cflags": "-g -O2", - "cxxflags": "-g -O2", - "fflags": "-g -O2", - }, - "operating_system": "rhel7", - "target": "ppc64le", - "modules": [ - "cuda/11.8.0", - "clang/ibm-16.0.6-cuda-11.8.0-gcc-11.2.1", - ], - "environment": {}, - "extra_rpaths": [], - } - } - ], - ( - "xl-gcc", - "11-8-0", - ): [ - { - "compiler": { - "spec": "xl@16.1.1-2023.06.28-cuda-11.8.0-gcc-11.2.1", - "paths": { - "cc": "/usr/tce/packages/xl/xl-2023.06.28-cuda-11.8.0-gcc-11.2.1/bin/xlc", - "cxx": "/usr/tce/packages/xl/xl-2023.06.28-cuda-11.8.0-gcc-11.2.1/bin/xlC", - "f77": "/usr/tce/packages/xl/xl-2023.06.28-cuda-11.8.0-gcc-11.2.1/bin/xlf", - "fc": "/usr/tce/packages/xl/xl-2023.06.28-cuda-11.8.0-gcc-11.2.1/bin/xlf", - }, - "flags": { - "cflags": "-g -O2", - "cxxflags": "-g -O2", - "fflags": "-g -O2", - }, - "operating_system": "rhel7", - "target": "ppc64le", - "modules": [ - "cuda/11.8.0", - "xl/2023.06.28-cuda-11.8.0-gcc-11.2.1", - ], - "environment": {}, - "extra_rpaths": [], - } - } - ], - ( + cuda_ver = self.spec.variants["cuda"][0].replace(".", "-") + + cuda_module_map = { + "11-8-0": ["cuda/11.8.0"], + "10-1-243": ["cuda/10.1.243"], + } + cuda_modules = cuda_module_map[cuda_ver] + + flags = { + "cflags": "-g -O2", + "cxxflags": "-g -O2", + "fflags": "-g -O2", + } + + if (compiler, cuda_ver) == ("clang-ibm", "11-8-0"): + cfg1 = compiler_section_for( + "llvm", + [ + compiler_def( + "llvm@16.0.6", + "/usr/tce/packages/clang/clang-ibm-16.0.6-cuda-11.8.0-gcc-11.2.1/", + {"c": "clang", "cxx": "clang++"}, + flags=flags, + modules=cuda_modules + + ["clang/ibm-16.0.6-cuda-11.8.0-gcc-11.2.1"], + ) + ], + ) + cfg2 = compiler_section_for( "xl", - "10-1-243", - ): [ - { - "compiler": { - "spec": "xl@16.1.1-2022.08.19-cuda10.1.243", - "paths": { - "cc": "/usr/tce/packages/xl/xl-2022.08.19/bin/xlc", - "cxx": "/usr/tce/packages/xl/xl-2022.08.19/bin/xlC", - "f77": "/usr/tce/packages/xl/xl-2022.08.19/bin/xlf", - "fc": "/usr/tce/packages/xl/xl-2022.08.19/bin/xlf", - }, - "flags": { - "cflags": "-g -O2", - "cxxflags": "-g -O2", - "fflags": "-g -O2", - }, - "operating_system": "rhel7", - "target": "ppc64le", - "modules": ["cuda/10.1.243", "xl/2022.08.19"], - "environment": {}, - "extra_rpaths": [], - } - } - ], - ( + [ + compiler_def( + "xl@2023.06.28", + "/usr/tce/packages/xl/xl-2023.06.28-cuda-11.8.0-gcc-11.2.1/", + {"c": "xlc", "cxx": "xlC", "fortran": "xlf"}, + flags=flags, + ) + ], + ) + cfg = merge_dicts(cfg1, cfg2, hybrid_compiler_requirements("llvm", "xl")) + elif (compiler, cuda_ver) == ("xl-gcc", "11-8-0"): + cfg = compiler_section_for( "xl", - "11-8-0", - ): [ - { - "compiler": { - "spec": "xl@16.1.1-2022.08.19-cuda11.8.0", - "paths": { - "cc": "/usr/tce/packages/xl/xl-2022.08.19-cuda-11.8.0/bin/xlc", - "cxx": "/usr/tce/packages/xl/xl-2022.08.19-cuda-11.8.0/bin/xlC", - "f77": "/usr/tce/packages/xl/xl-2022.08.19-cuda-11.8.0/bin/xlf", - "fc": "/usr/tce/packages/xl/xl-2022.08.19-cuda-11.8.0/bin/xlf", - }, - "flags": { - "cflags": "-g -O2", - "cxxflags": "-g -O2", - "fflags": "-g -O2", - }, - "operating_system": "rhel7", - "target": "ppc64le", - "modules": ["cuda/11.8.0", "xl/2022.08.19-cuda-11.8.0"], - "environment": {}, - "extra_rpaths": [], - } - } - ], - ( - "clang", - "11-8-0", - ): [ - { - "compiler": { - "spec": "clang@16.0.6-cuda11.8.0", - "paths": { - "cc": "/usr/tce/packages/clang/clang-16.0.6-cuda-11.8.0-gcc-11.2.1/bin/clang", - "cxx": "/usr/tce/packages/clang/clang-16.0.6-cuda-11.8.0-gcc-11.2.1/bin/clang++", - "f77": "/usr/tce/packages/gcc/gcc-11.2.1/bin/gfortran", - "fc": "/usr/tce/packages/gcc/gcc-11.2.1/bin/gfortran", - }, - "flags": { - "cflags": "-g -O2", - "cxxflags": "-g -O2", - "fflags": "", - }, - "operating_system": "rhel7", - "target": "ppc64le", - "modules": [], - "environment": {}, - "extra_rpaths": [], - } - } - ], - } + [ + compiler_def( + "xl@2023.06.28", + "/usr/tce/packages/xl/xl-2023.06.28-cuda-11.8.0-gcc-11.2.1/", + {"c": "xlc", "cxx": "xlC", "fortran": "xlf"}, + flags=flags, + modules=cuda_modules + ["xl/2023.06.28-cuda-11.8.0-gcc-11.2.1"], + ) + ], + ) + elif (compiler, cuda_ver) == ("xl", "10-1-243"): + cfg = compiler_section_for( + "xl", + [ + compiler_def( + "xl@16.1.1-2022.08.19-cuda10.1.243", + "/usr/tce/packages/xl/xl-2022.08.19/", + {"c": "xlc", "cxx": "xlC", "fortran": "xlf"}, + flags=flags, + modules=cuda_modules + ["xl/2022.08.19"], + ) + ], + ) + elif (compiler, cuda_ver) == ("xl", "11-8-0"): + cfg = compiler_section_for( + "xl", + [ + compiler_def( + "xl@16.1.1-2022.08.19-cuda11.8.0", + "/usr/tce/packages/xl/xl-2022.08.19-cuda-11.8.0/", + {"c": "xlc", "cxx": "xlC", "fortran": "xlf"}, + flags=flags, + modules=cuda_modules + ["xl/2022.08.19-cuda-11.8.0"], + ) + ], + ) + elif (compiler, cuda_ver) == ("clang", "11-8-0"): + custom_flags = { + "cflags": "-g -O2", + "cxxflags": "-g -O2", + } + cfg1 = compiler_section_for( + "llvm", + [ + compiler_def( + "llvm@16.0.6", + "/usr/tce/packages/clang/clang-ibm-16.0.6-cuda-11.8.0-gcc-11.2.1/", + {"c": "clang", "cxx": "clang++"}, + flags=custom_flags, + ) + ], + ) + cfg2 = compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@11.2.1 languages:=c,c++,fortran", + "/usr/tce/packages/gcc/gcc-11.2.1/", + {"c": "gcc", "cxx": "g++", "fortran": "gfortran"}, + flags=custom_flags, + ) + ], + ) + cfg = merge_dicts(cfg1, cfg2, hybrid_compiler_requirements("llvm", "gcc")) - compiler = self.spec.variants["compiler"][0] - cuda_ver = self.spec.variants["cuda"][0].replace(".", "-") - cfg = compiler_cfgs[(compiler, cuda_ver)] - return {"compilers": cfg} + return cfg def compute_software_section(self): """This is somewhat vestigial: for the Tioga config that is committed diff --git a/systems/riken-fugaku/system.py b/systems/riken-fugaku/system.py index 2dfb394b3..89eab52ec 100644 --- a/systems/riken-fugaku/system.py +++ b/systems/riken-fugaku/system.py @@ -5,7 +5,7 @@ from benchpark.directives import variant, maintainers -from benchpark.system import System +from benchpark.system import System, compiler_def, compiler_section_for from benchpark.openmpsystem import OpenMPCPUOnlySystem from benchpark.paths import hardware_descriptions @@ -552,54 +552,40 @@ def compute_packages_section(self): return selections def compute_compilers_section(self): - compiler = self.spec.variants["compiler"][0] - selections = {"compilers": []} - if compiler == "clang": - selections["compilers"] += [ - { - "compiler": { - "spec": "clang@17.0.2", - "paths": { - "cc": "/vol0004/apps/oss/llvm-v17.0.2/compute_node/bin/clang", - "cxx": "/vol0004/apps/oss/llvm-v17.0.2/compute_node/bin/clang++", - "f77": "/vol0004/apps/oss/llvm-v17.0.2/compute_node/bin/flang", - "fc": "/vol0004/apps/oss/llvm-v17.0.2/compute_node/bin/flang", - }, - # Uncomment and populate these if needed - # "flags": { - # "cflags": {"-msve-vector-bits=scalable"}, - # "cxxflags": {"-msve-vector-bits=scalable"}, - # "fflags": {"-msve-vector-bits=scalable"}, - # "ldflags": {"-fuse-ld=lld"}, - # }, - "environment": { + # maybe_flags = { + # "cflags": {"-msve-vector-bits=scalable"}, + # "cxxflags": {"-msve-vector-bits=scalable"}, + # "fflags": {"-msve-vector-bits=scalable"}, + # "ldflags": {"-fuse-ld=lld"}, + # } + cfg = compiler_section_for( + "llvm", + [ + compiler_def( + "llvm@17.0.2", + "/vol0004/apps/oss/llvm-v17.0.2/compute_node/", + {"c": "clang", "cxx": "clang++", "fortran": "flang"}, + env={ "append_path": { "LD_LIBRARY_PATH": "/opt/FJSVxtclanga/tcsds-1.2.38/lib64" } }, - "operating_system": "rhel8", - "target": "aarch64", - "modules": [], - "extra_rpaths": [], - } - } - ] + # flags = maybe_flags + ) + ], + ) elif compiler == "gcc": - selections["compilers"] += [ - { - "compiler": { - "spec": "gcc@13.2.0", - "paths": { - "cc": "/vol0004/apps/oss/spack-v0.21/opt/spack/linux-rhel8-a64fx/gcc-8.5.0/gcc-13.2.0-abihbe7ykvpedq54j6blfvfppy7ojbmd/bin/gcc", - "cxx": "/vol0004/apps/oss/spack-v0.21/opt/spack/linux-rhel8-a64fx/gcc-8.5.0/gcc-13.2.0-abihbe7ykvpedq54j6blfvfppy7ojbmd/bin/g++", - "f77": "/vol0004/apps/oss/spack-v0.21/opt/spack/linux-rhel8-a64fx/gcc-8.5.0/gcc-13.2.0-abihbe7ykvpedq54j6blfvfppy7ojbmd/bin/gfortran", - "fc": "/vol0004/apps/oss/spack-v0.21/opt/spack/linux-rhel8-a64fx/gcc-8.5.0/gcc-13.2.0-abihbe7ykvpedq54j6blfvfppy7ojbmd/bin/gfortran", - }, - "flags": {"ldflags": {"-lelf -ldl"}}, - "environment": { + cfg = compiler_section_for( + "gcc", + [ + compiler_def( + "gcc@13.2.0 languages:=c,c++,fortran", + "/vol0004/apps/oss/spack-v0.21/opt/spack/linux-rhel8-a64fx/gcc-8.5.0/gcc-13.2.0-abihbe7ykvpedq54j6blfvfppy7ojbmd/", + {"c": "gcc", "cxx": "g++", "fortran": "gfortran"}, + env={ "set": { "OPAL_PREFIX": "/vol0004/apps/oss/mpigcc/fjmpi-gcc12" }, @@ -607,29 +593,19 @@ def compute_compilers_section(self): "LD_LIBRARY_PATH": "/opt/FJSVxtclanga/tcsds-1.2.38/lib64" }, }, - "operating_system": "rhel8", - "target": "aarch64", - "modules": [], - "extra_rpaths": [], - } - } - ] + flags={"ldflags": {"-lelf -ldl"}}, + ) + ], + ) elif compiler == "fj": - selections["compilers"] += [ - { - "compiler": { - "spec": "fj@4.10.0", - "modules": [], - "paths": { - "cc": "/opt/FJSVxtclanga/tcsds-1.2.38/bin/fcc", - "cxx": "/opt/FJSVxtclanga/tcsds-1.2.38/bin/FCC", - "f77": "/opt/FJSVxtclanga/tcsds-1.2.38/bin/frt", - "fc": "/opt/FJSVxtclanga/tcsds-1.2.38/bin/frt", - }, - "flags": {}, - "operating_system": "rhel8", - "target": "aarch64", - "environment": { + cfg = compiler_section_for( + "fj", + [ + compiler_def( + "fj@4.10.0", + "/opt/FJSVxtclanga/tcsds-1.2.38/", + {"c": "fcc", "cxx": "FCC", "fortran": "frt"}, + env={ "set": { "fcc_ENV": "-Nclang", "FCC_ENV": "-Nclang", @@ -639,12 +615,11 @@ def compute_compilers_section(self): "LD_LIBRARY_PATH": "/opt/FJSVxtclanga/tcsds-1.2.38/lib64", }, }, - "extra_rpaths": [], - } - } - ] + ) + ], + ) - return selections + return cfg def system_specific_variables(self): return {