Skip to content

Commit 8e9d100

Browse files
authored
make test-rapids-build-times.yml smaller, do cached tests in same job (#656)
1 parent 4255420 commit 8e9d100

1 file changed

Lines changed: 128 additions & 43 deletions

File tree

Lines changed: 128 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,149 @@
11
name: Test RAPIDS build times
22

3-
concurrency:
4-
group: test-rapids-build-times-from-${{ github.ref_name }}
5-
cancel-in-progress: true
6-
73
on:
84
workflow_dispatch:
95
inputs:
106
branch:
117
type: string
128
required: false
139
default: main
10+
node_type:
11+
type: string
12+
required: false
13+
default: cpu32
1414

1515
jobs:
16-
uncached-builds:
16+
check-event:
17+
name: Check GH Event
18+
runs-on: ubuntu-latest
19+
outputs:
20+
ok: ${{ steps.check_gh_event.outputs.ok }}
21+
steps:
22+
- id: check_gh_event
23+
name: Check GH Event
24+
shell: bash
25+
run: |
26+
[[ '${{ github.event_name }}' == 'workflow_dispatch' && '${{ github.repository }}' == 'rapidsai/devcontainers' ]] || \
27+
&& echo "ok=true" | tee -a "$GITHUB_OUTPUT" \
28+
|| echo "ok=false" | tee -a "$GITHUB_OUTPUT";
29+
30+
test-rapids-build-times:
1731
name: ${{ matrix.name }}
32+
if: needs.check-event.outputs.ok == 'true'
33+
needs: check-event
1834
secrets: inherit
19-
uses: ./.github/workflows/build-all-rapids-repos.yml
20-
with:
21-
branch: ${{ inputs.branch }}
22-
env: ${{ matrix.env }}
23-
matrix: '{ "include": [{ "libs": "" }] }'
24-
node_type: cpu32
35+
uses: rapidsai/shared-workflows/.github/workflows/build-in-devcontainer.yaml@main
36+
permissions:
37+
actions: read
38+
packages: read
39+
id-token: write
40+
contents: read
41+
pull-requests: read
2542
strategy:
2643
fail-fast: false
2744
matrix:
2845
include:
29-
- name: 'no sccache'
30-
env: |
31-
PARALLEL_LEVEL=
32-
DISABLE_SCCACHE=1
33-
SCCACHE_NO_CACHE=1
34-
SCCACHE_NO_DIST_COMPILE=1
35-
MAX_DEVICE_OBJ_TO_COMPILE_IN_PARALLEL=1
36-
- name: 'recache, local'
46+
- name: 'build cluster: no'
3747
env: |
38-
SCCACHE_RECACHE=1
3948
SCCACHE_NO_DIST_COMPILE=1
40-
MAX_DEVICE_OBJ_TO_COMPILE_IN_PARALLEL=1
41-
- name: 'recache, remote'
42-
env: |
43-
SCCACHE_RECACHE=1
49+
MAX_DEVICE_OBJ_TO_COMPILE_IN_PARALLEL=2
50+
- name: 'build cluster: yes'
51+
env: ""
4452

45-
cached-builds:
46-
name: ${{ matrix.name }}
47-
needs: [uncached-builds]
48-
secrets: inherit
49-
uses: ./.github/workflows/build-all-rapids-repos.yml
5053
with:
51-
branch: ${{ inputs.branch }}
52-
env: ${{ matrix.env }}
53-
matrix: '{ "include": [{ "libs": "" }] }'
54-
node_type: cpu32
55-
strategy:
56-
fail-fast: false
57-
matrix:
58-
include:
59-
- name: 'preprocessor cache'
60-
env: |
61-
SCCACHE_S3_USE_PREPROCESSOR_CACHE_MODE=1
62-
- name: 'no preprocessor cache'
63-
env: |
64-
SCCACHE_S3_USE_PREPROCESSOR_CACHE_MODE=0
54+
arch: '["amd64", "arm64"]'
55+
cuda: '["12.9", "13.1"]'
56+
node_type: ${{ inputs.node_type }}
57+
rapids-aux-secret-1: GIST_REPO_READ_ORG_GITHUB_TOKEN
58+
timeout-minutes: 720
59+
# 1. Prohibit sccache from shutting down automatically
60+
# 2. Infinitely retry transient errors
61+
# 3. Enable debug logging to track cache misses
62+
# 4. Never fallback to locally compiling
63+
# 5. Use RAPIDS_AUX_SECRET_1 as the sccache-dist auth token
64+
env: |
65+
CONDA_ENV_CREATE_QUIET=1
66+
PARALLEL_LEVEL=0
67+
SCCACHE_IDLE_TIMEOUT=0
68+
SCCACHE_SERVER_LOG=sccache=debug
69+
SCCACHE_DIST_MAX_RETRIES=inf
70+
SCCACHE_DIST_FALLBACK_TO_LOCAL_COMPILE=false
71+
SCCACHE_DIST_AUTH_TOKEN_VAR=RAPIDS_AUX_SECRET_1
72+
${{ matrix.env }}
73+
build_command: |
74+
function begin_group() {
75+
local blue="34"
76+
echo -e "::group::\e[${blue}m${1:-}\e[0m"
77+
}
78+
79+
function end_group() {
80+
local name="${1:-}"
81+
local build_status="${2:-0}"
82+
local red="31"
83+
84+
echo "::endgroup::"
85+
if [ "$build_status" -ne 0 ]; then
86+
echo -e "::error::\e[${red}m ${name} - Failed (⬆️ click above for full log ⬆️)\e[0m"
87+
fi
88+
}
89+
90+
function run_command() {
91+
local -;
92+
set -euo pipefail;
93+
94+
local group="${1:-}";
95+
shift;
96+
local command=("$@");
97+
local exit_code="0";
98+
99+
begin_group "$group";
100+
101+
echo "Working directory: $(pwd)";
102+
echo "Running command: ${command[*]}";
103+
"${command[@]}" || exit_code=$?;
104+
105+
end_group "$group" "$exit_code"
106+
107+
return "$exit_code"
108+
}
109+
110+
# Clone all the repos
111+
run_command "Clone RAPIDS repositories" \
112+
clone-all -j$(nproc) -b ${{ inputs.branch }} -v -q --clone-upstream --depth 1 --single-branch --shallow-submodules --no-update-env;
113+
114+
run_command "Create RAPIDS python environment" \
115+
rapids-post-start-command;
116+
117+
# Configure all the C++ libs
118+
run_command "Configure C++ libraries" \
119+
time configure-all \
120+
-j${PARALLEL_LEVEL} \
121+
-GNinja \
122+
-Wno-dev \
123+
-DBUILD_TESTS=ON \
124+
-DBUILD_BENCHMARKS=ON \
125+
-DBUILD_PRIMS_BENCH=ON \
126+
-DBUILD_SHARED_LIBS=ON \
127+
-DRAFT_COMPILE_LIBRARY=ON \
128+
-DBUILD_CUGRAPH_MG_TESTS=ON
129+
130+
for ENVVAR in "SCCACHE_RECACHE=1" \
131+
"SCCACHE_S3_USE_PREPROCESSOR_CACHE_MODE=0" \
132+
"SCCACHE_S3_USE_PREPROCESSOR_CACHE_MODE=1" ; do
133+
134+
# Build all the C++ libs
135+
run_command "Build C++ libraries (${ENVVAR})" time ${ENVVAR} build-all-cpp -j${PARALLEL_LEVEL}
136+
137+
# Print cache and dist stats
138+
run_command "sccache stats (${ENVVAR})" sccache --show-adv-stats
139+
140+
# Print build times
141+
run_command "Build times (${ENVVAR})" bash -c "\
142+
find /var/log/devcontainer-utils/ -type f -name 'build-*-time.log' -print0 \
143+
| xargs -0 -n1 grep -H real | sed 's/real\t/ /g' || :" # Nonfatal if not found
144+
145+
# Clean
146+
sccache -z >/dev/null 2>&1
147+
find /var/log/devcontainer-utils/ -type f -name 'build-*-time.log' -delete
148+
find ~/ -maxdepth 4 -type l -path '*/cpp/build/latest' -print0 | xargs -P$(nproc) -0 -n1 ninja clean -C
149+
done

0 commit comments

Comments
 (0)