Skip to content

Commit

Permalink
Separate windows and Linux CI matrix (#1206)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Schellenberger Costa <[email protected]>
  • Loading branch information
jrhemstad and miscco authored Jan 25, 2024
1 parent b452931 commit ff49a2b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/make_devcontainers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ fi
matrix_json=$(yq -o json ${MATRIX_FILE})

# Exclude Windows environments
readonly matrix_json=$(echo "$matrix_json" | jq 'del(.pull_request.nvcc[] | select(.os | contains("windows")))')
readonly matrix_json=$(echo "$matrix_json" | jq 'del(.pull_request.nvcc.windows)')

# Get the devcontainer image version and define image tag root
readonly DEVCONTAINER_VERSION=$(echo "$matrix_json" | jq -r '.devcontainer_version')

# Get unique combinations of cuda version, compiler name/version, and Ubuntu version
readonly combinations=$(echo "$matrix_json" | jq -c '[.pull_request.nvcc[] | {cuda: .cuda, compiler_name: .compiler.name, compiler_exe: .compiler.exe, compiler_version: .compiler.version, os: .os}] | unique | .[]')
readonly combinations=$(echo "$matrix_json" | jq -c '[.pull_request.nvcc.linux[] | {cuda: .cuda, compiler_name: .compiler.name, compiler_exe: .compiler.exe, compiler_version: .compiler.version, os: .os}] | unique | .[]')

# Update the base devcontainer with the default values
# The root devcontainer.json file is used as the default container as well as a template for all
Expand Down
16 changes: 11 additions & 5 deletions .github/actions/compute-matrix/compute-matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ explode_libs() {
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' | explode_std_versions )"
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')"
local matrix=$(yq -o=json "$file" | jq -cr ".$type")
local nvcc_full_linux_matrix="$(echo "$matrix" | jq -cr '.nvcc.linux' | explode_std_versions )"
local linux_per_cuda_compiler_matrix="$(echo "$nvcc_full_linux_matrix" | jq -cr ' group_by(.cuda + .compiler.name) | map({(.[0].cuda + "-" + .[0].compiler.name): .}) | add')"
write_output "LINUX_PER_CUDA_COMPILER_MATRIX" "$linux_per_cuda_compiler_matrix"
write_output "LINUX_PER_CUDA_COMPILER_KEYS" "$(echo "$linux_per_cuda_compiler_matrix" | jq -r 'keys | @json')"

local nvcc_full_windows_matrix="$(echo "$matrix" | jq -cr '.nvcc.windows' | explode_std_versions )"
local windows_per_cuda_compiler_matrix="$(echo "$nvcc_full_windows_matrix" | jq -cr ' group_by(.cuda + .compiler.name) | map({(.[0].cuda + "-" + .[0].compiler.name): .}) | add')"
write_output "WINDOWS_PER_CUDA_COMPILER_MATRIX" "$windows_per_cuda_compiler_matrix"
write_output "WINDOWS_PER_CUDA_COMPILER_KEYS" "$(echo "$windows_per_cuda_compiler_matrix" | jq -r 'keys | @json')"

write_output "NVRTC_MATRIX" "$(echo "$matrix" | jq '.nvrtc' | explode_std_versions)"

Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ jobs:
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}}
LINUX_PER_CUDA_COMPILER_MATRIX: ${{steps.set-outputs.outputs.LINUX_PER_CUDA_COMPILER_MATRIX}}
LINUX_PER_CUDA_COMPILER_KEYS: ${{steps.set-outputs.outputs.LINUX_PER_CUDA_COMPILER_KEYS}}
WINDOWS_PER_CUDA_COMPILER_MATRIX: ${{steps.set-outputs.outputs.WINDOWS_PER_CUDA_COMPILER_MATRIX}}
WINDOWS_PER_CUDA_COMPILER_KEYS: ${{steps.set-outputs.outputs.WINDOWS_PER_CUDA_COMPILER_KEYS}}
NVRTC_MATRIX: ${{steps.set-outputs.outputs.NVRTC_MATRIX}}
CLANG_CUDA_MATRIX: ${{steps.set-outputs.outputs.CLANG_CUDA_MATRIX}}
CCCL_INFRA_MATRIX: ${{steps.set-outputs.outputs.CCCL_INFRA_MATRIX}}
Expand Down Expand Up @@ -82,10 +84,10 @@ jobs:
strategy:
fail-fast: false
matrix:
cuda_host_combination: ${{ fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_KEYS) }}
cuda_host_combination: ${{ fromJSON(needs.compute-matrix.outputs.LINUX_PER_CUDA_COMPILER_KEYS) }}
with:
project_name: "thrust"
per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_MATRIX)[ matrix.cuda_host_combination ]) }}
per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-matrix.outputs.LINUX_PER_CUDA_COMPILER_MATRIX)[ matrix.cuda_host_combination ]) }}
devcontainer_version: ${{ needs.compute-matrix.outputs.DEVCONTAINER_VERSION }}
is_windows: ${{ contains(matrix.cuda_host_combination, 'cl') }}

Expand All @@ -99,10 +101,10 @@ jobs:
strategy:
fail-fast: false
matrix:
cuda_host_combination: ${{ fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_KEYS) }}
cuda_host_combination: ${{ fromJSON(needs.compute-matrix.outputs.LINUX_PER_CUDA_COMPILER_KEYS) }}
with:
project_name: "cub"
per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_MATRIX)[ matrix.cuda_host_combination ]) }}
per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-matrix.outputs.LINUX_PER_CUDA_COMPILER_MATRIX)[ matrix.cuda_host_combination ]) }}
devcontainer_version: ${{ needs.compute-matrix.outputs.DEVCONTAINER_VERSION }}
is_windows: ${{ contains(matrix.cuda_host_combination, 'cl') }}

Expand All @@ -116,10 +118,10 @@ jobs:
strategy:
fail-fast: false
matrix:
cuda_host_combination: ${{ fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_KEYS) }}
cuda_host_combination: ${{ fromJSON(needs.compute-matrix.outputs.LINUX_PER_CUDA_COMPILER_KEYS) }}
with:
project_name: "libcudacxx"
per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_MATRIX)[ matrix.cuda_host_combination ]) }}
per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-matrix.outputs.LINUX_PER_CUDA_COMPILER_MATRIX)[ matrix.cuda_host_combination ]) }}
devcontainer_version: ${{ needs.compute-matrix.outputs.DEVCONTAINER_VERSION }}
is_windows: ${{ contains(matrix.cuda_host_combination, 'cl') }}

Expand Down
5 changes: 4 additions & 1 deletion ci/matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ oneapi: &oneapi { name: 'oneapi', version: '2023.2.0', exe: 'icpc' }
# Configurations that will run for every PR
pull_request:
nvcc:
linux:
- {cuda: *cuda_oldest, os: 'ubuntu18.04', cpu: 'amd64', compiler: *gcc6, std: [11, 14], jobs: ['build']}
- {cuda: *cuda_oldest, os: 'ubuntu18.04', cpu: 'amd64', compiler: *gcc7, std: [11, 14, 17], jobs: ['build']}
- {cuda: *cuda_oldest, os: 'ubuntu18.04', cpu: 'amd64', compiler: *gcc8, std: [11, 14, 17], jobs: ['build']}
- {cuda: *cuda_oldest, os: 'ubuntu18.04', cpu: 'amd64', compiler: *gcc9, std: [11, 14, 17], jobs: ['build']}
- {cuda: *cuda_oldest, os: 'ubuntu18.04', cpu: 'amd64', compiler: *llvm9, std: [11, 14, 17], jobs: ['build']}
- {cuda: *cuda_oldest, os: 'windows2022', cpu: 'amd64', compiler: *msvc2017, std: [14, 17], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu20.04', cpu: 'amd64', compiler: *gcc7, std: [11, 14, 17], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu20.04', cpu: 'amd64', compiler: *gcc8, std: [11, 14, 17], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu20.04', cpu: 'amd64', compiler: *gcc9, std: [11, 14, 17], jobs: ['build']}
Expand All @@ -78,6 +78,9 @@ pull_request:
- {cuda: *cuda_newest, os: 'ubuntu22.04', cpu: 'amd64', compiler: *llvm15, std: [11, 14, 17, 20], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu22.04', cpu: 'amd64', compiler: *llvm16, std: [11, 14, 17, 20], jobs: ['build', 'test']}
- {cuda: *cuda_newest, os: 'ubuntu22.04', cpu: 'arm64', compiler: *llvm16, std: [11, 14, 17, 20], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu22.04', cpu: 'amd64', compiler: *oneapi, std: [11, 14, 17], jobs: ['build']}
windows:
- {cuda: *cuda_oldest, os: 'windows2022', cpu: 'amd64', compiler: *msvc2017, std: [14, 17], jobs: ['build']}
- {cuda: *cuda_newest, os: 'windows2022', cpu: 'amd64', compiler: *msvc2019, std: [14, 17], jobs: ['build']}
- {cuda: *cuda_newest, os: 'windows2022', cpu: 'amd64', compiler: *msvc2022, std: [14, 17, 20], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu22.04', cpu: 'amd64', compiler: *oneapi, std: [11, 14, 17], jobs: ['build']}
Expand Down

0 comments on commit ff49a2b

Please sign in to comment.