diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml index f5d6aae12..0db9fec31 100644 --- a/.github/workflows/build-wheel.yml +++ b/.github/workflows/build-wheel.yml @@ -44,19 +44,24 @@ jobs: with: fetch-depth: 0 - # The env vars ACTIONS_CACHE_SERVICE_V2, ACTIONS_RESULTS_URL, and ACTIONS_RUNTIME_TOKEN - # are exposed by this action. - - name: Enable sccache + - name: Install latest rapidsai/sccache if: ${{ startsWith(inputs.host-platform, 'linux') }} - uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # 0.0.9 + run: | + curl -fsSL "https://github.com/rapidsai/sccache/releases/latest/download/sccache-$(uname -m)-unknown-linux-musl.tar.gz" \ + | sudo tar -C /usr/local/bin -xvzf - --wildcards --strip-components=1 -x '*/sccache' + echo "SCCACHE_PATH=/usr/local/bin/sccache" >> "$GITHUB_ENV" + echo "SCCACHE_GHA_USE_PREPROCESSOR_CACHE_MODE=true" >> "$GITHUB_ENV" # xref: https://github.com/orgs/community/discussions/42856#discussioncomment-7678867 - name: Adding addtional GHA cache-related env vars - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL']) - core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL']) + core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on'); + core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'] || ''); + core.exportVariable('ACTIONS_RESULTS_URL', process.env['ACTIONS_RESULTS_URL'] || ''); + core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL'] || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'] || ''); - name: Setup proxy cache uses: nv-gha-runners/setup-proxy-cache@main @@ -104,11 +109,10 @@ jobs: ACTIONS_RESULTS_URL=${{ env.ACTIONS_RESULTS_URL }} ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }} ACTIONS_CACHE_SERVICE_V2=${{ env.ACTIONS_CACHE_SERVICE_V2 }} - SCCACHE_DIR=/host/${{ env.SCCACHE_DIR }} - SCCACHE_CACHE_SIZE=${{ env.SCCACHE_CACHE_SIZE }} + SCCACHE_GHA_USE_PREPROCESSOR_CACHE_MODE=${{ env.SCCACHE_GHA_USE_PREPROCESSOR_CACHE_MODE }} # check cache stats before leaving cibuildwheel CIBW_BEFORE_TEST_LINUX: > - "/host/${{ env.SCCACHE_PATH }}" --show-stats + "/host/${{ env.SCCACHE_PATH }}" --show-adv-stats # force the test stage to be run (so that before-test is not skipped) # TODO: we might want to think twice on adding this, it does a lot of # things before reaching this command. @@ -154,19 +158,24 @@ jobs: with: fetch-depth: 0 - # The env vars ACTIONS_CACHE_SERVICE_V2, ACTIONS_RESULTS_URL, and ACTIONS_RUNTIME_TOKEN - # are exposed by this action. - - name: Enable sccache + - name: Install latest rapidsai/sccache if: ${{ startsWith(inputs.host-platform, 'linux') }} - uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # 0.0.9 + run: | + curl -fsSL "https://github.com/rapidsai/sccache/releases/latest/download/sccache-$(uname -m)-unknown-linux-musl.tar.gz" \ + | sudo tar -C /usr/local/bin -xvzf - --wildcards --strip-components=1 -x '*/sccache' + echo "SCCACHE_PATH=/usr/local/bin/sccache" >> "$GITHUB_ENV" + echo "SCCACHE_GHA_USE_PREPROCESSOR_CACHE_MODE=true" >> "$GITHUB_ENV" # xref: https://github.com/orgs/community/discussions/42856#discussioncomment-7678867 - name: Adding addtional GHA cache-related env vars - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL']) - core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL']) + core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on'); + core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'] || ''); + core.exportVariable('ACTIONS_RESULTS_URL', process.env['ACTIONS_RESULTS_URL'] || ''); + core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL'] || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'] || ''); - name: Setup proxy cache uses: nv-gha-runners/setup-proxy-cache@main @@ -227,8 +236,8 @@ jobs: run: | pushd testing if [[ "${{ inputs.host-platform }}" == linux* ]]; then - PATH=$(dirname ${SCCACHE_PATH}):${PATH} - SCCACHE_GHA_ENABLED=true + export PATH=$(dirname ${SCCACHE_PATH}):${PATH} + export SCCACHE_GHA_ENABLED=true fi nvcc --version @@ -247,6 +256,10 @@ jobs: done popd + if [[ "${{ inputs.host-platform }}" == linux* ]]; then + "${SCCACHE_PATH}" --show-adv-stats + fi + - name: Upload numba-cuda test artifacts uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: diff --git a/ci/tools/env-vars b/ci/tools/env-vars index 83f1145a1..42640debc 100755 --- a/ci/tools/env-vars +++ b/ci/tools/env-vars @@ -36,9 +36,6 @@ if [[ "${1}" == "build" ]]; then # here we only need to specify the python version we want echo "CIBW_BUILD=cp${PYTHON_VERSION_FORMATTED}-*" >> $GITHUB_ENV NUMBA_CUDA_ARTIFACT_BASENAME="numba-cuda-python${PYTHON_VERSION_FORMATTED}-${HOST_PLATFORM}" - # Enforce an explicit cache dir so that we can reuse this path later - echo "SCCACHE_DIR=${HOME}/.cache/sccache" >> $GITHUB_ENV - echo "SCCACHE_CACHE_SIZE=1G" >> $GITHUB_ENV elif [[ "${1}" == "test" ]]; then TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${CUDA_VER})" TEST_CUDA_MINOR="$(cut -d '.' -f 2 <<< ${CUDA_VER})" diff --git a/testing/Makefile b/testing/Makefile index be015e962..014413407 100644 --- a/testing/Makefile +++ b/testing/Makefile @@ -31,7 +31,7 @@ MULTI_FATBIN_GENCODE := $(MULTI_GENCODE) -gencode arch=compute_$(ALT_CC),code=[s # LTO-IR tests need to generate for the LTO "architecture" instead LTOIR_GENCODE := -gencode arch=lto_$(GPU_CC),code=lto_$(GPU_CC) -# In CI we use sccache. Note that sccache does not support generating fatbin or ltoir. +# In CI we use sccache ifeq ($(shell command -v sccache 2>&1 >/dev/null; echo $$?),0) SCCACHE := sccache else @@ -62,10 +62,10 @@ $(OUTPUT_DIR)/test_device_functions.cubin: test_device_functions.cu $(SCCACHE) nvcc $(NVCC_FLAGS) $(CUBIN_FLAGS) -o $@ $< $(OUTPUT_DIR)/test_device_functions.fatbin: test_device_functions.cu - nvcc $(NVCC_FLAGS) $(FATBIN_FLAGS) -o $@ $< + $(SCCACHE) nvcc $(NVCC_FLAGS) $(FATBIN_FLAGS) -o $@ $< $(OUTPUT_DIR)/test_device_functions_multi.fatbin: test_device_functions.cu - nvcc $(NVCC_FLAGS) $(MULTI_FATBIN_FLAGS) -o $@ $< + $(SCCACHE) nvcc $(NVCC_FLAGS) $(MULTI_FATBIN_FLAGS) -o $@ $< $(OUTPUT_DIR)/test_device_functions.ptx: test_device_functions.cu $(SCCACHE) nvcc $(NVCC_FLAGS) $(PTX_FLAGS) -o $@ $< @@ -77,7 +77,7 @@ $(OUTPUT_DIR)/test_device_functions.a: test_device_functions.cu nvcc $(NVCC_FLAGS) $(LIBRARY_FLAGS) -o $@ $< $(OUTPUT_DIR)/test_device_functions.ltoir.o: test_device_functions.cu - nvcc $(NVCC_FLAGS) $(LTOIR_FLAGS) -o $@ $< + $(SCCACHE) nvcc $(NVCC_FLAGS) $(LTOIR_FLAGS) -o $@ $< $(OUTPUT_DIR)/test_device_functions.ltoir: test_device_functions.cu # Generate LTO-IR in a "raw" LTO-IR container @@ -96,10 +96,10 @@ $(OUTPUT_DIR)/nrt_extern.cubin: nrt_extern.cu $(SCCACHE) nvcc $(NVCC_FLAGS) $(CUBIN_FLAGS) -o $@ $< -I$(NRT_INCLUDE_DIR) $(OUTPUT_DIR)/nrt_extern.fatbin: nrt_extern.cu - nvcc $(NVCC_FLAGS) $(FATBIN_FLAGS) -o $@ $< -I$(NRT_INCLUDE_DIR) + $(SCCACHE) nvcc $(NVCC_FLAGS) $(FATBIN_FLAGS) -o $@ $< -I$(NRT_INCLUDE_DIR) $(OUTPUT_DIR)/nrt_extern_multi.fatbin: nrt_extern.cu - nvcc $(NVCC_FLAGS) $(MULTI_FATBIN_FLAGS) -o $@ $< -I$(NRT_INCLUDE_DIR) + $(SCCACHE) nvcc $(NVCC_FLAGS) $(MULTI_FATBIN_FLAGS) -o $@ $< -I$(NRT_INCLUDE_DIR) $(OUTPUT_DIR)/nrt_extern.ptx: nrt_extern.cu $(SCCACHE) nvcc $(NVCC_FLAGS) $(PTX_FLAGS) -o $@ $< -I$(NRT_INCLUDE_DIR) @@ -111,7 +111,7 @@ $(OUTPUT_DIR)/nrt_extern.a: nrt_extern.cu nvcc $(NVCC_FLAGS) $(LIBRARY_FLAGS) -o $@ $< -I$(NRT_INCLUDE_DIR) $(OUTPUT_DIR)/nrt_extern.ltoir.o: nrt_extern.cu - nvcc $(NVCC_FLAGS) $(LTOIR_FLAGS) -o $@ $< -I$(NRT_INCLUDE_DIR) + $(SCCACHE) nvcc $(NVCC_FLAGS) $(LTOIR_FLAGS) -o $@ $< -I$(NRT_INCLUDE_DIR) $(OUTPUT_DIR)/nrt_extern.ltoir: nrt_extern.cu python generate_raw_ltoir.py --arch sm_$(GPU_CC) -o $@ $< --nrt