Skip to content

Commit 1d58b45

Browse files
authored
dry run stolen from Henry (#765)
1 parent c6b306d commit 1d58b45

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

.github/workflows/frontier/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

33
. ./mfc.sh load -c f -m g
4-
./mfc.sh build -j 8 --gpu
4+
./mfc.sh test --dry-run -j 8 --gpu

.github/workflows/phoenix/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ "$job_device" == "gpu" ]; then
55
build_opts="--gpu"
66
fi
77

8-
./mfc.sh build -j 8 $build_opts
8+
./mfc.sh test --dry-run -j 8 $build_opts
99

1010
n_test_threads=8
1111

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
7979
- name: Build
8080
run: |
81-
/bin/bash mfc.sh build -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }} --${{ matrix.precision }}
81+
/bin/bash mfc.sh test --dry-run -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }} --${{ matrix.precision }}
8282
8383
- name: Test
8484
run: |

toolchain/mfc/args.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ def add_common_arguments(p, mask = None):
8383
test.add_argument( "--no-build", action="store_true", default=False, help="(Testing) Do not rebuild MFC.")
8484
test.add_argument( "--no-examples", action="store_true", default=False, help="Do not test example cases." )
8585
test.add_argument("--case-optimization", action="store_true", default=False, help="(GPU Optimization) Compile MFC targets with some case parameters hard-coded.")
86+
test.add_argument( "--dry-run", action="store_true", default=False, help="Build and generate case files but do not run tests.")
87+
8688
test_meg = test.add_mutually_exclusive_group()
8789
test_meg.add_argument("--generate", action="store_true", default=False, help="(Test Generation) Generate golden files.")
8890
test_meg.add_argument("--add-new-variables", action="store_true", default=False, help="(Test Generation) If new variables are found in D/ when running tests, add them to the golden files.")

toolchain/mfc/test/test.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os, typing, shutil, time, itertools
2-
from random import sample
2+
from random import sample, seed
33

44
import rich, rich.table
55

@@ -71,6 +71,8 @@ def __filter(cases_) -> typing.List[TestCase]:
7171
if ARG("percent") == 100:
7272
return cases, skipped_cases
7373

74+
seed(time.time())
75+
7476
selected_cases = sample(cases, k=int(len(cases)*ARG("percent")/100.0))
7577
skipped_cases = [item for item in cases if item not in selected_cases]
7678

@@ -173,6 +175,11 @@ def _handle_case(case: TestCase, devices: typing.Set[int]):
173175
tol = case.compute_tolerance()
174176
case.delete_output()
175177
case.create_directory()
178+
179+
if ARG("dry_run"):
180+
cons.print(f" [bold magenta]{case.get_uuid()}[/bold magenta] SKIP {case.trace}")
181+
return
182+
176183
cmd = case.run([PRE_PROCESS, SIMULATION], gpus=devices)
177184
out_filepath = os.path.join(case.get_dirpath(), "out_pre_sim.txt")
178185

@@ -265,7 +272,10 @@ def handle_case(case: TestCase, devices: typing.Set[int]):
265272

266273
try:
267274
_handle_case(case, devices)
268-
nPASS += 1
275+
if ARG("dry_run"):
276+
nSKIP += 1
277+
else:
278+
nPASS += 1
269279
except Exception as exc:
270280
if nAttempts < max_attempts:
271281
continue

0 commit comments

Comments
 (0)