Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions features/src/llvm/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"proposals": [
"dev",
"17",
"16.grco",
"16",
"15",
"14",
Expand Down
61 changes: 45 additions & 16 deletions features/src/llvm/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Are we okay hard coding the version for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see another version publicly. We can devise a mechanism later probably.

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);
Expand Down
2 changes: 2 additions & 0 deletions matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -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}
Expand Down