Skip to content

Commit a22f206

Browse files
committed
Add --deps-only flag to separate dependency fetching from source builds
This allows CI to fetch and build dependencies (FFTW, HDF5, etc.) on login nodes with internet access, then build MFC source code on compute nodes that may have no network connectivity. Key changes: - New --deps-only CLI flag for ./mfc.sh build - Already-configured dependencies are skipped entirely during regular builds, guaranteeing no network access in the source build step - Frontier and Frontier AMD now follow the pattern: deps on login node, source build + test on compute node
1 parent 90d4b6e commit a22f206

7 files changed

Lines changed: 61 additions & 33 deletions

File tree

.github/workflows/bench.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,23 @@ jobs:
6868
flag: f
6969
device: gpu
7070
interface: acc
71-
build_script: "bash .github/workflows/frontier/build.sh gpu acc bench"
71+
build_script: "bash .github/workflows/frontier/build.sh gpu acc"
7272
- cluster: frontier
7373
name: Oak Ridge | Frontier (CCE)
7474
group: phoenix
7575
labels: frontier
7676
flag: f
7777
device: gpu
7878
interface: omp
79-
build_script: "bash .github/workflows/frontier/build.sh gpu omp bench"
79+
build_script: "bash .github/workflows/frontier/build.sh gpu omp"
8080
- cluster: frontier_amd
8181
name: Oak Ridge | Frontier (AMD)
8282
group: phoenix
8383
labels: frontier
8484
flag: famd
8585
device: gpu
8686
interface: omp
87-
build_script: "bash .github/workflows/frontier_amd/build.sh gpu omp bench"
87+
build_script: "bash .github/workflows/frontier_amd/build.sh gpu omp"
8888
continue-on-error: ${{ matrix.cluster == 'frontier' || matrix.cluster == 'frontier_amd' }}
8989
runs-on:
9090
group: ${{ matrix.group }}
@@ -103,7 +103,7 @@ jobs:
103103
ref: master
104104
path: master
105105

106-
- name: Setup & Build
106+
- name: Fetch Dependencies
107107
if: matrix.build_script != ''
108108
timeout-minutes: 150
109109
run: |

.github/workflows/common/bench.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ if [ "$job_cluster" = "phoenix" ]; then
2121
trap 'rm -rf "$currentdir" || true' EXIT
2222
fi
2323

24-
# --- Build (if not pre-built on login node) ---
25-
# Phoenix builds inside SLURM; Frontier pre-builds via build.sh on the login node.
24+
# --- Build ---
25+
# Phoenix builds everything inside SLURM (no login-node build step).
26+
# Frontier/Frontier AMD: deps already fetched on login node via --deps-only;
27+
# source code is built here on the compute node.
2628
# Phoenix: always nuke stale builds (heterogeneous compute nodes → ISA mismatch risk).
2729
if [ "$job_cluster" = "phoenix" ]; then
2830
source .github/scripts/clean-build.sh
2931
clean_build
3032
fi
3133

32-
if [ ! -d "build" ]; then
33-
source .github/scripts/retry-build.sh
34-
retry_build ./mfc.sh build -j $n_jobs $build_opts || exit 1
35-
fi
34+
source .github/scripts/retry-build.sh
35+
retry_build ./mfc.sh build -j $n_jobs $build_opts || exit 1
3636

3737
# --- Bench cluster flag ---
3838
if [ "$job_cluster" = "phoenix" ]; then

.github/workflows/common/test.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,29 @@ if [ "$job_cluster" = "phoenix" ]; then
2121
trap 'rm -rf "$currentdir" || true' EXIT
2222
fi
2323

24-
# --- Build (if not pre-built on login node) ---
25-
# Phoenix builds inside SLURM; Frontier pre-builds via build.sh on the login node.
26-
# Phoenix builds inside SLURM on heterogeneous compute nodes — always start fresh
27-
# to avoid SIGILL from stale binaries compiled on a different microarchitecture.
24+
# --- Build ---
25+
# Phoenix builds everything inside SLURM (no login-node build step).
26+
# Frontier/Frontier AMD: deps already fetched on login node via --deps-only;
27+
# source code is built here on the compute node.
28+
# Phoenix: always start fresh to avoid SIGILL from stale binaries compiled
29+
# on a different microarchitecture.
2830
if [ "$job_cluster" = "phoenix" ]; then
2931
source .github/scripts/clean-build.sh
3032
clean_build
3133
fi
3234

33-
if [ ! -d "build" ]; then
34-
source .github/scripts/retry-build.sh
35+
source .github/scripts/retry-build.sh
3536

36-
# Phoenix: smoke-test the syscheck binary to catch architecture mismatches
37-
# (SIGILL from binaries compiled on a different compute node).
38-
validate_cmd=""
39-
if [ "$job_cluster" = "phoenix" ]; then
40-
validate_cmd='syscheck_bin=$(find build/install -name syscheck -type f 2>/dev/null | head -1); [ -z "$syscheck_bin" ] || "$syscheck_bin" > /dev/null 2>&1'
41-
fi
42-
43-
RETRY_VALIDATE_CMD="$validate_cmd" \
44-
retry_build ./mfc.sh test -v --dry-run -j 8 $build_opts || exit 1
37+
# Phoenix: smoke-test the syscheck binary to catch architecture mismatches
38+
# (SIGILL from binaries compiled on a different compute node).
39+
validate_cmd=""
40+
if [ "$job_cluster" = "phoenix" ]; then
41+
validate_cmd='syscheck_bin=$(find build/install -name syscheck -type f 2>/dev/null | head -1); [ -z "$syscheck_bin" ] || "$syscheck_bin" > /dev/null 2>&1'
4542
fi
4643

44+
RETRY_VALIDATE_CMD="$validate_cmd" \
45+
retry_build ./mfc.sh test -v --dry-run -j 8 $build_opts || exit 1
46+
4747
# --- GPU detection and thread count ---
4848
device_opts=""
4949
rdma_opts=""

.github/workflows/frontier/build.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ esac
1414

1515
job_device=$1
1616
job_interface=$2
17-
run_bench=$3
1817
source .github/scripts/gpu-opts.sh
1918
build_opts="$gpu_opts"
2019

@@ -24,8 +23,4 @@ source .github/scripts/clean-build.sh
2423
clean_build
2524

2625
source .github/scripts/retry-build.sh
27-
if [ "$run_bench" == "bench" ]; then
28-
retry_build ./mfc.sh build -j 8 $build_opts || exit 1
29-
else
30-
retry_build ./mfc.sh test -v -a --dry-run $([ "$cluster_name" = "frontier" ] && echo "--rdma-mpi") -j 8 $build_opts || exit 1
31-
fi
26+
retry_build ./mfc.sh build --deps-only -j 8 $build_opts || exit 1

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,12 @@ jobs:
400400
echo "Coverage cache: none available — full test suite will run"
401401
fi
402402
403-
- name: Build (login node)
403+
- name: Fetch Dependencies
404404
if: matrix.cluster != 'phoenix'
405405
timeout-minutes: 60
406406
run: bash .github/workflows/${{ matrix.cluster }}/build.sh ${{ matrix.device }} ${{ matrix.interface }}
407407

408-
- name: Test
408+
- name: Build & Test
409409
run: bash .github/scripts/submit-slurm-job.sh .github/workflows/common/test.sh ${{ matrix.device }} ${{ matrix.interface }} ${{ matrix.cluster }} ${{ matrix.shard }}
410410

411411
- name: Cancel SLURM Jobs

toolchain/mfc/build.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,12 @@ def __build_target(target: typing.Union[MFCTarget, str], case: input.MFCInputFil
552552

553553
history.add(target.name)
554554

555+
# Dependencies are pinned to fixed versions. If already configured
556+
# (built & installed by a prior --deps-only step), skip entirely
557+
# to avoid re-entering the superbuild (which may access the network).
558+
if target.isDependency and target.is_configured(case):
559+
return
560+
555561
for dep in target.requires.compute():
556562
# If we have already built and installed this target,
557563
# do not do so again. This can be inferred by whether
@@ -594,6 +600,26 @@ def build(targets=None, case: input.MFCInputFile = None, history: typing.Set[str
594600
case = case or input.load(ARG("input"), ARG("--"), {})
595601
case.validate_params()
596602

603+
if ARG("deps_only", False):
604+
all_deps = set()
605+
for t in targets:
606+
resolved = get_target(t)
607+
for dep in resolved.requires.compute():
608+
all_deps.add(dep)
609+
610+
if len(history) == 0:
611+
cons.print(f"[bold]Fetch Dependencies | {format_list_to_string([d.name for d in all_deps], 'magenta', 'None')}[/bold]")
612+
cons.print(no_indent=True)
613+
614+
if not all_deps:
615+
cons.print("[yellow]No dependencies to build for the requested targets.[/yellow]")
616+
return
617+
618+
for dep in all_deps:
619+
__build_target(dep, case, history)
620+
621+
return
622+
597623
if len(history) == 0:
598624
cons.print(__generate_header(case, targets))
599625
cons.print(no_indent=True)

toolchain/mfc/cli/commands.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@
134134
default=False,
135135
dest="case_optimization",
136136
),
137+
Argument(
138+
name="deps-only",
139+
help="Only fetch and build dependencies, do not build MFC targets.",
140+
action=ArgAction.STORE_TRUE,
141+
default=False,
142+
dest="deps_only",
143+
),
137144
],
138145
examples=[
139146
Example("./mfc.sh build", "Build all default targets (CPU)"),

0 commit comments

Comments
 (0)