diff --git a/.devcontainer/cuda11.1-gcc7/devcontainer.json b/.devcontainer/cuda11.1-gcc7/devcontainer.json new file mode 100644 index 00000000000..906f4d90301 --- /dev/null +++ b/.devcontainer/cuda11.1-gcc7/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-gcc7-cuda11.1-ubuntu18.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda11.1-gcc7" +} diff --git a/.devcontainer/cuda11.1-gcc8/devcontainer.json b/.devcontainer/cuda11.1-gcc8/devcontainer.json new file mode 100644 index 00000000000..c259ad58fa1 --- /dev/null +++ b/.devcontainer/cuda11.1-gcc8/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-gcc8-cuda11.1-ubuntu18.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda11.1-gcc8" +} diff --git a/.devcontainer/cuda11.1-gcc9/devcontainer.json b/.devcontainer/cuda11.1-gcc9/devcontainer.json new file mode 100644 index 00000000000..096ed56752e --- /dev/null +++ b/.devcontainer/cuda11.1-gcc9/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-gcc9-cuda11.1-ubuntu18.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda11.1-gcc9" +} diff --git a/.devcontainer/cuda11.1-llvm9/devcontainer.json b/.devcontainer/cuda11.1-llvm9/devcontainer.json new file mode 100644 index 00000000000..dd64ac5f050 --- /dev/null +++ b/.devcontainer/cuda11.1-llvm9/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-llvm9-cuda11.1-ubuntu18.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda11.1-llvm9" +} diff --git a/.devcontainer/cuda12.1-gcc10/devcontainer.json b/.devcontainer/cuda12.1-gcc10/devcontainer.json new file mode 100644 index 00000000000..9313ddce140 --- /dev/null +++ b/.devcontainer/cuda12.1-gcc10/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-gcc10-cuda12.1-ubuntu20.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-gcc10" +} diff --git a/.devcontainer/cuda12.1-gcc11/devcontainer.json b/.devcontainer/cuda12.1-gcc11/devcontainer.json new file mode 100644 index 00000000000..73dad29d001 --- /dev/null +++ b/.devcontainer/cuda12.1-gcc11/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-gcc11-cuda12.1-ubuntu22.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-gcc11" +} diff --git a/.devcontainer/cuda12.1-gcc12/devcontainer.json b/.devcontainer/cuda12.1-gcc12/devcontainer.json new file mode 100644 index 00000000000..62772435f02 --- /dev/null +++ b/.devcontainer/cuda12.1-gcc12/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-gcc12-cuda12.1-ubuntu22.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-gcc12" +} diff --git a/.devcontainer/cuda12.1-gcc7/devcontainer.json b/.devcontainer/cuda12.1-gcc7/devcontainer.json new file mode 100644 index 00000000000..e4eb3ccfbdf --- /dev/null +++ b/.devcontainer/cuda12.1-gcc7/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-gcc7-cuda12.1-ubuntu20.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-gcc7" +} diff --git a/.devcontainer/cuda12.1-gcc8/devcontainer.json b/.devcontainer/cuda12.1-gcc8/devcontainer.json new file mode 100644 index 00000000000..8cf373bc889 --- /dev/null +++ b/.devcontainer/cuda12.1-gcc8/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-gcc8-cuda12.1-ubuntu20.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-gcc8" +} diff --git a/.devcontainer/cuda12.1-gcc9/devcontainer.json b/.devcontainer/cuda12.1-gcc9/devcontainer.json new file mode 100644 index 00000000000..513b9206bfe --- /dev/null +++ b/.devcontainer/cuda12.1-gcc9/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-gcc9-cuda12.1-ubuntu20.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-gcc9" +} diff --git a/.devcontainer/cuda12.1-llvm10/devcontainer.json b/.devcontainer/cuda12.1-llvm10/devcontainer.json new file mode 100644 index 00000000000..3f78e5990df --- /dev/null +++ b/.devcontainer/cuda12.1-llvm10/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-llvm10-cuda12.1-ubuntu20.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-llvm10" +} diff --git a/.devcontainer/cuda12.1-llvm11/devcontainer.json b/.devcontainer/cuda12.1-llvm11/devcontainer.json new file mode 100644 index 00000000000..a465e8c4268 --- /dev/null +++ b/.devcontainer/cuda12.1-llvm11/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-llvm11-cuda12.1-ubuntu20.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-llvm11" +} diff --git a/.devcontainer/cuda12.1-llvm12/devcontainer.json b/.devcontainer/cuda12.1-llvm12/devcontainer.json new file mode 100644 index 00000000000..a6d3372480a --- /dev/null +++ b/.devcontainer/cuda12.1-llvm12/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-llvm12-cuda12.1-ubuntu20.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-llvm12" +} diff --git a/.devcontainer/cuda12.1-llvm13/devcontainer.json b/.devcontainer/cuda12.1-llvm13/devcontainer.json new file mode 100644 index 00000000000..133229967c6 --- /dev/null +++ b/.devcontainer/cuda12.1-llvm13/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-llvm13-cuda12.1-ubuntu20.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-llvm13" +} diff --git a/.devcontainer/cuda12.1-llvm14/devcontainer.json b/.devcontainer/cuda12.1-llvm14/devcontainer.json new file mode 100644 index 00000000000..0a290a0dc49 --- /dev/null +++ b/.devcontainer/cuda12.1-llvm14/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-llvm14-cuda12.1-ubuntu20.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-llvm14" +} diff --git a/.devcontainer/cuda12.1-llvm15/devcontainer.json b/.devcontainer/cuda12.1-llvm15/devcontainer.json new file mode 100644 index 00000000000..c2729aaaebf --- /dev/null +++ b/.devcontainer/cuda12.1-llvm15/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-llvm15-cuda12.1-ubuntu22.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-llvm15" +} diff --git a/.devcontainer/cuda12.1-llvm9/devcontainer.json b/.devcontainer/cuda12.1-llvm9/devcontainer.json new file mode 100644 index 00000000000..44297c6183f --- /dev/null +++ b/.devcontainer/cuda12.1-llvm9/devcontainer.json @@ -0,0 +1,26 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-llvm9-cuda12.1-ubuntu20.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ], + "name": "cuda12.1-llvm9" +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..0a86dc0c7d3 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +{ + "shutdownAction": "stopContainer", + "image": "rapidsai/devcontainers:23.06-cpp-gcc12-cuda12.1-ubuntu22.04", + "hostRequirements": { + "gpu": true + }, + "initializeCommand": [ + "/bin/bash", + "-c", + "mkdir -m 0755 -p ${localWorkspaceFolder}/.{aws,cache,config}" + ], + "containerEnv": { + "SCCACHE_REGION": "us-east-2", + "SCCACHE_BUCKET": "rapids-sccache-devs", + "VAULT_HOST": "https://vault.ops.k8s.rapids.ai", + "HISTFILE": "${containerWorkspaceFolder}/.cache/._bash_history" + }, + "workspaceFolder": "/home/coder/${localWorkspaceFolderBasename}", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/${localWorkspaceFolderBasename},type=bind,consistency=consistent", + "mounts": [ + "source=${localWorkspaceFolder}/.aws,target=/home/coder/.aws,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.cache,target=/home/coder/.cache,type=bind,consistency=consistent", + "source=${localWorkspaceFolder}/.config,target=/home/coder/.config,type=bind,consistency=consistent" + ] +} \ No newline at end of file diff --git a/.devcontainer/launch.sh b/.devcontainer/launch.sh new file mode 100755 index 00000000000..984d6412382 --- /dev/null +++ b/.devcontainer/launch.sh @@ -0,0 +1,45 @@ + +#! /usr/bin/env bash + +launch_devcontainer() { + + # Ensure we're in the repo root + cd "$( cd "$( dirname "$(realpath -m "${BASH_SOURCE[0]}")" )" && pwd )/.."; + + if [[ -z $1 ]] || [[ -z $2 ]]; then + echo "Usage: $0 [CUDA version] [Host compiler]" + echo "Example: $0 12.1 gcc12" + return 1 + fi + + local cuda_version="$1" + local host_compiler="$2" + local workspace="$(basename "$(pwd)")"; + local tmpdir="$(mktemp -d)/${workspace}"; + local path="$(pwd)/.devcontainer/cuda${cuda_version}-${host_compiler}"; + + mkdir -p "${tmpdir}"; + mkdir -p "${tmpdir}/.devcontainer"; + cp -arL "$path/devcontainer.json" "${tmpdir}/.devcontainer"; + sed -i "s@\${localWorkspaceFolder}@$(pwd)@g" "${tmpdir}/.devcontainer/devcontainer.json"; + path="${tmpdir}"; + + local hash="$(echo -n "${path}" | xxd -pu - | tr -d '[:space:]')"; + local url="vscode://vscode-remote/dev-container+${hash}/home/coder/cccl"; + + echo "devcontainer URL: ${url}"; + + local launch=""; + if type open >/dev/null 2>&1; then + launch="open"; + elif type xdg-open >/dev/null 2>&1; then + launch="xdg-open"; + fi + + if [ -n "${launch}" ]; then + code --new-window "${tmpdir}"; + exec "${launch}" "${url}" >/dev/null 2>&1; + fi +} + +launch_devcontainer "$@"; \ No newline at end of file diff --git a/.devcontainer/make_devcontainers.sh b/.devcontainer/make_devcontainers.sh new file mode 100755 index 00000000000..f6fe40d1dcf --- /dev/null +++ b/.devcontainer/make_devcontainers.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# This script parses the CI matrix.yaml file and generates a devcontainer.json file for each unique combination of +# CUDA version, compiler name/version, and Ubuntu version. The devcontainer.json files are written to the +# .devcontainer directory to a subdirectory named after the CUDA version and compiler name/version. +# GitHub docs on using multiple devcontainer.json files: +# https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers#devcontainerjson + +# Ensure the script is being executed in its containing directory +cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; + +# The root devcontainer.json file is used as a template for all other devcontainer.json files +# by replacing the `image:` field with the appropriate image name +base_devcontainer_file="./devcontainer.json" + +# Define image root +IMAGE_ROOT="rapidsai/devcontainers:23.06-cpp-" + +# Read matrix.yaml and convert it to json +matrix_json=$(yq -o json ../ci/matrix.yaml) + +# Get unique combinations of cuda version, compiler name/version, and Ubuntu version +combinations=$(echo "$matrix_json" | jq -c '[."pull-request"[] | {cuda: .cuda, compiler_name: .compiler.name, compiler_version: .compiler.version, os: .os}] | unique | .[]') + +# For each unique combination +for combination in $combinations; do + cuda_version=$(echo "$combination" | jq -r '.cuda') + compiler_name=$(echo "$combination" | jq -r '.compiler_name') + compiler_version=$(echo "$combination" | jq -r '.compiler_version') + os=$(echo "$combination" | jq -r '.os') + + name="cuda$cuda_version-$compiler_name$compiler_version" + mkdir -p "$name" + devcontainer_file="$name/devcontainer.json" + image="$IMAGE_ROOT$compiler_name$compiler_version-cuda$cuda_version-$os" + + # Use the base_devcontainer.json as a template, plug in the CUDA, compiler names, versions, and Ubuntu version, + # and write the output to the new devcontainer.json file + jq --arg image "$image" --arg name "$name" '. + {image: $image, name: $name}' $base_devcontainer_file > "$devcontainer_file" + + echo "Created $devcontainer_file" +done diff --git a/.github/actions/configure_cccl_sccache/action.yml b/.github/actions/configure_cccl_sccache/action.yml new file mode 100644 index 00000000000..17a49fe7ff1 --- /dev/null +++ b/.github/actions/configure_cccl_sccache/action.yml @@ -0,0 +1,19 @@ +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-east" >> $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.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 00000000000..1269ee11467 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,106 @@ +name: build and test + +defaults: + run: + shell: bash -eo pipefail {0} + +on: + workflow_call: + inputs: + cuda_version: {type: string, required: true} + compiler: {type: string, required: true} + compiler_exe: {type: string, required: true} + compiler_version: {type: string, required: true} + std: {type: string, required: true} + gpu_build_archs: {type: string, required: true} + cpu: {type: string, required: true} + os: {type: string, required: true} + build_script: {type: string, required: false} + test_script: {type: string, required: false } + build_image: {type: string, required: false} + test_image: {type: string, required: false} + +jobs: + build: + if: inputs.build_script != '' && inputs.build_image != '' + name: Build ${{inputs.compiler}}${{inputs.compiler_version}}/C++${{inputs.std}} + runs-on: ${{ (inputs.os == 'windows' && 'windows-latest') || format('linux-{0}-cpu16', inputs.cpu) }} + container: + options: -u root + image: ${{ inputs.build_image }} + permissions: + id-token: write + steps: + - name: Echo git version + run: git --version + #TODO: We can remove this when we aren't using submodules anymore + - name: Update git version + run: | + sudo apt-get install software-properties-common + sudo add-apt-repository ppa:git-core/ppa -y + sudo apt-get update + sudo apt-get install git -y + git --version + - name: Checkout repo + uses: actions/checkout@v3 + with: + submodules: 'recursive' + - name: Configure credentials and environment variables for sccache + uses: ./.github/actions/configure_cccl_sccache + - name: Run build script + run: | + sccache -s > sccache_before.txt + cmd="${{ inputs.build_script }} \"${{inputs.compiler_exe}}\" \"${{inputs.std}}\" \"${{inputs.gpu_build_archs}}\"" + eval $cmd || exit_code=$? + if [ ! -z "$exit_code" ]; then + echo "::error::Build failed! To checkout the corresponding code and reproduce this build locally, run the following commands:" + echo "git clone --branch $GITHUB_REF_NAME --single-branch --recurse-submodules https://github.com/$GITHUB_REPOSITORY.git && cd $(echo $GITHUB_REPOSITORY | cut -d'/' -f2) && git checkout $GITHUB_SHA" + echo "docker run --rm -it --gpus all --pull=always --volume \$PWD:/repo --workdir /repo ${{ inputs.build_image }} $cmd" + echo "Alternatively, for a more convenient, interactive environment to reproduce the issue, you can launch a devcontainer in vscode:" + echo "git clone --branch $GITHUB_REF_NAME --single-branch --recurse-submodules https://github.com/$GITHUB_REPOSITORY.git && cd $(echo $GITHUB_REPOSITORY | cut -d'/' -f2) && git checkout $GITHUB_SHA" + echo ".devcontainer/launch.sh ${{inputs.cuda_version}} ${{inputs.compiler}}${{inputs.compiler_version}}" + echo "Then, open a terminal inside vscode (ctrl+shift+\`) and run:" + echo "$cmd" + exit $exit_code + fi + sccache -s > sccache_after.txt + - name: Calculate sccache hit rate + run: | + hit_rate=$(./ci/sccache_hit_rate.sh sccache_before.txt sccache_after.txt 2>&1 >/dev/null) + echo "sccache hit rate: $hit_rate" >> $GITHUB_STEP_SUMMARY + test: + needs: build + if: ${{ !cancelled() && ( needs.build.result == 'success' || needs.build.result == 'skipped' ) && inputs.test_script != '' && inputs.test_image != '' }} + name: Test ${{inputs.compiler}}${{inputs.compiler_version}}/C++${{inputs.std}} + runs-on: linux-${{inputs.cpu}}-gpu-v100-latest-1 + container: + options: -u root + image: ${{ inputs.test_image }} + env: + NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }} + permissions: + id-token: write + steps: + # TODO: We can remove this when we aren't using submodules anymore + - name: Update git version + run: | + sudo apt-get install software-properties-common + sudo add-apt-repository ppa:git-core/ppa -y + sudo apt-get update + sudo apt-get install git -y + git --version + - name: Checkout repo + uses: actions/checkout@v3 + with: + submodules: 'recursive' + - name: Configure credentials and environment variables for sccache + uses: ./.github/actions/configure_cccl_sccache + - name: Run test script + run: | + sccache -s > sccache_before.txt + time ./${{ inputs.test_script }} "${{inputs.compiler_exe}}" "${{inputs.std}}" "${{inputs.gpu_build_archs}}" + sccache -s > sccache_after.txt + - name: Calculate sccache hit rate + run: | + hit_rate=$(./ci/sccache_hit_rate.sh sccache_before.txt sccache_after.txt 2>&1 >/dev/null) + echo "sccache hit rate: $hit_rate" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/compute-matrix.yml b/.github/workflows/compute-matrix.yml new file mode 100644 index 00000000000..bbd09e628f5 --- /dev/null +++ b/.github/workflows/compute-matrix.yml @@ -0,0 +1,66 @@ + +name: Compute the matrix for a given matrix type from the specified matrix file + +on: + workflow_call: + inputs: + matrix_file: + type: string + required: true + matrix_type: + description: "The desired matrix type. Currently, only 'pull-request' and 'nightly' are supported." + type: string + required: true + outputs: + FULL_MATRIX: + description: "The full matrix of build configurations for the given matrix type." + value: ${{ jobs.compute-matrix.outputs.FULL_MATRIX }} + CUDA_VERSIONS: + description: "The unique CUDA versions in the full matrix." + value: ${{ jobs.compute-matrix.outputs.CUDA_VERSIONS }} + COMPILERS: + description: "The unique compilers in the full matrix." + value: ${{ jobs.compute-matrix.outputs.COMPILERS }} + PER_CUDA_COMPILER_MATRIX: + description: "The matrix of build configurations for each CUDA version and compiler." + value: ${{ jobs.compute-matrix.outputs.PER_CUDA_COMPILER_MATRIX }} + +defaults: + run: + shell: bash + +env: + MATRIX_TYPE: ${{ inputs.matrix_type}} + MATRIX_FILE: ${{ inputs.matrix_file }} + +jobs: + compute-matrix: + name: ${{inputs.matrix_type}} + runs-on: ubuntu-latest + outputs: + FULL_MATRIX: ${{ steps.compute-matrix.outputs.FULL_MATRIX }} + CUDA_VERSIONS: ${{ steps.compute-matrix.outputs.CUDA_VERSIONS }} + COMPILERS: ${{ steps.compute-matrix.outputs.COMPILERS }} + PER_CUDA_COMPILER_MATRIX: ${{ steps.compute-matrix.outputs.PER_CUDA_COMPILER_MATRIX }} + steps: + - name: Validate matrix type + run: | + if [[ "$MATRIX_TYPE" != "pull-request" && "$MATRIX_TYPE" != "nightly" ]]; then + echo "Invalid build type: $MATRIX_TYPE. Must be 'nightly' or 'pull-request'" + exit 1 + fi + - name: Checkout repo + uses: actions/checkout@v3 + - name: Compute matrix + id: compute-matrix + run: | + echo "Input matrix file:" + cat "$MATRIX_FILE" + FULL_MATRIX=$(yq -o=json ./ci/matrix.yaml | jq -c --arg matrix_type "$MATRIX_TYPE" '[ .[$matrix_type][] | . as $o | {std: .std[]} + del($o.std)]') + echo "FULL_MATRIX=$FULL_MATRIX" | tee -a "$GITHUB_OUTPUT" + CUDA_VERSIONS=$(echo $FULL_MATRIX | jq -c '[.[] | .cuda] | unique') + echo "CUDA_VERSIONS=$CUDA_VERSIONS" | tee -a "$GITHUB_OUTPUT" + COMPILERS=$(echo $FULL_MATRIX | jq -c '[.[] | .compiler.name] | unique') + echo "COMPILERS=$COMPILERS" | tee -a "$GITHUB_OUTPUT" + PER_CUDA_COMPILER_MATRIX=$(echo $FULL_MATRIX | jq -c ' group_by(.cuda + .compiler.name) | map({(.[0].cuda + "-" + .[0].compiler.name): .}) | add') + echo "PER_CUDA_COMPILER_MATRIX=$PER_CUDA_COMPILER_MATRIX" | tee -a "$GITHUB_OUTPUT" \ No newline at end of file diff --git a/.github/workflows/dispatch-build-and-test.yml b/.github/workflows/dispatch-build-and-test.yml new file mode 100644 index 00000000000..39e4daf5533 --- /dev/null +++ b/.github/workflows/dispatch-build-and-test.yml @@ -0,0 +1,34 @@ +name: Dispatch build and test + +on: + workflow_call: + inputs: + per_cuda_compiler_matrix: {type: string, required: true} + build_script: {type: string, required: false} + test_script: {type: string, required: false} + +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: + name: ${{matrix.cpu}} + uses: ./.github/workflows/build-and-test.yml + strategy: + fail-fast: false + matrix: + include: ${{ fromJSON(inputs.per_cuda_compiler_matrix) }} + with: + cuda_version: ${{ matrix.cuda }} + compiler: ${{ matrix.compiler.name }} + compiler_exe: ${{ matrix.compiler.exe }} + compiler_version: ${{ matrix.compiler.version }} + std: ${{ matrix.std }} + gpu_build_archs: ${{ matrix.gpu_build_archs }} + cpu: ${{ matrix.cpu }} + os: ${{ matrix.os }} + build_script: ${{ inputs.build_script }} + build_image: rapidsai/devcontainers:23.06-cpp-${{matrix.compiler.name}}${{matrix.compiler.version}}-cuda${{matrix.cuda}}-${{matrix.os}} + test_script: ${{ inputs.test_script }} + test_image: rapidsai/devcontainers:23.06-cpp-${{matrix.compiler.name}}${{matrix.compiler.version}}-cuda${{matrix.cuda}}-${{matrix.os}} + diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000000..d70f94055ca --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,79 @@ + +# This is the main workflow that runs on every PR and push to main +name: pr + +defaults: + run: + shell: bash + +on: + push: + branches: + - main + - "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 + +jobs: + compute-matrix: + uses: ./.github/workflows/compute-matrix.yml + with: + matrix_file: "./ci/matrix.yaml" + matrix_type: "pull-request" + + thrust: + name: Thrust CUDA${{ matrix.cuda_version }} ${{ matrix.compiler }} + needs: compute-matrix + uses: ./.github/workflows/dispatch-build-and-test.yml + strategy: + fail-fast: false + matrix: + cuda_version: ${{ fromJSON(needs.compute-matrix.outputs.CUDA_VERSIONS) }} + compiler: ${{ fromJSON(needs.compute-matrix.outputs.COMPILERS) }} + with: + per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_MATRIX)[ format('{0}-{1}', matrix.cuda_version, matrix.compiler) ]) }} + build_script: "./ci/build_thrust.sh" + test_script: #"./ci/test_thrust.sh" + + cub: + name: CUB CUDA${{ matrix.cuda_version }} ${{ matrix.compiler }} + needs: compute-matrix + uses: ./.github/workflows/dispatch-build-and-test.yml + strategy: + fail-fast: false + matrix: + cuda_version: ${{ fromJSON(needs.compute-matrix.outputs.CUDA_VERSIONS) }} + compiler: ${{ fromJSON(needs.compute-matrix.outputs.COMPILERS) }} + with: + per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_MATRIX)[ format('{0}-{1}', matrix.cuda_version, matrix.compiler) ]) }} + build_script: "./ci/build_cub.sh" + test_script: #"./ci/test_cub.sh" + + libcudacxx: + name: libcudacxx CUDA${{ matrix.cuda_version }} ${{ matrix.compiler }} + needs: compute-matrix + uses: ./.github/workflows/dispatch-build-and-test.yml + strategy: + fail-fast: false + matrix: + cuda_version: ${{ fromJSON(needs.compute-matrix.outputs.CUDA_VERSIONS) }} + compiler: ${{ fromJSON(needs.compute-matrix.outputs.COMPILERS) }} + with: + per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_MATRIX)[ format('{0}-{1}', matrix.cuda_version, matrix.compiler) ]) }} + build_script: "./ci/build_libcudacxx.sh" + test_script: #"./ci/test_libcudacxx.sh" + + # 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 + ci: + runs-on: ubuntu-latest + name: CI + needs: + - libcudacxx + - cub + - thrust + steps: + - run: echo "CI success" diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..a221dae54e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.idea/ +*build*/ +.cache +.aws +.config \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..1b1cc4ba9f5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "libcudacxx"] + path = libcudacxx + url = ../libcudacxx.git +[submodule "cub"] + path = cub + url = ../cub +[submodule "thrust"] + path = thrust + url = ../thrust diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000000..4be3ba2e6d7 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,54 @@ +# 3.15 is the minimum for including the project with add_subdirectory. +# 3.21 is the minimum for the developer build. +cmake_minimum_required(VERSION 3.15) + +# Determine whether CCCL is the top-level project or included into +# another project via add_subdirectory() +if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}") + set(CCCL_TOPLEVEL_PROJECT ON) +endif() + +project(CCCL LANGUAGES NONE) + +# Optionally include installation rules for non-top-level builds: +option(CCCL_ENABLE_INSTALL_RULES "Enable installation of CCCL." ${CCCL_TOPLEVEL_PROJECT}) +if (CCCL_ENABLE_INSTALL_RULES) + include(cmake/CCCLInstallRules.cmake) +endif() + +# Support adding CCCL to a parent project via add_subdirectory. +if (NOT CCCL_TOPLEVEL_PROJECT) + include(cmake/CCCLAddSubdir.cmake) + return() +endif() + +# We require a higher cmake version for dev builds +cmake_minimum_required(VERSION 3.21) + +option(CCCL_ENABLE_LIBCUDACXX "Enable the libcu++ developer build." ON) +option(CCCL_ENABLE_CUB "Enable the CUB developer build." ON) +option(CCCL_ENABLE_THRUST "Enable the Thrust developer build." ON) +option(CCCL_ENABLE_TESTING "Enable CUDA C++ Core Library tests." ON) + +include(CTest) +enable_testing() + +if (CCCL_ENABLE_LIBCUDACXX) + set(LIBCUDACXX_TOPLEVEL_PROJECT ON) +endif() + +if (CCCL_ENABLE_CUB) + set(CUB_TOPLEVEL_PROJECT ON) +endif() + +if (CCCL_ENABLE_THRUST) + set(THRUST_TOPLEVEL_PROJECT ON) +endif() + +add_subdirectory(libcudacxx) +add_subdirectory(cub) +add_subdirectory(thrust) + +if (CCCL_ENABLE_TESTING) + add_subdirectory(test) +endif() diff --git a/README.md b/README.md index 13865022003..e15d6e2a76e 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,7 @@ The future home of the CUDA C++ Core Libraries (Thrust, CUB, libcu++). Stay tuned. + +## CI Pipeline Overview + +For a detailed overview of the CI pipeline, see [ci-overview.md](ci-overview.md). \ No newline at end of file diff --git a/ci-overview.md b/ci-overview.md new file mode 100644 index 00000000000..3334686c8dc --- /dev/null +++ b/ci-overview.md @@ -0,0 +1,112 @@ +# CCCL - Continuous Integration (CI) Workflow +As a header-only C++ library, the code we write isn't compiled until a developer includes it in their project. + +This means our code needs to be robust enough to compile and run across a variety of platforms, compilers, and configurations. +As such, maintaining extensive and thorough Continuous Integration (CI) coverage is crucial. + +Our CI system needs to test various combinations of operating systems, CPU architectures, compilers, and C++ standards. +The number of configurations can be quite large and hence our CI system must be designed to handle this complexity. +We use GitHub Actions for this purpose. It is flexible, powerful, and well-integrated with GitHub. + +This document will walk you through our CI workflow and guide you on how to interact with and troubleshoot it when needed. + +## Workflow Overview + +### TL;DR + +```mermaid +graph LR + A[Workflow Starts on Push to PR] + A --> B{Computes Matrix} + B --> C[For Each Matrix Configuration] + C --> D{Runs a Build Job} + D --> E[Build Job Completed] + E --> F{Runs a Test Job} + F --> G[Test Job Completed] + G --> H[CI Successful] +``` + +This repository relies on a GitHub Actions-based Continuous Integration (CI) workflow. Here's what you need to know: + +- **Trigger:** The main workflow triggers on every push to the main branch or pull request (PR). +- **Execution:** The workflow generates a matrix of build configurations, based on the settings in matrix.yml, and then dispatches separate build and test jobs for each configuration. +- **Failures:** If a job fails, you'll be notified through GitHub's interface. You can then check the logs for details. +- **Recovery:** To handle job failures, pull the relevant container image and rerun the script locally to reproduce the issue. + +### The Matrix + +The matrix defined in the [`matrix.yml`](ci/matrix.yaml) is the single source of truth for the environments we test our code against. +It dictates the build configurations, such as CUDA version, operating system, CPU architecture, compiler, GPU architectures, and C++ standards. +It allows us to test our code against different combinations of these variables to ensure our code's compatibility and stability. + +### Build and Test Jobs +Our CI workflow primarily revolves around two major types of jobs: build jobs and test jobs. + +#### Build +Build jobs compile our unit tests and examples in various environments, mimicking the conditions in which our users might compile the code. +These jobs simply invoke a build script (e.g., `build_thrust.sh`) which contains all the necessary steps to compile the code. + +The advantage of this approach is two-fold. +First, it allows us to keep our CI configuration files clean and focused on the orchestration of jobs rather than the specifics of building the code. +Second, it greatly simplifies the process of reproducing build issues outside of CI. +Developers can run the build script locally, in their environment, and the build will behave in the same way it does in CI. + +#### Test +After the build jobs have successfully compiled the test binaries, the test jobs run these binaries to execute our tests. +On first glance, you may notice that the test jobs are rebuilding all of the test binaries. +However, we are relying on sccache to cache the build artifacts from the build jobs and reuse them in the test jobs. + +Similar to the build jobs, test jobs use a script (e.g., `test_thrust.sh`) to define the steps required to execute the tests. +If a test fails in CI, developers can simply run the script in their local environment to reproduce the issue and debug it. + +The syntax of the build and test scripts is the same: +```bash +./ci/build_thrust.sh +./ci/test_thrust.sh + +#examples +./ci/build_thrust.sh g++ c++17 70;80;86 +``` + +In summary, the heart of our build and test jobs is the corresponding build or test script. +This design philosophy helps maintain a clear separation between CI orchestration and the specifics of building and testing. +Moreover, it paves the way for straightforward issue reproduction, thereby aiding developers in their debugging process. + +## Lifecycle of a Pull Request + +From creation to merging, a pull request in this project follows these steps: + +1. Create a PR: Once you make a change, open a PR. + - If you have write permission to the repository, CI workflow will automatically start. + - If you don't have write permission, the workflow will start once a maintainer comments on the PR with `/ok to test`. This comment is required for all subsequent workflow runs. +2. Wait for results: GitHub Actions executes the defined CI workflow, running jobs based on the matrix configuration. +3. Interpret results: Check the status of the workflow. If it passes, all tests have passed on all defined configurations, and your changes likely didn't break anything. +4. Handle failures: If any job fails, the logs will provide information on what went wrong. +5. Rerun jobs: If the failure seems unrelated to your changes (e.g., due to a temporary external issue), you can rerun the jobs. + +## Troubleshooting Guide + +If a CI job fails, here's what you can do to troubleshoot: + +1. Check the logs: The logs provide detailed information on what went wrong during the execution. This is your starting point. +2. Reproduce the issue locally: Pull the relevant container image and rerun the script that failed. This will allow you to dig into the issue in depth. +3. Fix the issue: Once you've identified the problem, you can make appropriate changes to your code and rerun the CI jobs. + +### How to Reproduce a CI Failure Locally + +When a build or test job fails, it will provide instructions on how to reproduce the failure locally using the exact same code and environment used in CI. + +For example, here is a screenshot of the log of a failed build job: + +![Build Job Failure](docs/images/repro_instructions.png) + +This provides instructions for both a command-line and a VSCode-based approach to reproduce the failure locally. + +When interating on a fix, the vscode devcontainer approach is recommended as it provides a convenient, interactive environment to debug the issue. + +## More Information + +You can refer to [GitHub Actions documentation](https://docs.github.com/en/actions) for a deeper understanding of the process and the [GitHub Actions workflows syntax](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions) to comprehend the workflow files' structure and syntax. + +You're not in this alone - the community is here to help. If you're stuck, don't hesitate to raise an issue or ask for assistance. Open source thrives on collaboration and learning. Happy coding! + diff --git a/ci/build_common.sh b/ci/build_common.sh new file mode 100755 index 00000000000..03fb5901892 --- /dev/null +++ b/ci/build_common.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -xeuo pipefail + +# Ensure the script is being executed in its containing directory +cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; + +# Check if the correct number of arguments has been provided +if [ "$#" -ne 3 ]; then + echo "Usage: $0 " + echo "The PARALLEL_LEVEL environment variable controls the amount of build parallelism. Default is the number of cores." + echo "Example: PARALLEL_LEVEL=8 $0 g++-8 14 \"70\" " + echo "Example: $0 clang++-8 17 \"70;75;80-virtual\" " + exit 1 +fi + +# Assign command line arguments to variables +readonly HOST_COMPILER=$(which $1) +readonly CXX_STANDARD=$2 + +# Replace spaces, commas and semicolons with semicolons for CMake list +readonly GPU_ARCHS=$(echo $3 | tr ' ,' ';') + +readonly PARALLEL_LEVEL=${PARALLEL_LEVEL:=$(nproc)} + +echo "========================================" +echo "Begin build" +echo "pwd=$(pwd)" +echo "HOST_COMPILER=$HOST_COMPILER" +echo "CXX_STANDARD=$CXX_STANDARD" +echo "GPU_ARCHS=$GPU_ARCHS" +echo "PARALLEL_LEVEL=$PARALLEL_LEVEL" +echo "========================================" \ No newline at end of file diff --git a/ci/build_cub.sh b/ci/build_cub.sh new file mode 100755 index 00000000000..7a3cf15594b --- /dev/null +++ b/ci/build_cub.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +source "$(dirname "$0")/build_common.sh" + +cmake -S .. -B ../build \ + -DCCCL_ENABLE_THRUST=OFF \ + -DCCCL_ENABLE_LIBCUDACXX=OFF \ + -DCCCL_ENABLE_CUB=ON \ + -DCCCL_ENABLE_TESTING=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=${HOST_COMPILER} \ + -DCMAKE_CUDA_ARCHITECTURES=${GPU_ARCHS} \ + -DCUB_ENABLE_DIALECT_CPP11=$(if [[ $CXX_STANDARD -ne 11 ]]; then echo "OFF"; else echo "ON"; fi) \ + -DCUB_ENABLE_DIALECT_CPP14=$(if [[ $CXX_STANDARD -ne 14 ]]; then echo "OFF"; else echo "ON"; fi) \ + -DCUB_ENABLE_DIALECT_CPP17=$(if [[ $CXX_STANDARD -ne 17 ]]; then echo "OFF"; else echo "ON"; fi) \ + -DCUB_ENABLE_DIALECT_CPP20=$(if [[ $CXX_STANDARD -ne 20 ]]; then echo "OFF"; else echo "ON"; fi) \ + -DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT=ON \ + -DCUB_IGNORE_DEPRECATED_CPP_DIALECT=ON \ + -Dlibcudacxx_ENABLE_INSTALL_RULES=ON \ + -DCUB_ENABLE_INSTALL_RULES=ON \ + -DTHRUST_ENABLE_INSTALL_RULES=ON \ + -G Ninja + +# Build the tests +cmake --build ../build + +echo "CUB build complete" diff --git a/ci/build_libcudacxx.sh b/ci/build_libcudacxx.sh new file mode 100755 index 00000000000..da0c7ad4d49 --- /dev/null +++ b/ci/build_libcudacxx.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +source "$(dirname "$0")/build_common.sh" + +cmake -S .. -B ../build \ + -DCCCL_ENABLE_THRUST=OFF \ + -DCCCL_ENABLE_LIBCUDACXX=ON \ + -DCCCL_ENABLE_CUB=OFF \ + -DCCCL_ENABLE_TESTING=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=${HOST_COMPILER} \ + -DCMAKE_CUDA_ARCHITECTURES=${GPU_ARCHS} \ + -DCMAKE_CUDA_HOST_COMPILER=${HOST_COMPILER} \ + -DLIBCUDACXX_ENABLE_LIBCUDACXX_TESTS=ON \ + -Dlibcudacxx_ENABLE_INSTALL_RULES=ON \ + -DCUB_ENABLE_INSTALL_RULES=ON \ + -DTHRUST_ENABLE_INSTALL_RULES=ON \ + -G Ninja + +LIBCUDACXX_SITE_CONFIG="../build/libcudacxx/test/lit.site.cfg" lit -v --no-progress-bar --no-execute -Dcompute_archs=${GPU_ARCHS} -Dstd="c++${CXX_STANDARD}" ../libcudacxx/.upstream-tests/test + diff --git a/ci/build_thrust.sh b/ci/build_thrust.sh new file mode 100755 index 00000000000..72e2c291d88 --- /dev/null +++ b/ci/build_thrust.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +source "$(dirname "$0")/build_common.sh" + +cmake -S .. -B ../build \ + -DCCCL_ENABLE_THRUST=ON \ + -DCCCL_ENABLE_LIBCUDACXX=OFF \ + -DCCCL_ENABLE_CUB=OFF \ + -DCCCL_ENABLE_TESTING=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=${HOST_COMPILER} \ + -DCMAKE_CUDA_ARCHITECTURES=${GPU_ARCHS} \ + -DTHRUST_ENABLE_MULTICONFIG=ON \ + -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP11=$(if [[ $CXX_STANDARD -ne 11 ]]; then echo "OFF"; else echo "ON"; fi) \ + -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP14=$(if [[ $CXX_STANDARD -ne 14 ]]; then echo "OFF"; else echo "ON"; fi) \ + -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP17=$(if [[ $CXX_STANDARD -ne 17 ]]; then echo "OFF"; else echo "ON"; fi) \ + -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP20=$(if [[ $CXX_STANDARD -ne 20 ]]; then echo "OFF"; else echo "ON"; fi) \ + -DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT=ON \ + -DCUB_IGNORE_DEPRECATED_CPP_DIALECT=ON \ + -Dlibcudacxx_ENABLE_INSTALL_RULES=ON \ + -DCUB_ENABLE_INSTALL_RULES=ON \ + -DTHRUST_ENABLE_INSTALL_RULES=ON \ + -G Ninja + # TODO: Add this back after Thrust removes the check against it. + #-DCMAKE_CUDA_HOST_COMPILER=${HOST_COMPILER} \ + +# Build the tests +cmake --build ../build --parallel ${PARALLEL_LEVEL} -- -v + +echo "Thrust build complete" diff --git a/ci/matrix.yaml b/ci/matrix.yaml new file mode 100644 index 00000000000..7a78a9ea183 --- /dev/null +++ b/ci/matrix.yaml @@ -0,0 +1,41 @@ +#gcc + + +# The GPUs to test on +# Note: This assumes that the appropriate gpu_build_archs are set to include building for the GPUs listed here +gpus: + - 'a100' + - 'v100' + +# 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 +# gpu_build_archs: The GPU architectures to build for using the syntax of CMAKE_CUDA_ARCHITECTURES (semi-colon separated list) +# 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: +- {cuda: '11.1', os: 'ubuntu18.04', cpu: 'amd64', compiler: {name: 'gcc', version: '7', exe: 'g++'}, gpu_build_archs: '70', std: [11, 14, 17]} +- {cuda: '11.1', os: 'ubuntu18.04', cpu: 'amd64', compiler: {name: 'gcc', version: '8', exe: 'g++'}, gpu_build_archs: '70', std: [11, 14, 17]} +- {cuda: '11.1', os: 'ubuntu18.04', cpu: 'amd64', compiler: {name: 'gcc', version: '9', exe: 'g++'}, gpu_build_archs: '70', std: [11, 14, 17]} +- {cuda: '12.1', os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'gcc', version: '7', exe: 'g++'}, gpu_build_archs: '70', std: [11, 14, 17]} +- {cuda: '12.1', os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'gcc', version: '8', exe: 'g++'}, gpu_build_archs: '70', std: [11, 14, 17]} +- {cuda: '12.1', os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'gcc', version: '9', exe: 'g++'}, gpu_build_archs: '70', std: [11, 14, 17]} +- {cuda: '12.1', os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'gcc', version: '10', exe: 'g++'}, gpu_build_archs: '70', std: [11, 14, 17, 20]} +- {cuda: '12.1', os: 'ubuntu22.04', cpu: 'amd64', compiler: {name: 'gcc', version: '11', exe: 'g++'}, gpu_build_archs: '70', std: [11, 14, 17, 20]} +- {cuda: '12.1', os: 'ubuntu22.04', cpu: 'amd64', compiler: {name: 'gcc', version: '12', exe: 'g++'}, gpu_build_archs: '70', std: [11, 14, 17, 20]} +- {cuda: '11.1', os: 'ubuntu18.04', cpu: 'amd64', compiler: {name: 'llvm', version: '9', exe: 'clang++'}, gpu_build_archs: '70', std: [11, 14, 17]} +- {cuda: '12.1', os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'llvm', version: '9', exe: 'clang++'}, gpu_build_archs: '70', std: [11, 14, 17]} +- {cuda: '12.1', os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'llvm', version: '10', exe: 'clang++'}, gpu_build_archs: '70', std: [11, 14, 17]} +- {cuda: '12.1', os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'llvm', version: '11', exe: 'clang++'}, gpu_build_archs: '70', std: [11, 14, 17, 20]} +- {cuda: '12.1', os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'llvm', version: '12', exe: 'clang++'}, gpu_build_archs: '70', std: [11, 14, 17, 20]} +- {cuda: '12.1', os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'llvm', version: '13', exe: 'clang++'}, gpu_build_archs: '70', std: [11, 14, 17, 20]} +- {cuda: '12.1', os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'llvm', version: '14', exe: 'clang++'}, gpu_build_archs: '70', std: [11, 14, 17, 20]} +- {cuda: '12.1', os: 'ubuntu22.04', cpu: 'amd64', compiler: {name: 'llvm', version: '15', exe: 'clang++'}, gpu_build_archs: '70', std: [11, 14, 17, 20]} diff --git a/ci/sccache_hit_rate.sh b/ci/sccache_hit_rate.sh new file mode 100755 index 00000000000..5333e84fae1 --- /dev/null +++ b/ci/sccache_hit_rate.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -euo pipefail + +# Ensure two arguments are provided +if [ $# -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Print the contents of the before file +echo "=== Contents of $1 ===" +cat $1 +echo "=== End of $1 ===" + +# Print the contents of the after file +echo "=== Contents of $2 ===" +cat $2 +echo "=== End of $2 ===" + +# Extract compile requests and cache hits from the before and after files +requests_before=$(awk '/^Compile requests[[:space:]]+[[:digit:]]+/ {print $3}' $1) +hits_before=$(awk '/^Cache hits[[:space:]]+[[:digit:]]+/ {print $3}' $1) +requests_after=$(awk '/^Compile requests[[:space:]]+[[:digit:]]+/ {print $3}' $2) +hits_after=$(awk '/^Cache hits[[:space:]]+[[:digit:]]+/ {print $3}' $2) + +# Calculate the differences to find out how many new requests and hits +requests_diff=$((requests_after - requests_before)) +hits_diff=$((hits_after - hits_before)) + +# Calculate and print the hit rate +if [ $requests_diff -eq 0 ]; then + echo "No new compile requests, hit rate is not applicable" +else + hit_rate=$(awk -v hits=$hits_diff -v requests=$requests_diff 'BEGIN {printf "%.2f", hits/requests * 100}') + echo "sccache hit rate: $hit_rate%" + # Write just the hit rate out to stderr to make it easier to get this value later + echo "$hit_rate" >&2 +fi diff --git a/ci/test_cub.sh b/ci/test_cub.sh new file mode 100755 index 00000000000..74beba45bb8 --- /dev/null +++ b/ci/test_cub.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -xeuo pipefail + +# Ensure the script is being executed in its containing directory +cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; + +./build_cub.sh "$@" + +ctest --test-dir ../build --output-on-failure --timeout 15 + +echo "CUB test complete" \ No newline at end of file diff --git a/ci/test_libcudacxx.sh b/ci/test_libcudacxx.sh new file mode 100755 index 00000000000..989f72a9ec3 --- /dev/null +++ b/ci/test_libcudacxx.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +source "$(dirname "$0")/build_common.sh" + +cmake -S .. -B ../build \ + -DCCCL_ENABLE_THRUST=OFF \ + -DCCCL_ENABLE_LIBCUDACXX=ON \ + -DCCCL_ENABLE_CUB=OFF \ + -DCCCL_ENABLE_TESTING=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=${HOST_COMPILER} \ + -DCMAKE_CUDA_ARCHITECTURES=${GPU_ARCHS} \ + -DCMAKE_CUDA_HOST_COMPILER=${HOST_COMPILER} \ + -DLIBCUDACXX_ENABLE_LIBCUDACXX_TESTS=ON \ + -Dlibcudacxx_ENABLE_INSTALL_RULES=ON \ + -DCUB_ENABLE_INSTALL_RULES=ON \ + -DTHRUST_ENABLE_INSTALL_RULES=ON \ + -G Ninja + +LIBCUDACXX_SITE_CONFIG="../build/libcudacxx/test/lit.site.cfg" lit -v --no-progress-bar -Dcompute_archs=${GPU_ARCHS} -Dstd="c++${CXX_STANDARD}" ../libcudacxx/.upstream-tests/test + diff --git a/ci/test_thrust.sh b/ci/test_thrust.sh new file mode 100755 index 00000000000..cec1deca519 --- /dev/null +++ b/ci/test_thrust.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -xeuo pipefail + +# Ensure the script is being executed in its containing directory +cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; + +./build_thrust.sh "$@" + +ctest --test-dir ../build --output-on-failure --timeout 15 + +echo "Thrust test complete" + diff --git a/cmake/CCCLAddSubdir.cmake b/cmake/CCCLAddSubdir.cmake new file mode 100644 index 00000000000..b76238442d3 --- /dev/null +++ b/cmake/CCCLAddSubdir.cmake @@ -0,0 +1,6 @@ +find_package(CCCL REQUIRED CONFIG + NO_DEFAULT_PATH # Only check the explicit path in HINTS: + HINTS "${CCCL_SOURCE_DIR}" + COMPONENTS ${CCCL_REQUIRED_COMPONENTS} + OPTIONAL_COMPONENTS ${CCCL_OPTIONAL_COMPONENTS} +) diff --git a/cmake/CCCLInstallRules.cmake b/cmake/CCCLInstallRules.cmake new file mode 100644 index 00000000000..ca44b1b3d22 --- /dev/null +++ b/cmake/CCCLInstallRules.cmake @@ -0,0 +1,10 @@ +# Bring in CMAKE_INSTALL_LIBDIR +include(GNUInstallDirs) + +# CCCL has no installable binaries, no need to build before installing: +set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE) + +install(DIRECTORY "${CCCL_SOURCE_DIR}/lib/cmake/cccl" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/" + PATTERN *.cmake.in EXCLUDE +) diff --git a/cub b/cub new file mode 160000 index 00000000000..b729edbf8e6 --- /dev/null +++ b/cub @@ -0,0 +1 @@ +Subproject commit b729edbf8e6d43709e3ff21f9f78d6178b54fc60 diff --git a/docs/images/repro_instructions.png b/docs/images/repro_instructions.png new file mode 100644 index 00000000000..f0579650823 Binary files /dev/null and b/docs/images/repro_instructions.png differ diff --git a/lib/cmake/cccl/cccl-config-version.cmake b/lib/cmake/cccl/cccl-config-version.cmake new file mode 100644 index 00000000000..1e026c98334 --- /dev/null +++ b/lib/cmake/cccl/cccl-config-version.cmake @@ -0,0 +1,22 @@ +set(CCCL_VERSION_MAJOR 2) +set(CCCL_VERSION_MINOR 2) +set(CCCL_VERSION_PATCH 0) +set(CCCL_VERSION_TWEAK 0) + +set(CCCL_VERSION "${CCCL_VERSION_MAJOR}.${CCCL_VERSION_MINOR}.${CCCL_VERSION_PATCH}.${CCCL_VERSION_TWEAK}") + +set(PACKAGE_VERSION ${CCCL_VERSION}) +set(PACKAGE_VERSION_COMPATIBLE FALSE) +set(PACKAGE_VERSION_EXACT FALSE) +set(PACKAGE_VERSION_UNSUITABLE FALSE) + +# Semantic versioning: +if(PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION) + if(CCCL_VERSION_MAJOR VERSION_EQUAL PACKAGE_FIND_VERSION_MAJOR) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + endif() + + if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/lib/cmake/cccl/cccl-config.cmake b/lib/cmake/cccl/cccl-config.cmake new file mode 100644 index 00000000000..7bc6cf7b47e --- /dev/null +++ b/lib/cmake/cccl/cccl-config.cmake @@ -0,0 +1,66 @@ +# +# find_package(CCCL) config file. +# +# Imports the Thrust, CUB, and libcudacxx components of the NVIDIA +# CUDA/C++ Core Libraries. + +set(cccl_cmake_dir "${CMAKE_CURRENT_LIST_DIR}") + +if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(cccl_quiet_flag "QUIET") +else() + set(cccl_quiet_flag "") +endif() + +if (DEFINED ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS AND + ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) + set(components ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS}) +else() + set(components Thrust CUB libcudacxx) +endif() + +foreach(component IN LISTS components) + string(TOLOWER "${component}" component_lower) + + unset(req) + if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${component}) + set(cccl_comp_required_flag "REQUIRED") + endif() + + if(component_lower STREQUAL "libcudacxx") + find_package(libcudacxx ${CCCL_VERSION} EXACT CONFIG + ${cccl_quiet_flag} + ${cccl_comp_required_flag} + NO_DEFAULT_PATH # Only check the explicit HINTS below: + HINTS + "${cccl_cmake_dir}/../../../libcudacxx/lib/cmake/" # Source layout (GitHub) + "${cccl_cmake_dir}/.." # Install layout + ) + elseif(component_lower STREQUAL "cub") + find_package(CUB ${CCCL_VERSION} EXACT CONFIG + ${cccl_quiet_flag} + ${cccl_comp_required_flag} + NO_DEFAULT_PATH # Only check the explicit HINTS below: + HINTS + "${cccl_cmake_dir}/../../../cub/cub/cmake/" # Source layout (GitHub) + "${cccl_cmake_dir}/.." # Install layout + ) + elseif(component_lower STREQUAL "thrust") + find_package(Thrust ${CCCL_VERSION} EXACT CONFIG + ${cccl_quiet_flag} + ${cccl_comp_required_flag} + NO_DEFAULT_PATH # Only check the explicit HINTS below: + HINTS + "${cccl_cmake_dir}/../../../thrust/thrust/cmake/" # Source layout (GitHub) + "${cccl_cmake_dir}/.." # Install layout + ) + else() + message(FATAL_ERROR "Invalid CCCL component requested: '${component}'") + endif() +endforeach() + +include(FindPackageHandleStandardArgs) +if (NOT CCCL_CONFIG) + set(CCCL_CONFIG "${CMAKE_CURRENT_LIST_FILE}") +endif() +find_package_handle_standard_args(CCCL CONFIG_MODE) diff --git a/libcudacxx b/libcudacxx new file mode 160000 index 00000000000..2070f2efd8e --- /dev/null +++ b/libcudacxx @@ -0,0 +1 @@ +Subproject commit 2070f2efd8e93a5f952d4fa013b460437fe7bdab diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000000..24c8f171635 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(cmake) diff --git a/test/cmake/CMakeLists.txt b/test/cmake/CMakeLists.txt new file mode 100644 index 00000000000..c8f3aa32b92 --- /dev/null +++ b/test/cmake/CMakeLists.txt @@ -0,0 +1,81 @@ +set(cmake_opts + -D "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" + -D "CMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}" + -D "CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" +) + +# Temporary installation prefix for tests against installed project: +set(tmp_install_prefix "${CMAKE_CURRENT_BINARY_DIR}/test_install") + +# Add a build-and-test CTest. +# - full_test_name_var will be set to the full name of the test. +# - subdir is the relative path to the test project directory. +# - test_id is used to generate a unique name for this test, allowing the +# subdir to be reused. +# - Any additional args will be passed to the project configure step. +function(cccl_add_compile_test full_test_name_var subdir test_id) + set(test_name cccl.test.cmake.${subdir}.${test_id}) + set(src_dir "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}") + set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/${subdir}/${test_id}") + add_test(NAME ${test_name} + COMMAND "${CMAKE_CTEST_COMMAND}" + --build-and-test "${src_dir}" "${build_dir}" + --build-generator "${CMAKE_GENERATOR}" + --build-options + ${cmake_opts} + ${ARGN} + --test-command "${CMAKE_CTEST_COMMAND}" --output-on-failure + ) + set(${full_test_name_var} ${test_name} PARENT_SCOPE) +endfunction() + +foreach (root_type IN ITEMS SOURCE INSTALL) + if (root_type STREQUAL "INSTALL") + set(cccl_root "${tmp_install_prefix}") + else() + set(cccl_root "${CCCL_SOURCE_DIR}") + endif() + + foreach (components IN ITEMS DEFAULT Thrust CUB libcudacxx) + set(package_types CCCL) + if (NOT components STREQUAL "DEFAULT") + list(APPEND package_types NATIVE) + endif() + if (root_type STREQUAL "SOURCE") + list(APPEND package_types SUBDIR) + endif() + foreach (package_type IN LISTS package_types) + string(TOLOWER "${root_type}.${package_type}.${components}" suffix) + cccl_add_compile_test(test_name + test_export + "${suffix}" + -D "CCCL_ROOT=${cccl_root}" + -D "ROOT_TYPE=${root_type}" + -D "COMPONENTS=${components}" + -D "PACKAGE_TYPE=${package_type}" + ) + + if (root_type STREQUAL "INSTALL") + set_tests_properties(${test_name} PROPERTIES FIXTURES_REQUIRED install_tree) + endif() + endforeach() # package_type + endforeach() # components +endforeach() # root_type + +################################################################################ +# Install tree fixtures +add_test(NAME cccl.test.cmake.install_tree.install + COMMAND "${CMAKE_COMMAND}" + --install "${CCCL_BINARY_DIR}" + --prefix "${tmp_install_prefix}" +) +set_tests_properties(cccl.test.cmake.install_tree.install PROPERTIES + FIXTURES_SETUP install_tree +) + +add_test(NAME cccl.test.cmake.install_tree.cleanup + COMMAND "${CMAKE_COMMAND}" -E rm -rf "${tmp_install_prefix}" +) +set_tests_properties(cccl.test.cmake.install_tree.cleanup PROPERTIES + FIXTURES_CLEANUP install_tree +) diff --git a/test/cmake/test_export/CMakeLists.txt b/test/cmake/test_export/CMakeLists.txt new file mode 100644 index 00000000000..cfa86f2e3a4 --- /dev/null +++ b/test/cmake/test_export/CMakeLists.txt @@ -0,0 +1,140 @@ +# Test the CMake packages for CCCL and all subprojects. +# +# Parameters: +# - CCCL_ROOT [Path] Root of the CCCL repo, or an installation root. +# - ROOT_TYPE [String] {SOURCE | INSTALL} Whether CCCL_ROOT is an +# installation prefix or the source root. +# - COMPONENTS [StringList] {Thrust CUB libcudacxx} Which CCCL subprojects +# should be found. +# - PACKAGE_TYPE [String] {CCCL | NATIVE | SUBDIR}: +# - CCCL -> `find_package(CCCL COMPONENTS )` +# - NATIVE -> `find_package()` +# - SUBDIR -> `set(CCCL_REQUIRED_COMPONENTS )` +# `add_subdirectory(${cccl_root})` + + +cmake_minimum_required(VERSION 3.21) +project(CCCLTestExport LANGUAGES CXX) + +include(CTest) +enable_testing() + +set(CCCL_ROOT "" CACHE PATH + "Root of the CCCL repo, or an installation root.") +set(ROOT_TYPE "" CACHE STRING + "{SOURCE | INSTALL} Whether CCCL_ROOT is an install prefix or source root.") +set_property(CACHE ROOT_TYPE PROPERTY STRINGS SOURCE INSTALL) +set(COMPONENTS "" CACHE STRING + "DEFAULT for no components, or semi-colon delimited list of Thrust, CUB, and/or libcudacxx.") +set(PACKAGE_TYPE "" CACHE STRING + "CCCL: Find CCCL with subpackages as components; NATIVE: Find subpackages directly; SUBDIR: add_subdirectory(${CCCL_ROOT}") +set_property(CACHE PACKAGE_TYPE PROPERTY STRINGS CCCL NATIVE SUBDIR) + +message(STATUS "CCCL_ROOT=${CCCL_ROOT}") +message(STATUS "ROOT_TYPE=${ROOT_TYPE}") +message(STATUS "COMPONENTS=${COMPONENTS}") +message(STATUS "PACKAGE_TYPE=${PACKAGE_TYPE}") + +# TODO `ROOT_TYPE` probably won't be needed after the configs are all moved +# to the CCCL repo. +if (ROOT_TYPE STREQUAL "SOURCE") + cmake_path(APPEND CCCL_ROOT thrust OUTPUT_VARIABLE Thrust_ROOT) + cmake_path(APPEND CCCL_ROOT cub OUTPUT_VARIABLE CUB_ROOT) + cmake_path(APPEND CCCL_ROOT libcudacxx OUTPUT_VARIABLE libcudacxx_ROOT) +elseif (ROOT_TYPE STREQUAL "INSTALL") + set(Thrust_ROOT "${CCCL_ROOT}") + set(CUB_ROOT "${CCCL_ROOT}") + set(libcudacxx_ROOT "${CCCL_ROOT}") +else() + message(FATAL_ERROR "Invalid ROOT_TYPE: ${ROOT_TYPE}") +endif() + +message(STATUS "Thrust_ROOT=${Thrust_ROOT}") +message(STATUS "CUB_ROOT=${CUB_ROOT}") +message(STATUS "libcudacxx_ROOT=${libcudacxx_ROOT}") + +function(do_find_package pkg_name pkg_prefix) + list(APPEND arg_list + REQUIRED + ${ARGN} + NO_DEFAULT_PATH + HINTS "${pkg_prefix}" + ) + list(JOIN arg_list " " arg_str) + message(STATUS "Executing: find_package(${pkg_name} ${arg_str})") + find_package(${pkg_name} ${arg_list}) + if (NOT ${pkg_name}_FOUND) + message(FATAL_ERROR "Failed: find_package(${pkg_name} ${arg_str})") + endif() +endfunction() + +# Run find package with the requested configuration: +if (PACKAGE_TYPE STREQUAL "CCCL") + if (COMPONENTS STREQUAL "DEFAULT") + do_find_package(CCCL "${CCCL_ROOT}") + else() + do_find_package(CCCL "${CCCL_ROOT}" COMPONENTS ${COMPONENTS}) + endif() +elseif(PACKAGE_TYPE STREQUAL "NATIVE") + if (COMPONENTS STREQUAL "DEFAULT") + message(FATAL_ERROR "COMPONENTS=DEFAULT incompatible with PACKAGE_TYPE=NATIVE") + endif() + foreach (component IN LISTS COMPONENTS) + do_find_package(${component} "${${component}_ROOT}") + endforeach() +elseif(PACKAGE_TYPE STREQUAL "SUBDIR") + if (COMPONENTS STREQUAL "DEFAULT") + set(CCCL_REQUIRED_COMPONENTS) + else() + set(CCCL_REQUIRED_COMPONENTS ${COMPONENTS}) + endif() + add_subdirectory("${CCCL_ROOT}" "${CMAKE_CURRENT_BINARY_DIR}/subdir") +else() + message(FATAL_ERROR "Invalid PACKAGE_TYPE: ${PACKAGE_TYPE}") +endif() + +if (COMPONENTS STREQUAL "DEFAULT") + set(COMPONENTS libcudacxx CUB Thrust) +endif() + +foreach (component IN LISTS COMPONENTS) + set(test_target version_check.${component}) + set(component_target "${component}::${component}") + add_executable(${test_target} version_check.cxx) + target_link_libraries(${test_target} PRIVATE ${component_target}) + add_test(NAME ${test_target} COMMAND ${test_target}) + + if (component STREQUAL "libcudacxx") + # TODO Should this be a genex? Will these stay correct as versions change? + math(EXPR component_cmake_version + "(${LIBCUDACXX_VERSION_MAJOR} * 1000000) + + ${LIBCUDACXX_VERSION_MINOR} * 1000 + + ${LIBCUDACXX_VERSION_PATCH}") + target_compile_definitions(${test_target} PRIVATE + "VERSION_HEADER=cuda/std/version" + "VERSION_MACRO=_LIBCUDACXX_CUDA_API_VERSION" + "EXPECTED_VERSION=${component_cmake_version}") + elseif (component STREQUAL "CUB") + # TODO Should this be a genex? Will these stay correct as versions change? + math(EXPR component_cmake_version + "(${CUB_VERSION_MAJOR} * 100000) + + ${CUB_VERSION_MINOR} * 100 + + ${CUB_VERSION_PATCH}") + target_compile_definitions(${test_target} PRIVATE + "VERSION_HEADER=cub/version.cuh" + "VERSION_MACRO=CUB_VERSION" + "EXPECTED_VERSION=${component_cmake_version}") + elseif (component STREQUAL "Thrust") + # TODO Should this be a genex? Will these stay correct as versions change? + math(EXPR component_cmake_version + "(${THRUST_VERSION_MAJOR} * 100000) + + ${THRUST_VERSION_MINOR} * 100 + + ${THRUST_VERSION_PATCH}") + target_compile_definitions(${test_target} PRIVATE + "VERSION_HEADER=thrust/version.h" + "VERSION_MACRO=THRUST_VERSION" + "EXPECTED_VERSION=${component_cmake_version}") + else() + message(FATAL_ERROR "Valid COMPONENTS are (case-sensitive): Thrust;CUB;libcudacxx") + endif() +endforeach() diff --git a/test/cmake/test_export/version_check.cxx b/test/cmake/test_export/version_check.cxx new file mode 100644 index 00000000000..c09e8d9cd1f --- /dev/null +++ b/test/cmake/test_export/version_check.cxx @@ -0,0 +1,20 @@ +// Compile with: +// -DVERSION_HEADER=include/path/for/version.h +// -DEXPECTED_VERSION=XXYYZZ +// -DVERSION_MACRO=PROJECT_VERSION + +#define HEADER +#include HEADER + +#include + +#define DETECTED_VERSION VERSION_MACRO + +int main() +{ + printf("Expected version: %d\n" + "Detected version: %d\n", + EXPECTED_VERSION, + VERSION_MACRO); + return EXPECTED_VERSION == DETECTED_VERSION ? 0 : 1; +} diff --git a/thrust b/thrust new file mode 160000 index 00000000000..d5ccadeda97 --- /dev/null +++ b/thrust @@ -0,0 +1 @@ +Subproject commit d5ccadeda9716c9f74cbc2a0fb1cfb230b7f3dc4