Skip to content

Commit c3ffbda

Browse files
authored
Merge branch 'master' into better-tests
2 parents dcb2966 + 808a668 commit c3ffbda

40 files changed

Lines changed: 2382 additions & 388 deletions

.claude/rules/fortran-conventions.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,28 @@ Every Fortran module follows this pattern:
2323

2424
## Forbidden Patterns
2525

26-
Caught by `./mfc.sh precheck` (source lint step 4/5):
26+
All checks below are enforced by `python3 toolchain/mfc/lint_source.py`
27+
(runs via `./mfc.sh precheck` and CI). See that file for the full list.
28+
29+
Fortran/Fypp source (`src/`):
2730
- `dsqrt`, `dexp`, `dlog`, `dble`, `dabs`, `dcos`, `dsin`, `dtan`, etc. → use generic intrinsics
2831
- `1.0d0`, `2.5d-3` (Fortran `d` exponent literals) → use `1.0_wp`, `2.5e-3_wp`
2932
- `double precision` → use `real(wp)` or `real(stp)`
3033
- `real(8)`, `real(4)` → use `wp` or `stp` kind parameters
3134
- Raw `!$acc` or `!$omp` directives → use Fypp GPU_* macros from `parallel_macros.fpp`
32-
- Full list of forbidden patterns: `toolchain/bootstrap/precheck.sh`
35+
- `int(8._wp, ...)` hardcoded byte size → use `storage_size(0._stp)/8`
36+
- Bare integer kind like `2_wp` → use `2.0_wp`
37+
- Junk patterns (`...`, `---`, `===`) in code or comments (no separator comments)
38+
- Duplicate entries in Fypp `#:for ... in [...]` lists
39+
- Identical adjacent non-trivial lines (copy-paste bugs)
40+
41+
Python (`examples/`, `benchmarks/`, `toolchain/`):
42+
- `===` separator comments → remove
43+
- `----` or longer separator comments → remove (3 dashes `---` is allowed for markdown)
44+
45+
Shell (`.github/`, `toolchain/`):
46+
- `===` or `----` separator comments → remove
47+
- Echo separators longer than 20 characters → shorten
3348

3449
Enforced by convention/code review (not automated):
3550
- `goto`, `COMMON` blocks, global `save` variables

.github/file-filter.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ yml: &yml
2525
- '.github/workflows/phoenix/**'
2626
- '.github/workflows/frontier/**'
2727
- '.github/workflows/frontier_amd/**'
28+
- '.github/workflows/common/**'
2829
- '.github/scripts/**'
2930
- '.github/workflows/bench.yml'
3031
- '.github/workflows/test.yml'
@@ -37,3 +38,6 @@ checkall: &checkall
3738
- *tests
3839
- *scripts
3940
- *yml
41+
42+
cases_py:
43+
- 'toolchain/mfc/test/cases.py'

.github/scripts/run_case_optimization.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ for case in "${benchmarks[@]}"; do
3636
case_dir="$(dirname "$case")"
3737
case_name="$(basename "$case_dir")"
3838
echo ""
39-
echo "========================================"
39+
echo "===================="
4040
echo "Case-optimization test: $case_name"
41-
echo "========================================"
41+
echo "===================="
4242

4343
# Clean any previous output
4444
rm -rf "$case_dir/D" "$case_dir/p_all" "$case_dir/restart_data"
@@ -65,11 +65,11 @@ for case in "${benchmarks[@]}"; do
6565
done
6666

6767
echo ""
68-
echo "========================================"
68+
echo "===================="
6969
echo "Case-optimization summary: $passed passed, $failed failed"
7070
if [ $failed -gt 0 ]; then
7171
echo "Failed cases:$failed_cases"
7272
fi
73-
echo "========================================"
73+
echo "===================="
7474

7575
[ $failed -eq 0 ] && exit 0 || exit 1

.github/scripts/run_parallel_benchmarks.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ cluster="$3"
2020
# Get the directory where this script lives (pr/.github/scripts/)
2121
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2222

23-
echo "=========================================="
23+
echo "===================="
2424
echo "Starting benchmark jobs..."
25-
echo "=========================================="
25+
echo "===================="
2626

2727
# For Phoenix GPU benchmarks, select a consistent GPU partition so PR and
2828
# master always land on the same GPU type.
@@ -82,9 +82,9 @@ if [ "${pr_exit}" -ne 0 ] || [ "${master_exit}" -ne 0 ]; then
8282
echo "WARNING: Benchmark jobs had failures: pr=${pr_exit}, master=${master_exit}"
8383
echo "Checking for partial results..."
8484
else
85-
echo "=========================================="
85+
echo "===================="
8686
echo "Both benchmark jobs completed successfully!"
87-
echo "=========================================="
87+
echo "===================="
8888
fi
8989

9090
pr_yaml="pr/${job_slug}.yaml"

.github/scripts/submit-slurm-job.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ job_device="$device"
185185
job_interface="$interface"
186186
job_shard="$shard"
187187
job_cluster="$cluster"
188+
export GITHUB_EVENT_NAME="$GITHUB_EVENT_NAME"
188189
189190
. ./mfc.sh load -c $compiler_flag -m $module_mode
190191

.github/scripts/submit_and_monitor_bench.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ if [ ! -f "$yaml_file" ]; then
3636
echo ""
3737
output_file="${job_slug}.out"
3838
echo "[$dir] Last 100 lines of job output ($output_file):"
39-
echo "----------------------------------------"
39+
echo "--------------------"
4040
tail -n 100 "$output_file" 2>/dev/null || echo " Could not read output file"
41-
echo "----------------------------------------"
41+
echo "--------------------"
4242
exit 1
4343
fi
4444

.github/workflows/cleanliness.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ jobs:
8686
grep -F 'Wmaybe-uninitialized' master.txt > mMaybe.txt
8787
diff prMaybe.txt mMaybe.txt
8888
89+
- name: Conversion Warnings Diff
90+
continue-on-error: true
91+
run: |
92+
grep -F 'Wconversion' pr.txt > prConversion.txt
93+
grep -F 'Wconversion' master.txt > mConversion.txt
94+
diff prConversion.txt mConversion.txt
8995
9096
- name: Everything Diff
9197
continue-on-error: true
@@ -106,12 +112,14 @@ jobs:
106112
pr_argument=$(grep -c -F 'Wunused-dummy-argument' pr.txt)
107113
pr_value=$(grep -c -F 'Wunused-value' pr.txt)
108114
pr_uninit=$(grep -c -F 'Wmaybe-uninitialized' pr.txt)
115+
pr_conversion=$(grep -c -F 'Wconversion' pr.txt)
109116
pr_everything=$(grep -c '\-W' pr.txt)
110117
111118
master_variable=$(grep -c -F 'Wunused-variable' master.txt)
112119
master_argument=$(grep -c -F 'Wunused-dummy-argument' master.txt)
113120
master_value=$(grep -c -F 'Wunused-value' master.txt)
114121
master_uninit=$(grep -c -F 'Wmaybe-uninitialized' master.txt)
122+
master_conversion=$(grep -c -F 'Wconversion' master.txt)
115123
master_everything=$(grep -c '\-W' master.txt )
116124
117125
echo "pr_everything=$pr_everything" >> $GITHUB_ENV
@@ -124,6 +132,7 @@ jobs:
124132
echo "Unused Dummy Argument: $pr_argument, Difference: $((pr_argument - master_argument))"
125133
echo "Unused Value: $pr_value, Difference: $((pr_value - master_value))"
126134
echo "Maybe Uninitialized: $pr_uninit, Difference: $((pr_uninit - master_uninit))"
135+
echo "Conversion: $pr_conversion, Difference: $((pr_conversion - master_conversion))"
127136
echo "Everything: $pr_everything, Difference: $((pr_everything - master_everything))"
128137
129138

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Number of parallel jobs: use SLURM allocation or default to 24.
5+
# Cap at 64 to avoid overwhelming OpenMPI daemons and OS process limits with concurrent launches.
6+
NJOBS="${SLURM_CPUS_ON_NODE:-24}"
7+
if [ "$NJOBS" -gt 64 ]; then NJOBS=64; fi
8+
9+
# Clean stale build artifacts: the self-hosted runner may have a cached
10+
# GPU build (e.g. --gpu mp) whose CMake flags are incompatible with gcov.
11+
./mfc.sh clean
12+
13+
# Source retry_build() for NFS stale file handle resilience (3 attempts).
14+
source .github/scripts/retry-build.sh
15+
16+
# Build MFC with gcov coverage instrumentation (CPU-only, gfortran).
17+
retry_build ./mfc.sh build --gcov -j 8
18+
19+
# Run all tests in parallel, collecting per-test coverage data.
20+
# Each test gets an isolated GCOV_PREFIX directory so .gcda files
21+
# don't collide. Coverage is collected per-test after all tests finish.
22+
# --gcov is required so the internal build step preserves instrumentation.
23+
./mfc.sh test --build-coverage-cache --gcov -j "$NJOBS"

.github/workflows/common/test.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,10 @@ if [ -n "${job_shard:-}" ]; then
8282
shard_opts="--shard $job_shard"
8383
fi
8484

85-
./mfc.sh test -v --max-attempts 3 -a -j $n_test_threads $rdma_opts $device_opts $build_opts $shard_opts -- -c $job_cluster
85+
# Only prune tests on PRs; master pushes must run the full suite.
86+
prune_flag=""
87+
if [ "${GITHUB_EVENT_NAME:-}" = "pull_request" ]; then
88+
prune_flag="--only-changes"
89+
fi
90+
91+
./mfc.sh test -v --max-attempts 3 $prune_flag -a -j $n_test_threads $rdma_opts $device_opts $build_opts $shard_opts -- -c $job_cluster

.github/workflows/lint-source.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)