diff --git a/features/src/llvm/devcontainer-feature.json b/features/src/llvm/devcontainer-feature.json index aaf5cf5f..db18ba5c 100644 --- a/features/src/llvm/devcontainer-feature.json +++ b/features/src/llvm/devcontainer-feature.json @@ -9,6 +9,7 @@ "proposals": [ "dev", "17", + "16.grco", "16", "15", "14", diff --git a/features/src/llvm/install.sh b/features/src/llvm/install.sh index 2cd70cce..a853ef88 100755 --- a/features/src/llvm/install.sh +++ b/features/src/llvm/install.sh @@ -22,26 +22,55 @@ check_packages \ software-properties-common \ ; -if [[ -z "$LLVM_VERSION" \ - || "$LLVM_VERSION" == "latest" \ - || "$LLVM_VERSION" == "dev" \ - || "$LLVM_VERSION" == "pre" \ - || "$LLVM_VERSION" == "prerelease" \ -]]; then - LLVM_VERSION="latest"; - find_version_from_git_tags \ - LLVM_VERSION \ - https://github.com/llvm/llvm-project \ - "tags/llvmorg-" "." "-init" "true"; - LLVM_VERSION="$(echo $LLVM_VERSION | grep -oP '[0-9]+')"; -fi +install_clang_grace() { + if [[ "$(uname -p)" != "aarch64" ]]; then + echo "Clang for Grace is only supported on aarch64" + exit 0; + fi + + echo "Installing NVIDIA Clang for Grace" + wget -O clang-grace-toolchain.deb https://developer.nvidia.com/downloads/assets/grace/clang/16.23.08/clang-grace-toolchain_16.23.08_arm64.deb + apt-get -y install ./clang-grace-toolchain.deb + + PATH="/opt/nvidia/clang/16.23.08/bin:$PATH" + (update-alternatives --install /usr/bin/clang clang $(which clang) 30); + (update-alternatives --install /usr/bin/clang-16 clang-16 $(which clang) 30); + (update-alternatives --install /usr/bin/clang++ clang++ $(which clang++) 30); + (update-alternatives --install /usr/bin/clang++-16 clang++-16 $(which clang++) 30); +} -echo "Installing llvm-${LLVM_VERSION} compilers and tools"; +install_llvm() { + if [[ -z "$LLVM_VERSION" \ + || "$LLVM_VERSION" == "latest" \ + || "$LLVM_VERSION" == "dev" \ + || "$LLVM_VERSION" == "pre" \ + || "$LLVM_VERSION" == "prerelease" \ + ]]; then + LLVM_VERSION="latest"; + find_version_from_git_tags \ + LLVM_VERSION \ + https://github.com/llvm/llvm-project \ + "tags/llvmorg-" "." "-init" "true"; + LLVM_VERSION="$(echo $LLVM_VERSION | grep -oP '[0-9]+')"; + fi + + echo "Installing llvm-${LLVM_VERSION} compilers and tools"; -./llvm.sh $LLVM_VERSION ${PACKAGES:-all}; + ./llvm.sh $LLVM_VERSION ${PACKAGES:-all}; +} + +if [[ "$LLVM_VERSION" == "16.grco" ]]; then + LLVM_VERSION="16" + install_llvm + install_clang_grace + LLVM_TOOLS=( clangd clang-format clang-tidy ) +else + install_llvm + LLVM_TOOLS=( clang clangd clang++ clang-format clang-tidy lldb llvm-config llvm-cov ) +fi # Remove existing, install, and set default clang/llvm alternatives -for x in clang clangd clang++ clang-format clang-tidy lldb llvm-config llvm-cov; do +for x in ${LLVM_TOOLS[@]}; do if type ${x}-${LLVM_VERSION} >/dev/null 2>&1; then if ${x} != clang-format; then (update-alternatives --remove-all ${x} >/dev/null 2>&1 || true); diff --git a/matrix.yml b/matrix.yml index b8545fe3..435fdad8 100644 --- a/matrix.yml +++ b/matrix.yml @@ -25,6 +25,7 @@ x-llvm-14: &llvm_14 { name: "llvm", version: "14" } x-llvm-15: &llvm_15 { name: "llvm", version: "15" } x-llvm-prev: &llvm_prev { name: "llvm", version: "16" } x-llvm-curr: &llvm_curr { name: "llvm", version: "17" } +x-llvm-grco: &llvm_grco { name: "llvm", version: "16.grco" } x-llvm-env: &llvm_env {CC: "clang", CXX: "clang++", CUDAHOSTCXX: "clang++"} x-nvhpc-prev: &nvhpc_prev { name: "nvhpc", version: "23.5" } @@ -82,6 +83,7 @@ include: - {features: [*gcc_12, {<<: *cuda_curr_max, <<: *cccl_cuda_opts}, *python, *cccl_dev], env: *gcc_env} - {features: [*gcc_13, {<<: *cuda_curr_max, <<: *cccl_cuda_opts}, *python, *cccl_dev], env: *gcc_env} - {features: [*llvm_15, {<<: *cuda_curr_max, <<: *cccl_cuda_opts}, *python, *cccl_dev], env: *llvm_env} + - {features: [*llvm_grco, {<<: *cuda_curr_max, <<: *cccl_cuda_opts}, *python, *cccl_dev], env: *llvm_env} - {features: [*llvm_prev, {<<: *cuda_curr_max, <<: *cccl_cuda_opts}, *python, *cccl_dev], env: *llvm_env} - {features: [*llvm_curr, {<<: *cuda_curr_max, <<: *cccl_cuda_opts}, *python, *cccl_dev], env: *llvm_env} - {features: [*oneapi_2022, {<<: *cuda_curr_max, <<: *cccl_cuda_opts}, *python, *cccl_dev], env: *onapi_env}