Skip to content

Commit fd06e97

Browse files
Spencer Bryngelsonclaude
andcommitted
Adopt CI improvements from PR #1295
- self/case-optimization: clean: true on checkout - self: build retry max_attempts 3→2, on_retry rm -rf build - self/case-optimization: add Cancel SLURM Jobs step on cancellation - case-optimization: drop retry wrapper on Pre-Build (login node) - CMakeLists.txt: skip -march=native for gcov builds; add -mno-avx512fp16 to avoid binutils <2.38 assembler failures on Granite Rapids CPUs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f881888 commit fd06e97

2 files changed

Lines changed: 41 additions & 18 deletions

File tree

.github/workflows/test.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -237,21 +237,30 @@ jobs:
237237
- name: Clone
238238
uses: actions/checkout@v4
239239
with:
240-
clean: false
240+
clean: true
241241

242242
- name: Build
243243
if: matrix.cluster != 'phoenix'
244244
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
245245
with:
246-
max_attempts: 3
246+
max_attempts: 2
247247
retry_wait_seconds: 60
248248
timeout_minutes: 60
249249
command: bash .github/workflows/${{ matrix.cluster }}/build.sh ${{ matrix.device }} ${{ matrix.interface }}
250-
on_retry_command: ./mfc.sh clean
250+
on_retry_command: rm -rf build
251251

252252
- name: Test
253253
run: bash .github/workflows/${{ matrix.cluster }}/submit.sh .github/workflows/${{ matrix.cluster }}/test.sh ${{ matrix.device }} ${{ matrix.interface }} ${{ matrix.shard }}
254254

255+
- name: Cancel SLURM Jobs
256+
if: cancelled()
257+
run: |
258+
find . -name "*.slurm_job_id" | while read -r f; do
259+
job_id=$(cat "$f")
260+
echo "Cancelling SLURM job $job_id"
261+
scancel "$job_id" 2>/dev/null || true
262+
done
263+
255264
- name: Compute Log Slug
256265
if: always()
257266
id: log
@@ -315,25 +324,28 @@ jobs:
315324
- name: Clone
316325
uses: actions/checkout@v4
317326
with:
318-
clean: false
327+
clean: true
319328

320329
- name: Pre-Build (SLURM)
321330
if: matrix.cluster == 'phoenix'
322331
run: bash .github/workflows/phoenix/submit.sh .github/scripts/prebuild-case-optimization.sh ${{ matrix.device }} ${{ matrix.interface }}
323332

324333
- name: Pre-Build (login node)
325334
if: matrix.cluster != 'phoenix'
326-
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
327-
with:
328-
max_attempts: 3
329-
retry_wait_seconds: 60
330-
timeout_minutes: 120
331-
command: bash .github/scripts/prebuild-case-optimization.sh ${{ matrix.cluster }} ${{ matrix.device }} ${{ matrix.interface }}
332-
on_retry_command: ./mfc.sh clean
335+
run: bash .github/scripts/prebuild-case-optimization.sh ${{ matrix.cluster }} ${{ matrix.device }} ${{ matrix.interface }}
333336

334337
- name: Run Case-Optimization Tests
335338
run: bash .github/workflows/${{ matrix.cluster }}/submit.sh .github/scripts/run_case_optimization.sh ${{ matrix.device }} ${{ matrix.interface }}
336339

340+
- name: Cancel SLURM Jobs
341+
if: cancelled()
342+
run: |
343+
find . -name "*.slurm_job_id" | while read -r f; do
344+
job_id=$(cat "$f")
345+
echo "Cancelling SLURM job $job_id"
346+
scancel "$job_id" 2>/dev/null || true
347+
done
348+
337349
- name: Print Logs
338350
if: always()
339351
run: |

CMakeLists.txt

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,24 @@ endif()
224224

225225
if (CMAKE_BUILD_TYPE STREQUAL "Release")
226226
# Processor tuning: Check if we can target the host's native CPU's ISA.
227-
CHECK_FORTRAN_COMPILER_FLAG("-march=native" SUPPORTS_MARCH_NATIVE)
228-
if (SUPPORTS_MARCH_NATIVE)
229-
add_compile_options($<$<COMPILE_LANGUAGE:Fortran>:-march=native>)
230-
else()
231-
CHECK_FORTRAN_COMPILER_FLAG("-mcpu=native" SUPPORTS_MCPU_NATIVE)
232-
if (SUPPORTS_MCPU_NATIVE)
233-
add_compile_options($<$<COMPILE_LANGUAGE:Fortran>:-mcpu=native>)
227+
# Skip for gcov builds — -march=native on newer CPUs (e.g. Granite Rapids)
228+
# can emit instructions the system assembler doesn't support.
229+
if (NOT MFC_GCov)
230+
CHECK_FORTRAN_COMPILER_FLAG("-march=native" SUPPORTS_MARCH_NATIVE)
231+
if (SUPPORTS_MARCH_NATIVE)
232+
add_compile_options($<$<COMPILE_LANGUAGE:Fortran>:-march=native>)
233+
# Disable AVX-512 FP16: gfortran >=12 emits vmovw instructions on
234+
# Granite Rapids CPUs, but binutils <2.38 cannot assemble them.
235+
# FP16 is unused in MFC's double-precision computations.
236+
CHECK_FORTRAN_COMPILER_FLAG("-mno-avx512fp16" SUPPORTS_MNO_AVX512FP16)
237+
if (SUPPORTS_MNO_AVX512FP16)
238+
add_compile_options($<$<COMPILE_LANGUAGE:Fortran>:-mno-avx512fp16>)
239+
endif()
240+
else()
241+
CHECK_FORTRAN_COMPILER_FLAG("-mcpu=native" SUPPORTS_MCPU_NATIVE)
242+
if (SUPPORTS_MCPU_NATIVE)
243+
add_compile_options($<$<COMPILE_LANGUAGE:Fortran>:-mcpu=native>)
244+
endif()
234245
endif()
235246
endif()
236247

0 commit comments

Comments
 (0)