Skip to content

dry run stolen from Henry #765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/frontier/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

. ./mfc.sh load -c f -m g
./mfc.sh build -j 8 --gpu
./mfc.sh test --dry-run -j 8 --gpu
2 changes: 1 addition & 1 deletion .github/workflows/phoenix/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ "$job_device" == "gpu" ]; then
build_opts="--gpu"
fi

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

n_test_threads=8

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:

- name: Build
run: |
/bin/bash mfc.sh build -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }} --${{ matrix.precision }}
/bin/bash mfc.sh test --dry-run -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }} --${{ matrix.precision }}

- name: Test
run: |
Expand Down
2 changes: 2 additions & 0 deletions toolchain/mfc/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def add_common_arguments(p, mask = None):
test.add_argument( "--no-build", action="store_true", default=False, help="(Testing) Do not rebuild MFC.")
test.add_argument( "--no-examples", action="store_true", default=False, help="Do not test example cases." )
test.add_argument("--case-optimization", action="store_true", default=False, help="(GPU Optimization) Compile MFC targets with some case parameters hard-coded.")
test.add_argument( "--dry-run", action="store_true", default=False, help="Build and generate case files but do not run tests.")

test_meg = test.add_mutually_exclusive_group()
test_meg.add_argument("--generate", action="store_true", default=False, help="(Test Generation) Generate golden files.")
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.")
Expand Down
14 changes: 12 additions & 2 deletions toolchain/mfc/test/test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os, typing, shutil, time, itertools
from random import sample
from random import sample, seed

import rich, rich.table

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

seed(time.time())

selected_cases = sample(cases, k=int(len(cases)*ARG("percent")/100.0))
skipped_cases = [item for item in cases if item not in selected_cases]

Expand Down Expand Up @@ -173,6 +175,11 @@ def _handle_case(case: TestCase, devices: typing.Set[int]):
tol = case.compute_tolerance()
case.delete_output()
case.create_directory()

if ARG("dry_run"):
cons.print(f" [bold magenta]{case.get_uuid()}[/bold magenta] SKIP {case.trace}")
return

cmd = case.run([PRE_PROCESS, SIMULATION], gpus=devices)
out_filepath = os.path.join(case.get_dirpath(), "out_pre_sim.txt")

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

try:
_handle_case(case, devices)
nPASS += 1
if ARG("dry_run"):
nSKIP += 1
else:
nPASS += 1
except Exception as exc:
if nAttempts < max_attempts:
continue
Expand Down
Loading