Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion lib/benchpark/cmd/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ 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):
Expand Down Expand Up @@ -207,7 +210,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
"""
Comment on lines +224 to +228

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit. The other branch of this if statement basically does the same logic, can we refactor these lines to be after the if-elif?

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()
Expand Down
6 changes: 5 additions & 1 deletion lib/benchpark/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading