Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define compiler env vars for CMake in dev containers. #576

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .devcontainer/cuda11.1-gcc6/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "11.1",
"CCCL_HOST_COMPILER": "gcc",
"CCCL_HOST_COMPILER_VERSION": "6",
"CCCL_BUILD_INFIX": "cuda11.1-gcc6"
"CCCL_BUILD_INFIX": "cuda11.1-gcc6",
"CXX": "g++",
"CUDAHOSTCXX": "g++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda11.1-gcc7/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "11.1",
"CCCL_HOST_COMPILER": "gcc",
"CCCL_HOST_COMPILER_VERSION": "7",
"CCCL_BUILD_INFIX": "cuda11.1-gcc7"
"CCCL_BUILD_INFIX": "cuda11.1-gcc7",
"CXX": "g++",
"CUDAHOSTCXX": "g++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda11.1-gcc8/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "11.1",
"CCCL_HOST_COMPILER": "gcc",
"CCCL_HOST_COMPILER_VERSION": "8",
"CCCL_BUILD_INFIX": "cuda11.1-gcc8"
"CCCL_BUILD_INFIX": "cuda11.1-gcc8",
"CXX": "g++",
"CUDAHOSTCXX": "g++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda11.1-gcc9/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "11.1",
"CCCL_HOST_COMPILER": "gcc",
"CCCL_HOST_COMPILER_VERSION": "9",
"CCCL_BUILD_INFIX": "cuda11.1-gcc9"
"CCCL_BUILD_INFIX": "cuda11.1-gcc9",
"CXX": "g++",
"CUDAHOSTCXX": "g++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda11.1-llvm9/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "11.1",
"CCCL_HOST_COMPILER": "llvm",
"CCCL_HOST_COMPILER_VERSION": "9",
"CCCL_BUILD_INFIX": "cuda11.1-llvm9"
"CCCL_BUILD_INFIX": "cuda11.1-llvm9",
"CXX": "clang++",
"CUDAHOSTCXX": "clang++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-gcc10/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "gcc",
"CCCL_HOST_COMPILER_VERSION": "10",
"CCCL_BUILD_INFIX": "cuda12.2-gcc10"
"CCCL_BUILD_INFIX": "cuda12.2-gcc10",
"CXX": "g++",
"CUDAHOSTCXX": "g++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-gcc11/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "gcc",
"CCCL_HOST_COMPILER_VERSION": "11",
"CCCL_BUILD_INFIX": "cuda12.2-gcc11"
"CCCL_BUILD_INFIX": "cuda12.2-gcc11",
"CXX": "g++",
"CUDAHOSTCXX": "g++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-gcc12/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "gcc",
"CCCL_HOST_COMPILER_VERSION": "12",
"CCCL_BUILD_INFIX": "cuda12.2-gcc12"
"CCCL_BUILD_INFIX": "cuda12.2-gcc12",
"CXX": "g++",
"CUDAHOSTCXX": "g++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-gcc7/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "gcc",
"CCCL_HOST_COMPILER_VERSION": "7",
"CCCL_BUILD_INFIX": "cuda12.2-gcc7"
"CCCL_BUILD_INFIX": "cuda12.2-gcc7",
"CXX": "g++",
"CUDAHOSTCXX": "g++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-gcc8/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "gcc",
"CCCL_HOST_COMPILER_VERSION": "8",
"CCCL_BUILD_INFIX": "cuda12.2-gcc8"
"CCCL_BUILD_INFIX": "cuda12.2-gcc8",
"CXX": "g++",
"CUDAHOSTCXX": "g++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-gcc9/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "gcc",
"CCCL_HOST_COMPILER_VERSION": "9",
"CCCL_BUILD_INFIX": "cuda12.2-gcc9"
"CCCL_BUILD_INFIX": "cuda12.2-gcc9",
"CXX": "g++",
"CUDAHOSTCXX": "g++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-llvm10/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "llvm",
"CCCL_HOST_COMPILER_VERSION": "10",
"CCCL_BUILD_INFIX": "cuda12.2-llvm10"
"CCCL_BUILD_INFIX": "cuda12.2-llvm10",
"CXX": "clang++",
"CUDAHOSTCXX": "clang++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-llvm11/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "llvm",
"CCCL_HOST_COMPILER_VERSION": "11",
"CCCL_BUILD_INFIX": "cuda12.2-llvm11"
"CCCL_BUILD_INFIX": "cuda12.2-llvm11",
"CXX": "clang++",
"CUDAHOSTCXX": "clang++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-llvm12/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "llvm",
"CCCL_HOST_COMPILER_VERSION": "12",
"CCCL_BUILD_INFIX": "cuda12.2-llvm12"
"CCCL_BUILD_INFIX": "cuda12.2-llvm12",
"CXX": "clang++",
"CUDAHOSTCXX": "clang++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-llvm13/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "llvm",
"CCCL_HOST_COMPILER_VERSION": "13",
"CCCL_BUILD_INFIX": "cuda12.2-llvm13"
"CCCL_BUILD_INFIX": "cuda12.2-llvm13",
"CXX": "clang++",
"CUDAHOSTCXX": "clang++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-llvm14/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "llvm",
"CCCL_HOST_COMPILER_VERSION": "14",
"CCCL_BUILD_INFIX": "cuda12.2-llvm14"
"CCCL_BUILD_INFIX": "cuda12.2-llvm14",
"CXX": "clang++",
"CUDAHOSTCXX": "clang++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-llvm15/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "llvm",
"CCCL_HOST_COMPILER_VERSION": "15",
"CCCL_BUILD_INFIX": "cuda12.2-llvm15"
"CCCL_BUILD_INFIX": "cuda12.2-llvm15",
"CXX": "clang++",
"CUDAHOSTCXX": "clang++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-llvm16/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "llvm",
"CCCL_HOST_COMPILER_VERSION": "16",
"CCCL_BUILD_INFIX": "cuda12.2-llvm16"
"CCCL_BUILD_INFIX": "cuda12.2-llvm16",
"CXX": "clang++",
"CUDAHOSTCXX": "clang++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/cuda12.2-llvm9/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "llvm",
"CCCL_HOST_COMPILER_VERSION": "9",
"CCCL_BUILD_INFIX": "cuda12.2-llvm9"
"CCCL_BUILD_INFIX": "cuda12.2-llvm9",
"CXX": "clang++",
"CUDAHOSTCXX": "clang++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"CCCL_CUDA_VERSION": "12.2",
"CCCL_HOST_COMPILER": "gcc",
"CCCL_HOST_COMPILER_VERSION": "12",
"CCCL_BUILD_INFIX": "cuda12.2-gcc12"
"CCCL_BUILD_INFIX": "cuda12.2-gcc12",
"CXX": "g++",
"CUDAHOSTCXX": "g++"
},
"workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent",
Expand Down
20 changes: 12 additions & 8 deletions .devcontainer/make_devcontainers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,22 @@ update_devcontainer() {
local name="$3"
local cuda_version="$4"
local compiler_name="$5"
local compiler_version="$6"
local os="$7"
local devcontainer_version="$8"
local compiler_exe="$6"
local compiler_version="$7"
local os="$8"
local devcontainer_version="$9"

local IMAGE_ROOT="rapidsai/devcontainers:${devcontainer_version}-cpp-"
local image="${IMAGE_ROOT}${compiler_name}${compiler_version}-cuda${cuda_version}-${os}"

jq --arg image "$image" --arg name "$name" \
--arg cuda_version "$cuda_version" --arg compiler_name "$compiler_name" \
--arg compiler_version "$compiler_version" --arg os "$os" \
--arg compiler_exe "$compiler_exe" --arg compiler_version "$compiler_version" --arg os "$os" \
'.image = $image | .name = $name | .containerEnv.DEVCONTAINER_NAME = $name |
.containerEnv.CCCL_BUILD_INFIX = $name |
.containerEnv.CCCL_CUDA_VERSION = $cuda_version | .containerEnv.CCCL_HOST_COMPILER = $compiler_name |
.containerEnv.CCCL_HOST_COMPILER_VERSION = $compiler_version' \
.containerEnv.CCCL_HOST_COMPILER_VERSION = $compiler_version |
.containerEnv.CXX = $compiler_exe | .containerEnv.CUDAHOSTCXX = $compiler_exe' \
"$input_file" > "$output_file"
}

Expand Down Expand Up @@ -90,7 +92,7 @@ readonly matrix_json=$(echo "$matrix_json" | jq 'del(.pull_request.nvcc[] | sele
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_version: .compiler.version, os: .os}] | unique | .[]')
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 | .[]')

# 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 All @@ -99,11 +101,12 @@ readonly base_devcontainer_file="./devcontainer.json"
readonly NEWEST_GCC_CUDA_ENTRY=$(echo "$combinations" | jq -rs '[.[] | select(.compiler_name == "gcc")] | sort_by((.cuda | tonumber), (.compiler_version | tonumber)) | .[-1]')
readonly DEFAULT_CUDA=$(echo "$NEWEST_GCC_CUDA_ENTRY" | jq -r '.cuda')
readonly DEFAULT_COMPILER_NAME=$(echo "$NEWEST_GCC_CUDA_ENTRY" | jq -r '.compiler_name')
readonly DEFAULT_COMPILER_EXE=$(echo "$NEWEST_GCC_CUDA_ENTRY" | jq -r '.compiler_exe')
readonly DEFAULT_COMPILER_VERSION=$(echo "$NEWEST_GCC_CUDA_ENTRY" | jq -r '.compiler_version')
readonly DEFAULT_OS=$(echo "$NEWEST_GCC_CUDA_ENTRY" | jq -r '.os')
readonly DEFAULT_NAME=$(make_name "$DEFAULT_CUDA" "$DEFAULT_COMPILER_NAME" "$DEFAULT_COMPILER_VERSION")

update_devcontainer ${base_devcontainer_file} "./temp_devcontainer.json" "$DEFAULT_NAME" "$DEFAULT_CUDA" "$DEFAULT_COMPILER_NAME" "$DEFAULT_COMPILER_VERSION" "$DEFAULT_OS" "$DEVCONTAINER_VERSION"
update_devcontainer ${base_devcontainer_file} "./temp_devcontainer.json" "$DEFAULT_NAME" "$DEFAULT_CUDA" "$DEFAULT_COMPILER_NAME" "$DEFAULT_COMPILER_EXE" "$DEFAULT_COMPILER_VERSION" "$DEFAULT_OS" "$DEVCONTAINER_VERSION"
mv "./temp_devcontainer.json" ${base_devcontainer_file}

# Create an array to keep track of valid subdirectory names
Expand All @@ -113,14 +116,15 @@ valid_subdirs=()
for combination in $combinations; do
cuda_version=$(echo "$combination" | jq -r '.cuda')
compiler_name=$(echo "$combination" | jq -r '.compiler_name')
compiler_exe=$(echo "$combination" | jq -r '.compiler_exe')
compiler_version=$(echo "$combination" | jq -r '.compiler_version')
os=$(echo "$combination" | jq -r '.os')

name=$(make_name "$cuda_version" "$compiler_name" "$compiler_version")
mkdir -p "$name"
new_devcontainer_file="$name/devcontainer.json"

update_devcontainer "$base_devcontainer_file" "$new_devcontainer_file" "$name" "$cuda_version" "$compiler_name" "$compiler_version" "$os" "$DEVCONTAINER_VERSION"
update_devcontainer "$base_devcontainer_file" "$new_devcontainer_file" "$name" "$cuda_version" "$compiler_name" "$compiler_exe" "$compiler_version" "$os" "$DEVCONTAINER_VERSION"
echo "Created $new_devcontainer_file"

# Add the subdirectory name to the valid_subdirs array
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/verify_devcontainer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ main() {

set -euo pipefail

check_envvars DEVCONTAINER_NAME CXX CCCL_HOST_COMPILER CCCL_CUDA_VERSION CCCL_HOST_COMPILER_VERSION
check_envvars DEVCONTAINER_NAME CXX CUDAHOSTCXX CCCL_BUILD_INFIX CCCL_HOST_COMPILER CCCL_CUDA_VERSION CCCL_HOST_COMPILER_VERSION

check_host_compiler_version

Expand Down
Loading