From b3a4afb4acea00b03a38f025bd975f8e88d2c0b5 Mon Sep 17 00:00:00 2001 From: Peter Scheibel Date: Fri, 24 Apr 2026 15:40:20 -0700 Subject: [PATCH 1/4] add --spack option to benchpark setup --- lib/benchpark/cmd/setup.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/benchpark/cmd/setup.py b/lib/benchpark/cmd/setup.py index 403d58bda..37c20ea72 100644 --- a/lib/benchpark/cmd/setup.py +++ b/lib/benchpark/cmd/setup.py @@ -54,6 +54,11 @@ def setup_parser(root_parser): type=str, help="Where to install packages and store results for the experiments. Benchpark expects to manage this directory, and it should be empty/nonexistent the first time you run benchpark setup experiments.", ) + root_parser.add_argument( + "--spack", + type=str, + help="Use the designated, pre-existing Spack instance" + ) def determine_experiment_id(exp_src_dir): @@ -207,7 +212,23 @@ def include_fn(fname): repos_cfg = benchpark.config.configuration().repos pkg_str = "" - if "spack" in pkg_manager: + if "spack" in pkg_manager and args.spack: + # Things that are not applied: + # - the benchpark package repository + # - or any of the repositories configured + # - does not set a build stage + # basically these things are all configuration details of spack, and + # if the user says "use my specific spack instance" then I want to + # minimize changes to it. Note that Ramble may perform config commands + spack_user_cache_path = experiments_root / "spack-cache" + spack_location = str(experiments_root / spack) + os.symlink(args.spack, spack_location) + pkg_str = f"""\ +export SPACK_USER_CACHE_PATH={spack_user_cache_path} +export SPACK_DISABLE_LOCAL_CONFIG=1 +. {spack_location}/share/spack/setup-env.sh +""" + elif "spack" in pkg_manager and not args.spack: spack_build_stage = experiments_root / "builds" spack_user_cache_path = experiments_root / "spack-cache" spack, first_time_spack = per_workspace_setup.spack_first_time_setup() From 4ca0a81ea775fc48cb1e78e67a9cd78d2c9a4a7e Mon Sep 17 00:00:00 2001 From: Peter Josef Scheibel Date: Fri, 24 Apr 2026 16:35:35 -0700 Subject: [PATCH 2/4] reference error (should be static string) --- lib/benchpark/cmd/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/benchpark/cmd/setup.py b/lib/benchpark/cmd/setup.py index 37c20ea72..b12a68ee2 100644 --- a/lib/benchpark/cmd/setup.py +++ b/lib/benchpark/cmd/setup.py @@ -221,7 +221,7 @@ def include_fn(fname): # if the user says "use my specific spack instance" then I want to # minimize changes to it. Note that Ramble may perform config commands spack_user_cache_path = experiments_root / "spack-cache" - spack_location = str(experiments_root / spack) + spack_location = str(experiments_root / "spack") os.symlink(args.spack, spack_location) pkg_str = f"""\ export SPACK_USER_CACHE_PATH={spack_user_cache_path} From 5c1c41934d630ae465e25464da45454c4c2cf71e Mon Sep 17 00:00:00 2001 From: pearce8 Date: Mon, 27 Apr 2026 15:06:26 -0500 Subject: [PATCH 3/4] lint --- lib/benchpark/cmd/setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/benchpark/cmd/setup.py b/lib/benchpark/cmd/setup.py index b12a68ee2..439e9756e 100644 --- a/lib/benchpark/cmd/setup.py +++ b/lib/benchpark/cmd/setup.py @@ -55,9 +55,7 @@ def setup_parser(root_parser): help="Where to install packages and store results for the experiments. Benchpark expects to manage this directory, and it should be empty/nonexistent the first time you run benchpark setup experiments.", ) root_parser.add_argument( - "--spack", - type=str, - help="Use the designated, pre-existing Spack instance" + "--spack", type=str, help="Use the designated, pre-existing Spack instance" ) From 3c97bfa46e379635963d99a47fee44a3b1ea3788 Mon Sep 17 00:00:00 2001 From: Peter Josef Scheibel Date: Mon, 18 May 2026 18:47:12 -0700 Subject: [PATCH 4/4] don't clone spack-packages if spack is a link --- lib/benchpark/runtime.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/benchpark/runtime.py b/lib/benchpark/runtime.py index 69b47fe36..cfc778f64 100644 --- a/lib/benchpark/runtime.py +++ b/lib/benchpark/runtime.py @@ -180,7 +180,11 @@ def _ramble(self): def _spack(self): if not self.pkgs_location.exists(): - self._install_packages() + if self.spack_location.exists() and self.spack_location.is_symlink(): + # Don't create a spack-packages repo if custom spack is in use + pass + else: + self._install_packages() env = {"SPACK_DISABLE_LOCAL_CONFIG": "1"} spack = Command(self.spack_location / "bin" / "spack", env)