From 94ad53f134150e7a2aac37d2bb8f64a8b026e7a7 Mon Sep 17 00:00:00 2001 From: Allison Piper Date: Sat, 4 May 2024 18:25:49 +0000 Subject: [PATCH] Reuse CCCL's new CI infrastructure --- .github/actions/compute-matrix/action.yml | 25 -- .../actions/compute-matrix/compute-matrix.sh | 44 --- .../actions/configure_cccl_sccache/action.yml | 19 -- .github/workflows/build-and-test-linux.yml | 32 -- .github/workflows/build-and-test-windows.yml | 49 --- .github/workflows/ci-workflow-nightly.yml | 119 ++++++++ .../workflows/ci-workflow-pull-request.yml | 127 ++++++++ .github/workflows/dispatch-build-and-test.yml | 51 ---- .github/workflows/pr.yml | 95 ------ .github/workflows/run-as-coder.yml | 67 ----- .github/workflows/verify-devcontainers.yml | 94 ------ ci/matrix.yaml | 280 ++++++++++++++---- 12 files changed, 467 insertions(+), 535 deletions(-) delete mode 100644 .github/actions/compute-matrix/action.yml delete mode 100755 .github/actions/compute-matrix/compute-matrix.sh delete mode 100644 .github/actions/configure_cccl_sccache/action.yml delete mode 100644 .github/workflows/build-and-test-linux.yml delete mode 100644 .github/workflows/build-and-test-windows.yml create mode 100644 .github/workflows/ci-workflow-nightly.yml create mode 100644 .github/workflows/ci-workflow-pull-request.yml delete mode 100644 .github/workflows/dispatch-build-and-test.yml delete mode 100644 .github/workflows/pr.yml delete mode 100644 .github/workflows/run-as-coder.yml delete mode 100644 .github/workflows/verify-devcontainers.yml diff --git a/.github/actions/compute-matrix/action.yml b/.github/actions/compute-matrix/action.yml deleted file mode 100644 index b8155e7..0000000 --- a/.github/actions/compute-matrix/action.yml +++ /dev/null @@ -1,25 +0,0 @@ - -name: Compute Matrix -description: "Compute the matrix for a given matrix type from the specified matrix file" - -inputs: - matrix_query: - description: "The jq query used to specify the desired matrix. e.g., .pull_request.nvcc" - required: true - matrix_file: - description: 'The file containing the matrix' - required: true -outputs: - matrix: - description: 'The requested matrix' - value: ${{ steps.compute-matrix.outputs.MATRIX }} - -runs: - using: "composite" - steps: - - name: Compute matrix - id: compute-matrix - run: | - MATRIX=$(./.github/actions/compute-matrix/compute-matrix.sh ${{inputs.matrix_file}} ${{inputs.matrix_query}} ) - echo "matrix=$MATRIX" | tee -a $GITHUB_OUTPUT - shell: bash -euxo pipefail {0} diff --git a/.github/actions/compute-matrix/compute-matrix.sh b/.github/actions/compute-matrix/compute-matrix.sh deleted file mode 100755 index cd3946f..0000000 --- a/.github/actions/compute-matrix/compute-matrix.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -write_output() { - local key="$1" - local value="$2" - echo "$key=$value" | tee --append "${GITHUB_OUTPUT:-/dev/null}" -} - -extract_matrix() { - local file="$1" - local type="$2" - local matrix=$(yq -o=json "$file" | jq -cr ".$type") - write_output "DEVCONTAINER_VERSION" "$(yq -o json "$file" | jq -cr '.devcontainer_version')" - - local nvcc_full_matrix="$(echo "$matrix" | jq -cr '.nvcc')" - local per_cuda_compiler_matrix="$(echo "$nvcc_full_matrix" | jq -cr ' group_by(.cuda + .compiler.name) | map({(.[0].cuda + "-" + .[0].compiler.name): .}) | add')" - write_output "PER_CUDA_COMPILER_MATRIX" "$per_cuda_compiler_matrix" - write_output "PER_CUDA_COMPILER_KEYS" "$(echo "$per_cuda_compiler_matrix" | jq -r 'keys | @json')" -} - -main() { - if [ "$1" == "-v" ]; then - set -x - shift - fi - - if [ $# -ne 2 ] || [ "$2" != "pull_request" ]; then - echo "Usage: $0 [-v] MATRIX_FILE MATRIX_TYPE" - echo " -v : Enable verbose output" - echo " MATRIX_FILE : The path to the matrix file." - echo " MATRIX_TYPE : The desired matrix. Supported values: 'pull_request'" - exit 1 - fi - - echo "Input matrix file:" >&2 - cat "$1" >&2 - echo "Matrix Type: $2" >&2 - - extract_matrix "$1" "$2" -} - -main "$@" diff --git a/.github/actions/configure_cccl_sccache/action.yml b/.github/actions/configure_cccl_sccache/action.yml deleted file mode 100644 index 1b42fc9..0000000 --- a/.github/actions/configure_cccl_sccache/action.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Set up AWS credentials and environment variables for sccache -description: "Set up AWS credentials and environment variables for sccache" -runs: - using: "composite" - steps: - - name: Get AWS credentials for sccache bucket - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-NVIDIA - aws-region: us-east-2 - role-duration-seconds: 43200 # 12 hours) - - name: Set environment variables - run: | - echo "SCCACHE_BUCKET=rapids-sccache-devs" >> $GITHUB_ENV - echo "SCCACHE_REGION=us-east-2" >> $GITHUB_ENV - echo "SCCACHE_IDLE_TIMEOUT=32768" >> $GITHUB_ENV - echo "SCCACHE_S3_USE_SSL=true" >> $GITHUB_ENV - echo "SCCACHE_S3_NO_CREDENTIALS=false" >> $GITHUB_ENV - shell: bash diff --git a/.github/workflows/build-and-test-linux.yml b/.github/workflows/build-and-test-linux.yml deleted file mode 100644 index 0a9d23e..0000000 --- a/.github/workflows/build-and-test-linux.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: build and test - -defaults: - run: - shell: bash -exo pipefail {0} - -on: - workflow_call: - inputs: - cpu: {type: string, required: true} - test_name: {type: string, required: false} - build_script: {type: string, required: false} - test_script: {type: string, required: false} - container_image: {type: string, required: false} - run_tests: {type: boolean, required: false, default: true} - -permissions: - contents: read - -jobs: - build-and-test: - name: Build/Test ${{inputs.test_name}} - permissions: - id-token: write - contents: read - uses: ./.github/workflows/run-as-coder.yml - with: - name: Build/Test ${{inputs.test_name}} - runner: linux-${{inputs.cpu}}-gpu-v100-latest-1 - image: ${{ inputs.container_image }} - command: | - ${{ inputs.test_script }} diff --git a/.github/workflows/build-and-test-windows.yml b/.github/workflows/build-and-test-windows.yml deleted file mode 100644 index 23f3e3f..0000000 --- a/.github/workflows/build-and-test-windows.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Build Windows - -on: - workflow_call: - inputs: - test_name: {type: string, required: false} - build_script: {type: string, required: false} - test_script: {type: string, required: false} - container_image: {type: string, required: false} - -jobs: - prepare: - name: Build Only ${{inputs.test_name}} - runs-on: windows-amd64-cpu16 - permissions: - id-token: write - contents: read - env: - SCCACHE_BUCKET: rapids-sccache-devs - SCCACHE_REGION: us-east-2 - SCCACHE_IDLE_TIMEOUT: 0 - SCCACHE_S3_USE_SSL: true - SCCACHE_S3_NO_CREDENTIALS: false - steps: - - name: Get AWS credentials for sccache bucket - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-NVIDIA - aws-region: us-east-2 - role-duration-seconds: 43200 # 12 hours - - name: Fetch ${{ inputs.container_image }} - shell: powershell - run: docker pull ${{ inputs.container_image }} - - name: Run the tests - shell: powershell - run: >- - docker run ${{ inputs.container_image }} powershell -c "[System.Environment]::SetEnvironmentVariable('AWS_ACCESS_KEY_ID','${{env.AWS_ACCESS_KEY_ID}}') - [System.Environment]::SetEnvironmentVariable('AWS_SECRET_ACCESS_KEY','${{env.AWS_SECRET_ACCESS_KEY}}') - [System.Environment]::SetEnvironmentVariable('AWS_SESSION_TOKEN','${{env.AWS_SESSION_TOKEN }}') - [System.Environment]::SetEnvironmentVariable('SCCACHE_BUCKET','${{env.SCCACHE_BUCKET}}') - [System.Environment]::SetEnvironmentVariable('SCCACHE_REGION','${{env.SCCACHE_REGION}}') - [System.Environment]::SetEnvironmentVariable('SCCACHE_IDLE_TIMEOUT','${{env.SCCACHE_IDLE_TIMEOUT}}') - [System.Environment]::SetEnvironmentVariable('SCCACHE_S3_USE_SSL','${{env.SCCACHE_S3_USE_SSL}}') - [System.Environment]::SetEnvironmentVariable('SCCACHE_S3_NO_CREDENTIALS','${{env.SCCACHE_S3_NO_CREDENTIALS}}') - git clone https://github.com/NVIDIA/nvbench.git; - cd nvbench; - git fetch --all; - git checkout ${{github.ref_name}}; - ${{inputs.build_script}};" diff --git a/.github/workflows/ci-workflow-nightly.yml b/.github/workflows/ci-workflow-nightly.yml new file mode 100644 index 0000000..13a3c3d --- /dev/null +++ b/.github/workflows/ci-workflow-nightly.yml @@ -0,0 +1,119 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This is the main workflow that runs on every PR and push to main +name: nightly + +defaults: + run: + shell: bash --noprofile --norc -euo pipefail {0} + +on: + # !! DISABLED HERE !! + # Update to use the schedule to enable. + workflow_dispatch: + # schedule: + # - cron: '0 7 * * *' # 7AM UTC, 12AM PST, 3AM EST + +concurrency: + group: ${{ github.workflow }}-on-${{ github.event_name }}-from-${{ github.ref_name }} + +jobs: + + build-workflow: + name: Build workflow from matrix + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + workflow: ${{ steps.build-workflow.outputs.workflow }} + workflow_keys: ${{ steps.build-workflow.outputs.workflow_keys }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Build workflow + id: build-workflow + uses: NVIDIA/cccl/.github/actions/workflow-build@b3ef1e6a87e0eee7c382f5e6e474e9cfa1c44c36 + with: + workflows: nightly + + run-workflow: + name: ${{ matrix.name }} + needs: build-workflow + permissions: + id-token: write + contents: read + strategy: + fail-fast: false + matrix: + name: ${{ fromJSON(needs.build-workflow.outputs.workflow_keys) }} + uses: NVIDIA/cccl/.github/workflows/workflow-dispatch.yml@b3ef1e6a87e0eee7c382f5e6e474e9cfa1c44c36 + with: + name: ${{ matrix.name }} + jobs: ${{ toJSON(fromJSON(needs.build-workflow.outputs.workflow)[matrix.name]) }} + + # This job acts as a sentry and will fail if any leaf job in the workflow tree fails, as + # run-workflow always succeeds. Use this job when checking for successful matrix workflow job completion. + verify-workflow: + name: Verify and summarize workflow results + if: ${{ always() && !cancelled() }} + needs: + - build-workflow + - run-workflow + permissions: + contents: read + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Check workflow success + id: check-workflow + uses: NVIDIA/cccl/.github/actions/workflow-results@b3ef1e6a87e0eee7c382f5e6e474e9cfa1c44c36 + + # Check all other job statuses. This job gates branch protection checks. + ci: + name: CI + # !! Important: This job is used for branch protection checks. + # !! Need to use always() instead of !cancelled() because skipped jobs count as success + # !! for Github branch protection checks. Yes, really: by default, branch protections + # !! can be bypassed by cancelling CI. See NVIDIA/cccl#605. + if: ${{ always() }} + needs: + - verify-workflow + runs-on: ubuntu-latest + steps: + - name: Check results + run: | + status="success" + + check_result() { + name=$1 + expected=$2 + result=$3 + + echo "Checking if $name job result ('$result') is '$expected'..." + if [[ "$result" != "$expected" ]]; then + echo "$name job failed" + + status="failed" + fi + } + + check_result "verify-workflow" "success" "${{needs.verify-workflow.result}}" + + if [[ "$status" != "success" ]]; then + exit 1 + fi diff --git a/.github/workflows/ci-workflow-pull-request.yml b/.github/workflows/ci-workflow-pull-request.yml new file mode 100644 index 0000000..e75a4e0 --- /dev/null +++ b/.github/workflows/ci-workflow-pull-request.yml @@ -0,0 +1,127 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This is the main workflow that runs on every PR and push to main +name: pull_request + +defaults: + run: + shell: bash --noprofile --norc -euo pipefail {0} + +on: + push: + branches: + - "pull-request/[0-9]+" + +concurrency: + group: ${{ github.workflow }}-on-${{ github.event_name }}-from-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + + build-workflow: + name: Build workflow from matrix + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + workflow: ${{ steps.build-workflow.outputs.workflow }} + workflow_keys: ${{ steps.build-workflow.outputs.workflow_keys }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Build workflow + id: build-workflow + uses: NVIDIA/cccl/.github/actions/workflow-build@b3ef1e6a87e0eee7c382f5e6e474e9cfa1c44c36 + with: + workflows: 'pull_request' + + run-workflow: + name: ${{ matrix.name }} + needs: build-workflow + permissions: + id-token: write + contents: read + strategy: + fail-fast: false + matrix: + name: ${{ fromJSON(needs.build-workflow.outputs.workflow_keys) }} + uses: NVIDIA/cccl/.github/workflows/workflow-dispatch.yml@b3ef1e6a87e0eee7c382f5e6e474e9cfa1c44c36 + with: + name: ${{ matrix.name }} + jobs: ${{ toJSON(fromJSON(needs.build-workflow.outputs.workflow)[matrix.name]) }} + + # This job acts as a sentry and will fail if any leaf job in the workflow tree fails, as + # run-workflow always succeeds. Use this job when checking for successful matrix workflow job completion. + verify-workflow: + name: Verify and summarize workflow results + if: ${{ always() && !cancelled() }} + needs: + - build-workflow + - run-workflow + permissions: + contents: read + pull-requests: write # Posts a comment back to the PR. + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Get Base Branch from PR + id: get-pr-info + uses: nv-gha-runners/get-pr-info@main + + - name: Check workflow success + id: check-workflow + uses: NVIDIA/cccl/.github/actions/workflow-results@b3ef1e6a87e0eee7c382f5e6e474e9cfa1c44c36 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + pr_number: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).number }} + + # Check all other job statuses. This job gates branch protection checks. + ci: + name: CI + # !! Important: This job is used for branch protection checks. + # !! Need to use always() instead of !cancelled() because skipped jobs count as success + # !! for Github branch protection checks. Yes, really: by default, branch protections + # !! can be bypassed by cancelling CI. See NVIDIA/cccl#605. + if: ${{ always() }} + needs: + - verify-workflow + runs-on: ubuntu-latest + steps: + - name: Check results + run: | + status="success" + + check_result() { + name=$1 + expected=$2 + result=$3 + + echo "Checking if $name job result ('$result') is '$expected'..." + if [[ "$result" != "$expected" ]]; then + echo "$name job failed" + + status="failed" + fi + } + + check_result "verify-workflow" "success" "${{needs.verify-workflow.result}}" + + if [[ "$status" != "success" ]]; then + exit 1 + fi diff --git a/.github/workflows/dispatch-build-and-test.yml b/.github/workflows/dispatch-build-and-test.yml deleted file mode 100644 index 72cfb6b..0000000 --- a/.github/workflows/dispatch-build-and-test.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Dispatch build and test - -on: - workflow_call: - inputs: - project_name: {type: string, required: true} - per_cuda_compiler_matrix: {type: string, required: true} - devcontainer_version: {type: string, required: true} - is_windows: {type: boolean, required: true} - -permissions: - contents: read - -jobs: - # Using a matrix to dispatch to the build-and-test reusable workflow for each build configuration - # ensures that the build/test steps can overlap across different configurations. For example, - # the build step for CUDA 12.1 + gcc 9.3 can run at the same time as the test step for CUDA 11.0 + clang 11. - build_and_test_linux: - name: build and test linux - permissions: - id-token: write - contents: read - if: ${{ !inputs.is_windows }} - uses: ./.github/workflows/build-and-test-linux.yml - strategy: - fail-fast: false - matrix: - include: ${{ fromJSON(inputs.per_cuda_compiler_matrix) }} - with: - cpu: ${{ matrix.cpu }} - test_name: ${{matrix.cpu}}/${{matrix.compiler.name}}${{matrix.compiler.version}} ${{matrix.extra_build_args}} - build_script: "./ci/build_${{ inputs.project_name }}.sh -cxx ${{matrix.compiler.exe}} ${{matrix.extra_build_args}}" - test_script: "./ci/test_${{ inputs.project_name }}.sh -cxx ${{matrix.compiler.exe}} ${{matrix.extra_build_args}}" - container_image: rapidsai/devcontainers:${{inputs.devcontainer_version}}-cpp-${{matrix.compiler.name}}${{matrix.compiler.version}}-cuda${{matrix.cuda}}-${{matrix.os}} - - build_and_test_windows: - name: build and test windows - permissions: - id-token: write - contents: read - if: ${{ inputs.is_windows }} - uses: ./.github/workflows/build-and-test-windows.yml - strategy: - fail-fast: false - matrix: - include: ${{ fromJSON(inputs.per_cuda_compiler_matrix) }} - with: - test_name: ${{matrix.cpu}}/${{matrix.compiler.name}}${{matrix.compiler.version}} - build_script: "./ci/windows/build_${{ inputs.project_name }}.ps1 ${{matrix.extra_build_args}}" - test_script: "./ci/windows/test_${{ inputs.project_name }}.ps1 ${{matrix.extra_build_args}}" - container_image: rapidsai/devcontainers:${{inputs.devcontainer_version}}-cuda${{matrix.cuda}}-${{matrix.compiler.name}}${{matrix.compiler.version}}-${{matrix.os}} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 6ea22ab..0000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,95 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This is the main workflow that runs on every PR and push to main -name: pr - -defaults: - run: - shell: bash -euo pipefail {0} - -on: - push: - branches: - - "pull-request/[0-9]+" - -# Only runs one instance of this workflow at a time for a given PR and cancels any in-progress runs when a new one starts. -concurrency: - group: ${{ github.workflow }}-on-${{ github.event_name }}-from-${{ github.ref_name }} - cancel-in-progress: true - -permissions: - contents: read - pull-requests: read - -jobs: - compute-matrix: - name: Compute matrix - runs-on: ubuntu-latest - outputs: - DEVCONTAINER_VERSION: ${{steps.set-outputs.outputs.DEVCONTAINER_VERSION}} - PER_CUDA_COMPILER_MATRIX: ${{steps.set-outputs.outputs.PER_CUDA_COMPILER_MATRIX}} - PER_CUDA_COMPILER_KEYS: ${{steps.set-outputs.outputs.PER_CUDA_COMPILER_KEYS}} - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - name: Compute matrix outputs - id: set-outputs - run: | - .github/actions/compute-matrix/compute-matrix.sh ci/matrix.yaml pull_request - - nvbench: - name: NVBench CUDA${{ matrix.cuda_host_combination }} - permissions: - id-token: write - contents: read - needs: compute-matrix - uses: ./.github/workflows/dispatch-build-and-test.yml - strategy: - fail-fast: false - matrix: - cuda_host_combination: ${{ fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_KEYS) }} - with: - project_name: "nvbench" - per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_MATRIX)[ matrix.cuda_host_combination ]) }} - devcontainer_version: ${{ needs.compute-matrix.outputs.DEVCONTAINER_VERSION }} - is_windows: ${{ contains(matrix.cuda_host_combination, 'cl') }} - - verify-devcontainers: - name: Verify Dev Containers - permissions: - id-token: write - contents: read - uses: ./.github/workflows/verify-devcontainers.yml - - # This job is the final job that runs after all other jobs and is used for branch protection status checks. - # See: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks - # https://github.com/orgs/community/discussions/26822#discussioncomment-5122101 - ci: - runs-on: ubuntu-latest - name: CI - if: ${{ always() }} # need to use always() instead of !cancelled() because skipped jobs count as success - needs: - - nvbench - - verify-devcontainers - steps: - - name: Check status of all precursor jobs - if: >- - ${{ - contains(needs.*.result, 'failure') - || contains(needs.*.result, 'cancelled') - || contains(needs.*.result, 'skipped') - }} - run: exit 1 diff --git a/.github/workflows/run-as-coder.yml b/.github/workflows/run-as-coder.yml deleted file mode 100644 index 29399b6..0000000 --- a/.github/workflows/run-as-coder.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Run as coder user - -defaults: - run: - shell: bash -exo pipefail {0} - -on: - workflow_call: - inputs: - name: {type: string, required: true} - image: {type: string, required: true} - runner: {type: string, required: true} - command: {type: string, required: true} - env: { type: string, required: false, default: "" } - -permissions: - contents: read - -jobs: - run-as-coder: - name: ${{inputs.name}} - permissions: - id-token: write - contents: read - runs-on: ${{inputs.runner}} - container: - options: -u root - image: ${{inputs.image}} - env: - NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }} - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - path: nvbench - persist-credentials: false - - name: Move files to coder user home directory - run: | - cp -R nvbench /home/coder/nvbench - chown -R coder:coder /home/coder/ - - name: Add NVCC problem matcher - run: | - echo "::add-matcher::nvbench/.github/problem-matchers/problem-matcher.json" - - name: Configure credentials and environment variables for sccache - uses: ./nvbench/.github/actions/configure_cccl_sccache - - name: Run command - shell: su coder {0} - run: | - set -eo pipefail - cd ~/nvbench - echo -e "\e[1;34mRunning as 'coder' user in $(pwd):\e[0m" - echo -e "\e[1;34m${{inputs.command}}\e[0m" - eval "${{inputs.command}}" || exit_code=$? - if [ ! -z "$exit_code" ]; then - echo -e "::group::️❗ \e[1;31mInstructions to Reproduce CI Failure Locally\e[0m" - echo "::error:: To replicate this failure locally, follow the steps below:" - echo "1. Clone the repository, and navigate to the correct branch and commit:" - echo " git clone --branch $GITHUB_REF_NAME --single-branch https://github.com/$GITHUB_REPOSITORY.git && cd $(echo $GITHUB_REPOSITORY | cut -d'/' -f2) && git checkout $GITHUB_SHA" - echo "" - echo "2. Run the failed command inside the same Docker container used by the CI:" - echo " docker run --rm -it --gpus all --pull=always --volume \$PWD:/repo --workdir /repo ${{ inputs.image }} ${{inputs.command}}" - echo "" - echo "For additional information, see:" - echo " - DevContainer Documentation: https://github.com/NVIDIA/cccl/blob/main/.devcontainer/README.md" - echo " - Continuous Integration (CI) Overview: https://github.com/NVIDIA/cccl/blob/main/ci-overview.md" - exit $exit_code - fi diff --git a/.github/workflows/verify-devcontainers.yml b/.github/workflows/verify-devcontainers.yml deleted file mode 100644 index 6fea8ae..0000000 --- a/.github/workflows/verify-devcontainers.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Verify devcontainers - -on: - workflow_call: - -defaults: - run: - shell: bash -euo pipefail {0} - -permissions: - contents: read - -jobs: - verify-make-devcontainers: - name: Verify devcontainer files are up-to-date - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Setup jq and yq - run: | - sudo apt-get update - sudo apt-get install jq -y - sudo wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.34.2/yq_linux_amd64 - sudo chmod +x /usr/local/bin/yq - - name: Run the script to generate devcontainer files - run: | - ./.devcontainer/make_devcontainers.sh --verbose - - name: Check for changes - run: | - if [[ $(git diff --stat) != '' || $(git status --porcelain | grep '^??') != '' ]]; then - git diff --minimal - git status --porcelain - echo "::error:: Dev Container files are out of date or there are untracked files. Run the .devcontainer/make_devcontainers.sh script and commit the changes." - exit 1 - else - echo "::note::Dev Container files are up-to-date." - fi - - get-devcontainer-list: - needs: verify-make-devcontainers - name: Get list of devcontainer.json files - runs-on: ubuntu-latest - outputs: - devcontainers: ${{ steps.get-list.outputs.devcontainers }} - steps: - - name: Check out the code - uses: actions/checkout@v3 - - name: Get list of devcontainer.json paths and names - id: get-list - run: | - devcontainers=$(find .devcontainer/ -name 'devcontainer.json' | while read -r devcontainer; do - jq --arg path "$devcontainer" '{path: $path, name: .name}' "$devcontainer" - done | jq -s -c .) - echo "devcontainers=${devcontainers}" | tee --append "${GITHUB_OUTPUT}" - - verify-devcontainers: - needs: get-devcontainer-list - name: ${{matrix.devcontainer.name}} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - devcontainer: ${{fromJson(needs.get-devcontainer-list.outputs.devcontainers)}} - permissions: - id-token: write - contents: read - steps: - - name: Check out the code - uses: actions/checkout@v3 - # devcontainer/ci doesn't supported nested devcontainer.json files, so we need to copy the devcontainer.json - # file to the top level .devcontainer/ directory - - name: Copy devcontainer.json to .devcontainer/ - run: | - src="${{ matrix.devcontainer.path }}" - dst=".devcontainer/devcontainer.json" - if [[ "$src" != "$dst" ]]; then - cp "$src" "$dst" - fi - # We don't really need sccache configured, but we need the AWS credentials envvars to be set - # in order to avoid the devcontainer hanging waiting for GitHub authentication - - name: Configure credentials and environment variables for sccache - uses: ./.github/actions/configure_cccl_sccache - - name: Run in devcontainer - uses: devcontainers/ci@v0.3 - with: - push: never - env: | - SCCACHE_REGION=${{ env.SCCACHE_REGION }} - AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }} - AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }} - AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} - runCmd: | - .devcontainer/verify_devcontainer.sh diff --git a/ci/matrix.yaml b/ci/matrix.yaml index 563dac0..0dbe333 100644 --- a/ci/matrix.yaml +++ b/ci/matrix.yaml @@ -1,8 +1,7 @@ - -cuda_prev_min: &cuda_prev_min '11.1' # Does not support the CUPTI APIs we use (added in 11.3) -cuda_prev_max: &cuda_prev_max '11.8' -cuda_curr_min: &cuda_curr_min '12.0' -cuda_curr_max: &cuda_curr_max '12.4' +ctk_11_1: &ctk_11_1 '11.1' +ctk_11_8: &ctk_11_8 '11.8' +ctk_12_0: &ctk_12_0 '12.0' +ctk_curr: &ctk_curr '12.4' # The version of the devcontainer images to use from https://hub.docker.com/r/rapidsai/devcontainers devcontainer_version: '24.06' @@ -14,7 +13,7 @@ gcc9: &gcc9 { name: 'gcc', version: '9', exe: 'g++' } gcc10: &gcc10 { name: 'gcc', version: '10', exe: 'g++' } gcc11: &gcc11 { name: 'gcc', version: '11', exe: 'g++' } gcc12: &gcc12 { name: 'gcc', version: '12', exe: 'g++' } -gcc12: &gcc13 { name: 'gcc', version: '13', exe: 'g++' } +gcc13: &gcc13 { name: 'gcc', version: '13', exe: 'g++' } # LLVM Compiler configurations llvm9: &llvm9 { name: 'llvm', version: '9', exe: 'clang++' } @@ -25,62 +24,225 @@ llvm13: &llvm13 { name: 'llvm', version: '13', exe: 'clang++' } llvm14: &llvm14 { name: 'llvm', version: '14', exe: 'clang++' } llvm15: &llvm15 { name: 'llvm', version: '15', exe: 'clang++' } llvm16: &llvm16 { name: 'llvm', version: '16', exe: 'clang++' } -llvm16: &llvm17 { name: 'llvm', version: '17', exe: 'clang++' } -llvm16: &llvm18 { name: 'llvm', version: '18', exe: 'clang++' } +llvm17: &llvm17 { name: 'llvm', version: '17', exe: 'clang++' } +llvm18: &llvm18 { name: 'llvm', version: '18', exe: 'clang++' } +llvm19: &llvm19 { name: 'llvm', version: '19', exe: 'clang++' } # MSVC configs msvc2019: &msvc2019 { name: 'cl', version: '14.29', exe: 'cl++' } msvc2022: &msvc2022 { name: 'cl', version: '14.39', exe: 'cl++' } -# Each environment below will generate a unique build/test job -# See the "compute-matrix" job in the workflow for how this is parsed and used -# cuda: The CUDA Toolkit version -# os: The operating system used -# cpu: The CPU architecture -# compiler: The compiler to use -# name: The compiler name -# version: The compiler version -# exe: The unverionsed compiler binary name -# std: The C++ standards to build for -# This field is unique as it will generate an independent build/test job for each value - -# Configurations that will run for every PR -pull_request: - nvcc: - - {cuda: *cuda_prev_min, os: 'ubuntu18.04', cpu: 'amd64', compiler: *gcc7 } - - {cuda: *cuda_prev_min, os: 'ubuntu18.04', cpu: 'amd64', compiler: *gcc8 } - - {cuda: *cuda_prev_min, os: 'ubuntu18.04', cpu: 'amd64', compiler: *gcc9 } - - {cuda: *cuda_prev_min, os: 'ubuntu18.04', cpu: 'amd64', compiler: *llvm9 } - - {cuda: *cuda_prev_max, os: 'ubuntu22.04', cpu: 'amd64', compiler: *gcc11 } - - {cuda: *cuda_curr_min, os: 'ubuntu20.04', cpu: 'amd64', compiler: *gcc7 } - - {cuda: *cuda_curr_min, os: 'ubuntu20.04', cpu: 'amd64', compiler: *gcc8 } - - {cuda: *cuda_curr_min, os: 'ubuntu20.04', cpu: 'amd64', compiler: *gcc9 } - - {cuda: *cuda_curr_min, os: 'ubuntu20.04', cpu: 'amd64', compiler: *gcc10 } - - {cuda: *cuda_curr_min, os: 'ubuntu22.04', cpu: 'amd64', compiler: *gcc11 } - - {cuda: *cuda_curr_min, os: 'ubuntu22.04', cpu: 'amd64', compiler: *gcc12 } - - {cuda: *cuda_curr_min, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm9 } - - {cuda: *cuda_curr_min, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm10 } - - {cuda: *cuda_curr_min, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm11 } - - {cuda: *cuda_curr_min, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm12 } - - {cuda: *cuda_curr_min, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm13 } - - {cuda: *cuda_curr_min, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm14 } - - {cuda: *cuda_curr_max, os: 'ubuntu20.04', cpu: 'amd64', compiler: *gcc7 } - - {cuda: *cuda_curr_max, os: 'ubuntu20.04', cpu: 'amd64', compiler: *gcc8 } - - {cuda: *cuda_curr_max, os: 'ubuntu20.04', cpu: 'amd64', compiler: *gcc9 } - - {cuda: *cuda_curr_max, os: 'ubuntu20.04', cpu: 'amd64', compiler: *gcc10 } - - {cuda: *cuda_curr_max, os: 'ubuntu22.04', cpu: 'amd64', compiler: *gcc11 } - - {cuda: *cuda_curr_max, os: 'ubuntu22.04', cpu: 'amd64', compiler: *gcc12 } +# oneAPI configs +oneapi: &oneapi { name: 'oneapi', version: '2023.2.0', exe: 'icpc' } + +# GHA Workflow job matrices: +workflows: + pull_request: + - {jobs: ['test'], ctk: *ctk_11_1, cxx: [*gcc7, *gcc8, *gcc9, *llvm9]} + - {jobs: ['test'], ctk: *ctk_11_8, cxx: [*gcc11]} + - {jobs: ['test'], ctk: *ctk_12_0, cxx: [*gcc7, *gcc8, *gcc9, *gcc10, *gcc11, *gcc12]} + - {jobs: ['test'], ctk: *ctk_12_0, cxx: [*llvm9, *llvm10, *llvm11, *llvm12, *llvm13, *llvm14]} + - {jobs: ['test'], ctk: *ctk_curr, cxx: [*gcc7, *gcc8, *gcc9, *gcc10, *gcc11, *gcc12]} # Fails to compile simple input on CTK12.4. Try to add later. - # {cuda: *cuda_curr_max, os: 'ubuntu22.04', cpu: 'amd64', compiler: *gcc13 } - - {cuda: *cuda_curr_max, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm9 } - - {cuda: *cuda_curr_max, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm10 } - - {cuda: *cuda_curr_max, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm11 } - - {cuda: *cuda_curr_max, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm12 } - - {cuda: *cuda_curr_max, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm13 } - - {cuda: *cuda_curr_max, os: 'ubuntu20.04', cpu: 'amd64', compiler: *llvm14 } - - {cuda: *cuda_curr_max, os: 'ubuntu22.04', cpu: 'amd64', compiler: *llvm15 } - - {cuda: *cuda_curr_max, os: 'ubuntu22.04', cpu: 'amd64', compiler: *llvm16 } - - {cuda: *cuda_curr_max, os: 'ubuntu22.04', cpu: 'amd64', compiler: *llvm17 } - - {cuda: *cuda_curr_max, os: 'ubuntu22.04', cpu: 'amd64', compiler: *llvm18, extra_build_args: "-cmake-options '-DCMAKE_CUDA_FLAGS=-allow-unsupported-compiler'"} - - {cuda: *cuda_curr_max, os: 'windows2022', cpu: 'amd64', compiler: *msvc2019 } - - {cuda: *cuda_curr_max, os: 'windows2022', cpu: 'amd64', compiler: *msvc2022 } + # - {jobs: ['test'], ctk: *ctk_curr, cxx: [*gcc13]} + - {jobs: ['test'], ctk: *ctk_curr, cxx: [*llvm9, *llvm10, *llvm11, *llvm12, *llvm13, *llvm14, *llvm15, *llvm16, *llvm17]} + - {jobs: ['test'], ctk: *ctk_curr, cxx: [*llvm18], cmake_options: '-DCMAKE_CUDA_FLAGS=-allow-unsupported-compiler'} + - {jobs: ['test'], ctk: *ctk_curr, cxx: [*msvc2019, *msvc2022]} + + +# +# Resources for compute_matrix.py. These can be modified to add new jobs, etc. +# +# Jobs are executed by running scripts: +# - Linux: 'ci/_.sh` +# - Windows: `ci/windows/_.bat` + +# A matrix entry must have the following tag. +required_tags: + - 'jobs' # A list of job types to run (e.g. 'build', 'test', 'nvrtc', 'infra', 'verify_codegen', ...) for + # the specified configuration(s). + +# If a matrix entry omits these tags, a default value (defined later in `default_`) is used. +defaulted_tags: + - 'ctk' # CUDA ToolKit version. Will be exploded if a list. + - 'cpu' # CPU architecture. Will be exploded if a list. + - 'gpu' # GPU model. Will be exploded if a list. + - 'cxx' # Host compiler {name, version, exe}. Will be exploded if a list. + - 'cudacxx' # Device compiler as {name, version, exe} or 'nvcc' to use nvcc from the specified `ctk`. + # Will be exploded if a list. + - 'project' # Project name (e.g. libcudacxx, cub, thrust, cccl). Will be exploded if a list. + - 'os' # Operating system. Will be exploded if a list. + +# These tags will only exist if needed: +optional_tags: + - 'std' # C++ standard. Passed to script with `-std `. Will be exploded if a list. + # If set to 'all', all stds supported by the host/device compiler are used. + - 'sm' # `CMAKE_CUDA_ARCHITECTURES` Passed to script with `-arch `. + # Defaults to use the settings in the CMakePresets.json file. + # Set to 'gpu' to only target the GPU in the `gpu` tag. + # Can pass multiple architectures via "60;70-real;80-virtual" + # Will be exploded if a list (e.g. `sm: ['60;70;80;90', '90a']` creates two jobs) + - 'cmake_options' # Additional CMake options to pass to the build. Passed to script with `-cmake_options ""`. + # Will be exploded if a list. + +# `default_`: Used when the tag is omitted. +default_ctk: *ctk_curr +default_cudacxx: 'nvcc' +default_cxx: *gcc12 +default_cpu: 'amd64' +default_gpu: 'v100' +default_project: 'nvbench' +# Special handling: lookup os from ctk/cxx info +# See `matrix.yml` at https://github.com/rapidsai/devcontainers +default_os_lookup: + 'ctk11.1-gcc6': 'ubuntu18.04' + 'ctk11.1-gcc7': 'ubuntu18.04' + 'ctk11.1-gcc8': 'ubuntu18.04' + 'ctk11.1-gcc9': 'ubuntu18.04' + 'ctk11.1-llvm9': 'ubuntu18.04' + 'ctk11.1-cl14.16': 'windows2022' + 'ctk11.8-gcc11': 'ubuntu22.04' + 'ctk12.0-gcc7': 'ubuntu20.04' + 'ctk12.0-gcc8': 'ubuntu20.04' + 'ctk12.0-gcc9': 'ubuntu20.04' + 'ctk12.0-gcc10': 'ubuntu20.04' + 'ctk12.0-gcc11': 'ubuntu22.04' + 'ctk12.0-gcc12': 'ubuntu22.04' + 'ctk12.0-llvm9': 'ubuntu20.04' + 'ctk12.0-llvm10': 'ubuntu20.04' + 'ctk12.0-llvm11': 'ubuntu20.04' + 'ctk12.0-llvm12': 'ubuntu20.04' + 'ctk12.0-llvm13': 'ubuntu20.04' + 'ctk12.0-llvm14': 'ubuntu20.04' + 'ctk12.0-llvm15': 'ubuntu22.04' + 'ctk12.0-llvm16': 'ubuntu22.04' + 'ctk12.0-cl14.29': 'windows2022' + 'ctk12.0-cl14.36': 'windows2022' + 'ctk12.0-cl14.39': 'windows2022' + 'ctk12.0-oneapi2023.2.0': 'ubuntu22.04' + 'ctk12.4-gcc7': 'ubuntu20.04' + 'ctk12.4-gcc8': 'ubuntu20.04' + 'ctk12.4-gcc9': 'ubuntu20.04' + 'ctk12.4-gcc10': 'ubuntu20.04' + 'ctk12.4-gcc11': 'ubuntu22.04' + 'ctk12.4-gcc12': 'ubuntu22.04' + 'ctk12.4-gcc13': 'ubuntu22.04' + 'ctk12.4-llvm9': 'ubuntu20.04' + 'ctk12.4-llvm10': 'ubuntu20.04' + 'ctk12.4-llvm11': 'ubuntu20.04' + 'ctk12.4-llvm12': 'ubuntu20.04' + 'ctk12.4-llvm13': 'ubuntu20.04' + 'ctk12.4-llvm14': 'ubuntu20.04' + 'ctk12.4-llvm15': 'ubuntu22.04' + 'ctk12.4-llvm16': 'ubuntu22.04' + 'ctk12.4-llvm17': 'ubuntu22.04' + 'ctk12.4-llvm18': 'ubuntu22.04' + 'ctk12.4-cl14.29': 'windows2022' + 'ctk12.4-cl14.39': 'windows2022' + 'ctk12.4-oneapi2023.2.0': 'ubuntu22.04' + +# Lookup supported C++ standards for a given compiler when `std: 'all'`. +all_stds: [11, 14, 17, 20] +lookup_cxx_supported_stds: + 'gcc6': [11, 14 ] + 'gcc7': [11, 14, 17 ] + 'gcc8': [11, 14, 17 ] + 'gcc9': [11, 14, 17 ] + 'gcc10': [11, 14, 17, 20] + 'gcc11': [11, 14, 17, 20] + 'gcc12': [11, 14, 17, 20] + 'gcc13': [11, 14, 17, 20] + 'llvm9': [11, 14, 17 ] + 'llvm10': [11, 14, 17 ] + 'llvm11': [11, 14, 17, 20] + 'llvm12': [11, 14, 17, 20] + 'llvm13': [11, 14, 17, 20] + 'llvm14': [11, 14, 17, 20] + 'llvm15': [11, 14, 17, 20] + 'llvm16': [11, 14, 17, 20] + 'llvm17': [11, 14, 17, 20] + 'llvm18': [11, 14, 17, 20] + 'cl14.16': [ 14 ] + 'cl14.29': [ 14, 17 ] + 'cl14.39': [ 14, 17, 20] + 'oneapi2023.2.0': [11, 14, 17 ] +lookup_cudacxx_supported_stds: + 'nvcc11.1': [11, 14, 17 ] + 'nvcc11.8': [11, 14, 17 ] + 'nvcc12.0': [11, 14, 17, 20] + 'nvcc12.4': [11, 14, 17, 20] + 'llvm16': [11, 14, 17, 20] +lookup_project_supported_stds: + 'nvbench': [ 17 ] + +# Tags that aren't exploded: +non_exploded_tags: + - 'jobs' # Keeping jobs as a list allows for dependency handling of build->test steps. + +# Jobs that have an implied prerequisite 'build' job: +build_required_jobs: [] +# We just build'n'test in one step since our builds are fast. +# - 'test' + +# Jobs that require a GPU +gpu_required_jobs: + - 'test' + +# When --skip-tests is given to compute-matrix.py, these jobs are ignored. +skip_test_jobs: + - 'test' + +# When a listed project has a `test` job, it will be replaced with the specified list of finer-grain jobs. +project_expanded_tests: {} + +# Human readable name for jobs. Default behavior is to capitalize the first letter. +formatted_jobs: {} + +# Human readable name for projects. Default behavior uses the project name as-is. +formatted_project_names: + 'nvbench': 'NVBench' + +# Human readable name for compilers. Default behavior uses the "compiler.name" tag as-is. +formatted_cxx_names: + 'llvm': 'clang' + 'oneapi': 'Intel' + 'cl': 'MSVC' + +# All known GPUs +gpus: + - 'v100' # 40 runners + - 't4' # 8 runners + - 'rtx2080' # 8 runners + - 'rtxa6000' # 12 runners + - 'l4' # 48 runners + - 'rtx4090' # 10 runners + - 'h100' # 16 runners + +# SM versions of GPUs +gpu_sm: + 'v100': '70' + 't4': '75' + 'rtx2080': '75' + 'rtxa6000': '86' + 'l4': '89' + 'rtx4090': '89' + 'h100': '90' + +# Memory size of GPUs +gpu_mem_gb: + 'v100': '32' + 't4': '16' + 'rtx2080': '8' + 'rtxa6000': '48' + 'l4': '24' + 'rtx4090': '24' + 'h100': '80' + +# GPUs that require `-testing` at the end of the runner pool name. +testing_pool_gpus: + - 't4' + - 'rtx2080' + - 'rtxa6000' + - 'l4' + - 'rtx4090' + - 'h100'