diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 5a49848..23faaac 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10"] + python-version: ["3.12"] steps: - uses: actions/checkout@v2 @@ -42,3 +42,23 @@ jobs: - name: Test with mypy run: | mypy --check-untyped-defs src/running + black: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.12"] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools build[virtualenv] + pip install .[zulip,tests] + pip install black + - name: Test with black + run: | + black --check src tests diff --git a/docs/src/changelog.md b/docs/src/changelog.md index 1575f36..3d1f50e 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -1,14 +1,20 @@ # Changelog ## Unreleased ### Added -#### Benchmark Suites -- `DaCapo`: add 23.11-Chopin release and minheap values. +#### Base Configurations +- DaCapo 23.11-Chopin +- Temurin 21 ### Changed +#### Base Configurations +- Environment variables are expanded when resolving paths of runtimes and benchmark suites. ### Deprecated +- Deprecating Python 3.7 support for users. Python 3.7 was last released on June 6, 2023 (3.7.17), which was recent. ### Removed +- Dropping Python 3.6 support for users. Last Python 3.6 release was on Sept. 4, 2021 (3.6.15), which was long ago. +- Dropping Python 3.7 support for developers (NOT users). pytest 7.4+ requires at least Python 3.8 (still supported by Ubuntu 20.04 LTS). ### Fixed diff --git a/pyproject.toml b/pyproject.toml index 81272a2..270c64c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ ] authors = [{name = "Zixian Cai", email = "u5937495@anu.edu.au"}] dependencies = [ - "pyyaml~=6.0" + "pyyaml~=6.0.1" ] dynamic = ["version"] @@ -30,12 +30,12 @@ dynamic = ["version"] [project.optional-dependencies] zulip = [ - "zulip~=0.8.2" + "zulip~=0.9.0" ] tests = [ - "pytest>=7.1.3,<7.5.0", - "types-PyYAML~=6.0.11", - "mypy>=0.971,<2.0" + "pytest~=7.4.3", + "types-PyYAML~=6.0.12", + "mypy~=1.7.0" ] [project.scripts] diff --git a/src/running/benchmark.py b/src/running/benchmark.py index 150b2ed..f448e9b 100644 --- a/src/running/benchmark.py +++ b/src/running/benchmark.py @@ -37,7 +37,7 @@ def __init__( runtime_specific_modifiers_strategy: Optional[ Callable[[Runtime], Sequence[Modifier]] ] = None, - **kwargs + **kwargs, ): self.name = name self.suite_name = suite_name diff --git a/src/running/command/log_preprocessor.py b/src/running/command/log_preprocessor.py index 1a9599e..8eb1f1c 100644 --- a/src/running/command/log_preprocessor.py +++ b/src/running/command/log_preprocessor.py @@ -65,7 +65,7 @@ def ratio_work_perf_event(event_name: str): def inner(stats: Dict[str, float]): new_stats = deepcopy(stats) - for (k, v) in stats.items(): + for k, v in stats.items(): if compiled.match(k): new_column = k.replace(".total", ".ratio") new_stats[new_column] = v / stats[aggregated_column] @@ -107,7 +107,7 @@ def calc_work_ipc(stats: Dict[str, float]): pattern = "work\\.\\w+\\.PERF_COUNT_HW_INSTRUCTIONS\\.total" compiled = re.compile(pattern) new_stats = deepcopy(stats) - for (k, v) in stats.items(): + for k, v in stats.items(): if compiled.match(k): cycles = k.replace("PERF_COUNT_HW_INSTRUCTIONS", "PERF_COUNT_HW_CPU_CYCLES") ipc = k.replace( diff --git a/src/running/config/base/temurin.yml b/src/running/config/base/temurin.yml index 9d5cc43..e749893 100644 --- a/src/running/config/base/temurin.yml +++ b/src/running/config/base/temurin.yml @@ -11,3 +11,7 @@ runtimes: type: OpenJDK release: 17 home: /usr/lib/jvm/temurin-17-jdk-amd64 + temurin-21: + type: OpenJDK + release: 21 + home: /usr/lib/jvm/temurin-21-jdk-amd64 diff --git a/src/running/runtime.py b/src/running/runtime.py index e6f0286..b7e2115 100644 --- a/src/running/runtime.py +++ b/src/running/runtime.py @@ -3,6 +3,7 @@ from pathlib import Path import logging from running.util import register +import os.path class Runtime(object): @@ -90,7 +91,7 @@ def __init__(self, **kwargs): except ValueError: raise TypeError("The release of an OpenJDK has to be int-like") self.home: Path - self.home = Path(kwargs["home"]) + self.home = Path(os.path.expandvars(kwargs["home"])) if not self.home.exists(): logging.warning("OpenJDK home {} doesn't exist".format(self.home)) self.executable = self.home / "bin" / "java" @@ -110,7 +111,7 @@ class JikesRVM(JVM): def __init__(self, **kwargs): super().__init__(**kwargs) self.home: Path - self.home = Path(kwargs["home"]) + self.home = Path(os.path.expandvars(kwargs["home"])) if not self.home.exists(): logging.warning("JikesRVM home {} doesn't exist".format(self.home)) self.executable = self.home / "rvm" @@ -129,7 +130,7 @@ class JavaScriptRuntime(Runtime): def __init__(self, **kwargs): super().__init__(**kwargs) self.executable: Path - self.executable = Path(kwargs["executable"]) + self.executable = Path(os.path.expandvars(kwargs["executable"])) if not self.executable.exists(): logging.warning( "JavaScriptRuntime executable {} doesn't exist".format(self.executable) @@ -204,7 +205,7 @@ class Julia(Runtime): def __init__(self, **kwargs): super().__init__(**kwargs) self.executable: Path - self.executable = Path(kwargs["executable"]) + self.executable = Path(os.path.expandvars(kwargs["executable"])) if not self.executable.exists(): logging.warning("Julia executable {} doesn't exist".format(self.executable)) self.executable = self.executable.absolute() diff --git a/src/running/suite.py b/src/running/suite.py index c97d33a..aec5661 100644 --- a/src/running/suite.py +++ b/src/running/suite.py @@ -11,6 +11,7 @@ from running.modifier import JVMArg, Modifier import logging from running.util import register, split_quoted +import os.path __DRY_RUN = False __DEFAULT_MINHEAP = 4096 @@ -112,7 +113,7 @@ def __init__(self, **kwargs): if self.release not in ["2006", "9.12", "evaluation"]: raise ValueError("DaCapo release {} not recongized".format(self.release)) self.path: Path - self.path = Path(kwargs["path"]) + self.path = Path(os.path.expandvars(kwargs["path"])) if not self.path.exists(): logging.warning("DaCapo jar {} not found".format(self.path)) self.minheap: Optional[str] @@ -306,7 +307,7 @@ def __init__(self, **kwargs): "SPECjbb2015 release {} not recongized".format(self.release) ) self.path: Path - self.path = Path(kwargs["path"]).resolve() + self.path = Path(os.path.expandvars(kwargs["path"])).resolve() self.propsfile = (self.path / ".." / "config" / "specjbb2015.props").resolve() if not self.path.exists(): logging.info("SPECjbb2015 jar {} not found".format(self.path)) @@ -349,7 +350,7 @@ class Octane(BenchmarkSuite): def __init__(self, **kwargs): super().__init__(**kwargs) self.path: Path - self.path = Path(kwargs["path"]).resolve() + self.path = Path(os.path.expandvars(kwargs["path"])).resolve() if not self.path.exists(): logging.info("Octane folder {} not found".format(self.path)) self.wrapper: Path @@ -431,7 +432,7 @@ def __init__(self, **kwargs): if self.release not in ["1.03_05"]: raise ValueError("SPECjvm98 release {} not recongized".format(self.release)) self.path: Path - self.path = Path(kwargs["path"]).resolve() + self.path = Path(os.path.expandvars(kwargs["path"])).resolve() if not self.path.exists(): logging.info("SPECjvm98 {} not found".format(self.path)) @@ -481,7 +482,7 @@ class JuliaGCBenchmarks(BenchmarkSuite): def __init__(self, **kwargs): super().__init__(**kwargs) self.path: Path - self.path = Path(kwargs["path"]) + self.path = Path(os.path.expandvars(kwargs["path"])) if not self.path.exists(): logging.warning("JuliaGCBenchmarks does not exist at {}".format(self.path)) self.minheap: Optional[str] diff --git a/tests/test_runtime.py b/tests/test_runtime.py new file mode 100644 index 0000000..843359e --- /dev/null +++ b/tests/test_runtime.py @@ -0,0 +1,29 @@ +from running.config import Configuration + + +def test_openjdk_path_ennvvar(): + c = Configuration( + { + "runtimes": { + "temurin-21_bogus": { + "type": "OpenJDK", + "release": 21, + # some bogus environment variable that will not be expanded + "home": "$DAHKDLHDIWHEIUWHEIWEHIJHDJKAGDKJADGUQDGIQUWDGI/temurin-21-jdk-amd64", + }, + "temurin-21": { + "type": "OpenJDK", + "release": 21, + "home": "$HOME/temurin-21-jdk-amd64", + }, + } + } + ) + + c.resolve_class() + temurin_21_bogus = c.get("runtimes")["temurin-21_bogus"] + temurin_21 = c.get("runtimes")["temurin-21_bogus"] + assert "$HOME" not in str(temurin_21.home) + assert "$DAHKDLHDIWHEIUWHEIWEHIJHDJKAGDKJADGUQDGIQUWDGI" in str( + temurin_21_bogus.home + ) diff --git a/tests/test_suite.py b/tests/test_suite.py index f5c2215..0105cd9 100644 --- a/tests/test_suite.py +++ b/tests/test_suite.py @@ -116,3 +116,33 @@ def test_dacapo_openjdk_9_workaround(): print(fop_jdk11.to_string(jdk11)) assert "add-exports" not in fop_jdk8.to_string(jdk8) assert "add-exports" in fop_jdk11.to_string(jdk11) + + +def test_dacapo_path_ennvvar(): + c = Configuration( + { + "suites": { + "dacapo2006_bogus": { + "type": "DaCapo", + "release": "2006", + # some bogus environment variable that will not be expanded + "path": "$DAHKDLHDIWHEIUWHEIWEHIJHDJKAGDKJADGUQDGIQUWDGI/dacapo-2006-10-MR2.jar", + "timing_iteration": 3, + }, + "dacapo2006": { + "type": "DaCapo", + "release": "2006", + "path": "$HOME/dacapo-2006-10-MR2.jar", + "timing_iteration": 3, + }, + } + } + ) + + c.resolve_class() + dacapo2006 = c.get("suites")["dacapo2006"] + dacapo2006_bogus = c.get("suites")["dacapo2006_bogus"] + assert "$HOME" not in str(dacapo2006.path) + assert "$DAHKDLHDIWHEIUWHEIWEHIJHDJKAGDKJADGUQDGIQUWDGI" in str( + dacapo2006_bogus.path + )