Skip to content

Commit

Permalink
Add basic CI testing for clang (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhan authored Aug 9, 2023
1 parent bfe9c6b commit 587955a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
common --announce_rc

# Convenient flag shortcuts.
build --flag_alias=enable_cuda=//cuda:enable
build --flag_alias=cuda_archs=//cuda:archs
Expand All @@ -13,6 +15,6 @@ build:clang --repo_env=CC=clang
build:clang --//cuda:compiler=clang

# https://github.com/bazel-contrib/rules_cuda/issues/1
build --ui_event_filters=-INFO
# build --ui_event_filters=-INFO

common:bzlmod --enable_bzlmod
27 changes: 27 additions & 0 deletions .github/workflows/build-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ jobs:
cases:
- { os: "ubuntu-20.04", cuda-version: "11.2.2", source: "nvidia" }
- { os: "ubuntu-20.04", cuda-version: "11.6.2", source: "nvidia" }
- {
os: "ubuntu-20.04",
cuda-version: "11.6.2",
source: "nvidia",
toolchain: "llvm",
toolchain-version: "16",
}
- {
os: "ubuntu-22.04",
cuda-version: "11.5.1-1ubuntu1",
Expand Down Expand Up @@ -47,6 +54,26 @@ jobs:
tree ${CUDA_PATH}/bin
tree ${CUDA_PATH}/include
tree ${CUDA_PATH}/lib64
- name: Install LLVM ${{ matrix.cases.toolchain-version }}
if: ${{ !startsWith(matrix.cases.os, 'windows') && matrix.cases.toolchain == 'llvm' }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{ matrix.cases.toolchain-version }}
sudo ln -sf /usr/bin/clang-${{ matrix.cases.toolchain-version }} /usr/bin/clang
clang --version
echo "build --config=clang" > $HOME/.bazelrc
echo "build:clang --@rules_cuda//cuda:archs=sm_80" >> $HOME/.bazelrc
echo "build:clang --spawn_strategy=local" >> $HOME/.bazelrc
- name: Install CURAND For LLVM
uses: Jimver/cuda-toolkit@v0.2.11
if: ${{ !startsWith(matrix.cases.os, 'windows') && matrix.cases.toolchain == 'llvm' }}
with:
cuda: ${{ matrix.cases.cuda-version }}
sub-packages: '["nvcc", "cudart-dev"]' # avoid full cuda install
non-cuda-sub-packages: '["libcurand-dev"]'
method: network
- name: Install CUDA (Ubuntu)
if: ${{ !startsWith(matrix.cases.os, 'windows') && matrix.cases.source == 'ubuntu' }}
run: |
Expand Down
4 changes: 3 additions & 1 deletion examples/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
common --announce_rc

# Convenient flag shortcuts.
build --flag_alias=enable_cuda=@rules_cuda//cuda:enable
build --flag_alias=cuda_archs=@rules_cuda//cuda:archs
Expand All @@ -9,7 +11,7 @@ build --enable_cuda=True

# Use --config=clang to build with clang instead of gcc and nvcc.
build:clang --repo_env=CC=clang
build:clang --//cuda:compiler=clang
build:clang --@rules_cuda//cuda:compiler=clang

# https://github.com/bazel-contrib/rules_cuda/issues/1
build --ui_event_filters=-INFO
Expand Down

0 comments on commit 587955a

Please sign in to comment.