Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3921329
Clone from local bootstrap
michaelmckinsey1 May 22, 2025
ceac409
Merge branch 'develop' into clone-local
michaelmckinsey1 May 22, 2025
e7cfa26
Merge branch 'develop' into clone-local
michaelmckinsey1 May 27, 2025
d91bb31
Merge branch 'develop' into clone-local
michaelmckinsey1 May 28, 2025
abf18f6
Enable upstream runtimeresources
michaelmckinsey1 May 28, 2025
553cf9e
Refactor bootstrap logic for readability. Refactor urls to follow ver…
michaelmckinsey1 May 28, 2025
542a27b
improve comment
michaelmckinsey1 May 28, 2025
1506cc5
fix lint
michaelmckinsey1 May 28, 2025
68e6935
lint
michaelmckinsey1 May 28, 2025
ca2ad43
Merge branch 'develop' into clone-local
michaelmckinsey1 May 28, 2025
1e41466
Make check more readable
michaelmckinsey1 May 28, 2025
cb3ffb0
Merge branch 'develop' into clone-local
michaelmckinsey1 May 30, 2025
507c5d6
Merge branch 'develop' into clone-local
michaelmckinsey1 Jun 2, 2025
f33da4f
Upstream ramble_url/spack_url logic for clarity
michaelmckinsey1 Jun 10, 2025
2b571d0
Merge remote-tracking branch 'origin/develop' into clone-local
michaelmckinsey1 Jun 10, 2025
6ce8582
Update comment
michaelmckinsey1 Jun 10, 2025
1983c04
Refactor
michaelmckinsey1 Jun 10, 2025
1696a0a
Fix bug
michaelmckinsey1 Jun 10, 2025
679a1a8
Undo bootstrap call in init
michaelmckinsey1 Jun 10, 2025
269bba0
bootstrap in main.py and remove unused imports
michaelmckinsey1 Jun 10, 2025
575f54f
Test refactor for help and version commands without bootstrap
michaelmckinsey1 Jun 10, 2025
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
6 changes: 0 additions & 6 deletions lib/benchpark/cmd/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@
import re
import sys

import benchpark.paths
import benchpark.repo

from benchpark.runtime import RuntimeResources

bootstrapper = RuntimeResources(benchpark.paths.benchpark_home) # noqa
bootstrapper.bootstrap() # noqa

import ramble.config as cfg # noqa


Expand Down
21 changes: 3 additions & 18 deletions lib/benchpark/cmd/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import benchpark.paths
from benchpark.debug import debug_print
from benchpark.runtime import RuntimeResources
import benchpark.system


# Note: it would be nice to vendor spack.llnl.util.link_tree, but that
Expand All @@ -41,22 +40,6 @@ def symlink_tree(src, dst, include_fn=None):
os.symlink(src_file, dst_symlink)


def setup_parser(root_parser):
root_parser.add_argument(
"experiment",
type=str,
help="The experiment (benchmark/ProgrammingModel) to run",
)
root_parser.add_argument(
"system", type=str, help="The system on which to run the experiment"
)
root_parser.add_argument(
"experiments_root",
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.",
)


def command(args):
"""
experiments_root/
Expand Down Expand Up @@ -142,7 +125,9 @@ def include_fn(fname):
initializer_script = experiments_root / "setup.sh"
run_script = experiments_root / ".latest-experiment.sh"

per_workspace_setup = RuntimeResources(experiments_root)
per_workspace_setup = RuntimeResources(
experiments_root, upstream=RuntimeResources(benchpark.paths.benchpark_home)
)

# Parse experiment YAML for package_manager
def find(d, tag):
Expand Down
6 changes: 0 additions & 6 deletions lib/benchpark/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@
from benchpark.directives import ExperimentSystemBase
from benchpark.directives import variant
import benchpark.spec
import benchpark.paths
import benchpark.repo
import benchpark.runtime
import benchpark.variant

bootstrapper = benchpark.runtime.RuntimeResources(benchpark.paths.benchpark_home)
bootstrapper.bootstrap()

import ramble.language.language_base # noqa
import ramble.language.language_helpers # noqa

Expand Down
2 changes: 2 additions & 0 deletions lib/benchpark/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ def _source_location() -> pathlib.Path:
global_ramble_path = benchpark_home / "ramble"
global_spack_path = benchpark_home / "spack"
hardware_descriptions = benchpark_root / "systems" / "all_hardware_descriptions"
checkout_versions = benchpark_root / "checkout-versions.yaml"
remote_urls = benchpark_root / "remote-urls.yaml"
6 changes: 0 additions & 6 deletions lib/benchpark/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@
from enum import Enum

import benchpark.paths
import benchpark.runtime

# isort: off

bootstrapper = benchpark.runtime.RuntimeResources(
benchpark.paths.benchpark_home
) # noqa
bootstrapper.bootstrap() # noqa

import llnl.util.lang # noqa
import ramble.language.language_base # noqa
import ramble.repository # noqa
Expand Down
50 changes: 34 additions & 16 deletions lib/benchpark/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def run_command(command_str, env=None, stdout=None, stderr=None):
out, err = proc.communicate()
if proc.returncode != 0:
raise RuntimeError(
f"Failed command: {command_str}\nOutput: {stdout}\nError: {stderr}"
f"Failed command: {command_str}\nOutput: {out}\nError: {err}"
)

return (out, err)
Expand All @@ -64,22 +64,38 @@ def __call__(self, *args):


class RuntimeResources:
def __init__(self, dest):
self.root = benchpark.paths.benchpark_root
def __init__(self, dest, upstream=None):
self.dest = pathlib.Path(dest)
self.upstream = upstream

checkout_versions_location = self.root / "checkout-versions.yaml"
with open(checkout_versions_location, "r") as yaml_file:
data = yaml.safe_load(yaml_file)
self.ramble_commit = data["versions"]["ramble"]
self.spack_commit = data["versions"]["spack"]
self.ramble_location, self.spack_location = (
self.dest / "ramble",
self.dest / "spack",
)

# 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"]

# 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"]

self.ramble_location = self.dest / "ramble"
self.spack_location = self.dest / "spack"
# 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
else:
# Clone from local "upstream" repository
self.ramble_url, self.spack_url = (
self.upstream.ramble_location,
self.upstream.spack_location,
)

def update_old_bootstrap(self, desired_commit, location):
# Store first 7 of hash in checkout-versions.yaml
def _check_and_update_bootstrap(self, desired_commit, location):
with working_dir(location):
# length of hash is 7 in checkout-versions.yaml
current_commit = run_command("git rev-parse HEAD")[0].strip()[:7]
if current_commit != desired_commit:
run_command("git fetch --all")
Expand All @@ -92,7 +108,7 @@ def bootstrap(self):
if not self.ramble_location.exists():
self._install_ramble()
else:
self.update_old_bootstrap(self.ramble_commit, self.ramble_location)
self._check_and_update_bootstrap(self.ramble_commit, self.ramble_location)
ramble_lib_path = self.ramble_location / "lib" / "ramble"
externals = str(ramble_lib_path / "external")
if externals not in sys.path:
Expand All @@ -107,12 +123,12 @@ def bootstrap(self):
if not self.spack_location.exists():
self._install_spack()
else:
self.update_old_bootstrap(self.spack_commit, self.spack_location)
self._check_and_update_bootstrap(self.spack_commit, self.spack_location)

def _install_ramble(self):
print(f"Cloning Ramble to {self.ramble_location}")
git_clone_commit(
"https://github.com/GoogleCloudPlatform/ramble.git",
self.ramble_url,
self.ramble_commit,
self.ramble_location,
)
Expand All @@ -121,7 +137,9 @@ def _install_ramble(self):
def _install_spack(self):
print(f"Cloning Spack to {self.spack_location}")
git_clone_commit(
"https://github.com/spack/spack.git", self.spack_commit, self.spack_location
self.spack_url,
self.spack_commit,
self.spack_location,
)
debug_print(f"Done cloning Spack ({self.spack_location})")

Expand Down
5 changes: 0 additions & 5 deletions lib/benchpark/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
from typing import Iterable, Iterator, List, Match, Optional, Union

from benchpark.error import BenchparkError
import benchpark.paths
import benchpark.repo
import benchpark.runtime

bootstrapper = benchpark.runtime.RuntimeResources(benchpark.paths.benchpark_home)
bootstrapper.bootstrap()

import llnl.util.lang # noqa

Expand Down
11 changes: 1 addition & 10 deletions lib/benchpark/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,12 @@
import os
import packaging.version
import yaml
from typing import Dict, Tuple

import benchpark.paths
from benchpark.directives import ExperimentSystemBase
import benchpark.repo
from benchpark.runtime import RuntimeResources

from typing import Dict, Tuple
import benchpark.spec
import benchpark.variant

bootstrapper = RuntimeResources(benchpark.paths.benchpark_home) # noqa
bootstrapper.bootstrap() # noqa

_repo_path = benchpark.repo.paths[benchpark.repo.ObjectTypes.systems]


def _hash_id(content_list):
sha256_hash = hashlib.sha256()
Expand Down
Loading
Loading