-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd2a04c
commit 96f27e9
Showing
9 changed files
with
168 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
"""Manually construct run configurations via the Python DSL interface.""" | ||
|
||
# | ||
# def get_cpp_reference_impl() -> RunConfiguration: | ||
# """Build a run configuration for the reference implementation.""" | ||
# run.sbatch_config = { | ||
# "ntasks-per-node": "1", | ||
# "cpus-per-task": "1", | ||
# "mem-per-cpu": "3700", # max on avon? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,105 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
"""Ingest YAML data.""" | ||
""" | ||
Ingest YAML data. | ||
Sample code for adding defaults: | ||
```python | ||
class Defaults(BaseModel): | ||
sbatch_config: Optional[list[str]] = None | ||
module_loads: Optional[list[str]] = None | ||
environment_variables: Optional[list[str]] = None | ||
directory: Optional[Path] = None | ||
build_commands: Optional[list[str]] = None | ||
run_commands: Optional[list[str]] = None | ||
args: Optional[str] = None | ||
``` | ||
""" | ||
|
||
def absurd() -> int: | ||
"""Be strange.""" | ||
return 0 | ||
from pathlib import Path | ||
from typing import Any | ||
|
||
import yaml | ||
from pydantic import BaseModel | ||
|
||
from hpc_multibench.configuration import RunConfiguration | ||
|
||
|
||
class Executable(BaseModel): | ||
""".""" | ||
|
||
sbatch_config: dict[str, Any] | ||
module_loads: list[str] | ||
environment_variables: dict[str, Any] | ||
directory: Path | ||
build_commands: list[str] | ||
run_command: str | ||
args: str | None = None | ||
|
||
|
||
class Bench(BaseModel): | ||
""".""" | ||
|
||
executables: list[str] | ||
matrix: list[dict[str, list[Any]]] | ||
|
||
|
||
class TestPlan(BaseModel): | ||
""".""" | ||
|
||
executables: dict[str, Executable] | ||
benches: dict[str, Bench] | ||
|
||
|
||
def get_test_plan(config_file: Path) -> TestPlan: | ||
""".""" | ||
with config_file.open(encoding="utf-8") as config_handle: | ||
config_data = yaml.safe_load(config_handle) | ||
return TestPlan(**config_data) | ||
|
||
|
||
def get_run_configuration(name: str, executable: Executable) -> RunConfiguration: | ||
""".""" | ||
run = RunConfiguration(executable.run_command) | ||
run.name = name | ||
run.sbatch_config = executable.sbatch_config | ||
run.module_loads = executable.module_loads | ||
run.environment_variables = executable.environment_variables | ||
run.directory = Path(executable.directory) | ||
run.build_commands = executable.build_commands | ||
run.args = executable.args | ||
return run | ||
|
||
|
||
def get_bench( | ||
bench_name: str, bench: Bench, executables: dict[str, Executable] | ||
) -> list[RunConfiguration]: | ||
""".""" | ||
bench_run_configurations: list[RunConfiguration] = [] | ||
# Iterate through matrix | ||
for executable_name in bench.executables: | ||
if executable_name not in executables: | ||
raise RuntimeError( | ||
f"Executable '{executable_name}' not in list of defined executables!" | ||
) | ||
executable = executables[executable_name] | ||
|
||
# Update executable based on matrix | ||
bench_run_configurations.append( | ||
get_run_configuration(f"{bench_name}/{executable_name}", executable) | ||
) | ||
return bench_run_configurations | ||
|
||
|
||
def get_benches(config_file: Path) -> dict[str, list[RunConfiguration]]: | ||
""".""" | ||
test_plan = get_test_plan(config_file) | ||
|
||
return { | ||
bench_name: get_bench(bench_name, bench, test_plan.executables) | ||
for (bench_name, bench) in test_plan.benches.items() | ||
} | ||
|
||
# for (bench_name, bench) in test_plan.benches.items(): | ||
# for instance in variable: | ||
# for executable in test_plan.executables: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#- defaults: | ||
# - "default name": | ||
executables: | ||
"executable name": | ||
sbatch_config: | ||
"nodes": 1 | ||
"ntasks-per-node": 1 | ||
"cpus-per-task": "1" | ||
"mem-per-cpu": "3700" | ||
module_loads: | ||
- "GCC/11.3.0" | ||
environment_variables: {} | ||
directory: "../0_cpp_versions/0_ref" | ||
build_commands: | ||
- "make -j 8" | ||
run_command: "./test_HPCCG" | ||
benches: | ||
"bench name": | ||
executables: ["executable name"] | ||
matrix: | ||
- args: | ||
- "50 50 50" | ||
- "100 100 100" | ||
- environment_variables: | ||
- OMP_NUM_THREADS: 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters