Skip to content

Commit 07ff320

Browse files
committed
1 parent 9ebbf2e commit 07ff320

File tree

2 files changed

+140
-0
lines changed

2 files changed

+140
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"schema_version": "1-0-0",
3+
"output": {
4+
"En": [
5+
"3.0906073728130855E-23",
6+
"5.1369904973574108E-04"
7+
],
8+
"CFL": [
9+
"0.00000",
10+
"0.06876"
11+
],
12+
"SL": [
13+
"1.5151E-10",
14+
"-1.2494E-06"
15+
],
16+
"M": [
17+
"1.36404E+21",
18+
"1.36404E+21"
19+
],
20+
"S": [
21+
"34.7263",
22+
"34.7263"
23+
],
24+
"T": [
25+
"3.6362",
26+
"3.6363"
27+
],
28+
"Me": [
29+
"0.00E+00",
30+
"-3.43E-10"
31+
],
32+
"Se": [
33+
"0.00E+00",
34+
"-1.17E-08"
35+
],
36+
"Te": [
37+
"0.00E+00",
38+
"5.48E-09"
39+
]
40+
}
41+
}

testing/test_report.xml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="1" skipped="0" tests="1" time="305.727" timestamp="2025-02-18T15:51:33.945539+11:00" hostname="gadi-login-05.gadi.nci.org.au"><testcase classname="test-venv.lib.python3.10.site-packages.model_config_tests.test_bit_reproducibility.TestBitReproducibility" name="test_bit_repro_historical" time="304.842"><failure message="AssertionError: Checksums were not equal. The new checksums have been written to /scratch/tm70/repro-ci/experiments/access-om3-configs/9ebbf2e305e530004258a93e764dd55ea179265f/checksum/historical-3hr-checksum.json.&#10;assert {'output': {'...ion': '1-0-0'} == {'output': {'...ion': '1-0-0'}&#10; &#10; Omitting 1 identical items, use -vv to show&#10; Differing items:&#10; {'output': {'CFL': ['0.00000', '0.06867'], 'En': ['3.1034198253312566E-23', '5.2770203504346890E-04'], 'M': ['1.36404E+21', '1.36404E+21'], 'Me': ['0.00E+00', '2.55E-20'], ...}} != {'output': {'CFL': ['0.00000', '0.06876'], 'En': ['3.0906073728130855E-23', '5.1369904973574108E-04'], 'M': ['1.36404E+21', '1.36404E+21'], 'Me': ['0.00E+00', '-3.43E-10'], ...}}&#10; Use -v to get more diff">self = &lt;model_config_tests.test_bit_reproducibility.TestBitReproducibility object at 0x7f35712dd270&gt;
2+
output_path = PosixPath('/scratch/tm70/repro-ci/experiments/access-om3-configs/9ebbf2e305e530004258a93e764dd55ea179265f')
3+
control_path = PosixPath('/scratch/tm70/repro-ci/experiments/access-om3-configs/9ebbf2e305e530004258a93e764dd55ea179265f/base-experiment')
4+
checksum_path = PosixPath('/scratch/tm70/repro-ci/experiments/access-om3-configs/9ebbf2e305e530004258a93e764dd55ea179265f/compared/testing/checksum/historical-3hr-checksum.json')
5+
keep_archive = False
6+
7+
@pytest.mark.checksum
8+
def test_bit_repro_historical(
9+
self,
10+
output_path: Path,
11+
control_path: Path,
12+
checksum_path: Optional[Path],
13+
keep_archive: Optional[bool],
14+
):
15+
"""
16+
Test that a run reproduces historical checksums
17+
18+
Parameters (these are fixtures defined in conftest.py)
19+
----------
20+
output_path: Path
21+
Output directory for test output and where the control and
22+
lab directories are stored for the payu experiments. Default is
23+
set in conftest.py
24+
control_path: Path
25+
Path to the model configuration to test. This is copied for
26+
for control directories in experiments. Default is set in
27+
conftests.py
28+
checksum_path: Optional[Path]
29+
Path to checksums to compare model output against. Default is
30+
set to checksums saved on model configuration (set in )
31+
keep_archive: Optional[bool]
32+
This flag is used in testing for test code to use a previous test
33+
archive, and to disable running the model with payu
34+
"""
35+
# Setup checksum output directory
36+
checksum_output_dir = set_checksum_output_dir(output_path=output_path)
37+
38+
# Setup experiment
39+
exp = setup_exp(
40+
control_path, output_path, "test_bit_repro_historical", keep_archive
41+
)
42+
43+
# Set model runtime using the configured default
44+
exp.model.set_model_runtime()
45+
46+
# Run the experiment using payu
47+
status, stdout, stderr, output_files = exp.setup_and_run()
48+
49+
if status != 0 or not exp.model.output_exists():
50+
# Log the run information
51+
exp.print_run_logs(status, stdout, stderr, output_files)
52+
53+
assert status == 0, (
54+
"There was an error running the experiment. "
55+
"See the logs for more infomation on the experiment run"
56+
)
57+
58+
assert exp.model.output_exists(), (
59+
"Output file for the model does not exist. "
60+
"See the logs for more information on the experiment run"
61+
)
62+
63+
# Set the checksum output filename using the model default runtime
64+
runtime_hours = exp.model.default_runtime_seconds // HOUR_IN_SECONDS
65+
checksum_filename = f"historical-{runtime_hours}hr-checksum.json"
66+
67+
# Read the historical checksum file
68+
hist_checksums = read_historical_checksums(
69+
control_path, checksum_filename, checksum_path
70+
)
71+
72+
# Use historical file checksums schema version for parsing checksum,
73+
# otherwise use the model default, if file does not exist
74+
schema_version = (
75+
hist_checksums["schema_version"]
76+
if hist_checksums
77+
else exp.model.default_schema_version
78+
)
79+
80+
# Extract checksums
81+
checksums = exp.extract_checksums(schema_version=schema_version)
82+
83+
# Write out checksums to output file
84+
checksum_output_file = checksum_output_dir / checksum_filename
85+
with open(checksum_output_file, "w") as file:
86+
json.dump(checksums, file, indent=2)
87+
88+
&gt; assert (
89+
hist_checksums == checksums
90+
), f"Checksums were not equal. The new checksums have been written to {checksum_output_file}."
91+
E AssertionError: Checksums were not equal. The new checksums have been written to /scratch/tm70/repro-ci/experiments/access-om3-configs/9ebbf2e305e530004258a93e764dd55ea179265f/checksum/historical-3hr-checksum.json.
92+
E assert {'output': {'...ion': '1-0-0'} == {'output': {'...ion': '1-0-0'}
93+
E
94+
E Omitting 1 identical items, use -vv to show
95+
E Differing items:
96+
E {'output': {'CFL': ['0.00000', '0.06867'], 'En': ['3.1034198253312566E-23', '5.2770203504346890E-04'], 'M': ['1.36404E+21', '1.36404E+21'], 'Me': ['0.00E+00', '2.55E-20'], ...}} != {'output': {'CFL': ['0.00000', '0.06876'], 'En': ['3.0906073728130855E-23', '5.1369904973574108E-04'], 'M': ['1.36404E+21', '1.36404E+21'], 'Me': ['0.00E+00', '-3.43E-10'], ...}}
97+
E Use -v to get more diff
98+
99+
../test-venv/lib/python3.10/site-packages/model_config_tests/test_bit_reproducibility.py:131: AssertionError</failure></testcase></testsuite></testsuites>

0 commit comments

Comments
 (0)