Skip to content

Commit

Permalink
Add instructions on how to run clang-tidy locally.
Browse files Browse the repository at this point in the history
Adds dedicated conda environment.
  • Loading branch information
csadorf committed Jul 12, 2023
1 parent 6c7d284 commit c4e6565
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 2 deletions.
40 changes: 40 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,46 @@ please see the `.pre-commit-config.yaml` file.
of files are up-to-date and in the correct format.
- `codespell`: Checks for spelling mistakes

### Clang-tidy

In order to maintain high-quality code, cuML uses not only pre-commit hooks
featuring various formatters and linters but also the clang-tidy tool.
Clang-tidy is designed to detect potential issues within the C and C++ code. It
is typically run as part of our continuous integration (CI) process.

While it's generally unnecessary for contributors to run clang-tidy locally,
there might be cases where you would want to do so. There are two primary
methods to run clang-tidy on your local machine: using Docker or Conda.

* **Docker**

1. Navigate to the repository root directory.
2. Run the following Docker command:

```bash
docker run --rm --pull always \
--mount type=bind,source="$(pwd)",target=/opt/repo --workdir /opt/repo \
rapidsai/ci:latest /opt/repo/ci/run_clang_tidy.sh
```


* **Conda**

1. Navigate to the repository root directory.
2. Create and activate the needed conda environment:
```bash
conda env create --force -n cuml-clang-tidy -f conda/environments/clang_tidy_cuda-118_arch-x86_64.yaml
conda activate cuml-clang-tidy
```
3. Generate the compile command database with
```bash
./build.sh --configure-only libcuml
```
3. Run clang-tidy with the following command:
```bash
python cpp/scripts/run-clang-tidy.py --config pyproject.toml
```

### Managing PR labels

Each PR must be labeled according to whether it is a "breaking" or "non-breaking" change (using Github labels). This is used to highlight changes that users should know about when upgrading.
Expand Down
2 changes: 1 addition & 1 deletion ci/run_clang_tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ set +u && conda activate clang_tidy && set -u

rapids-logger "Run clang-tidy"

python cpp/scripts/run-clang-tidy.py
python cpp/scripts/run-clang-tidy.py --config pyproject.toml
37 changes: 37 additions & 0 deletions conda/environments/clang_tidy_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This file is generated by `rapids-dependency-file-generator`.
# To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.
channels:
- rapidsai
- rapidsai-nightly
- dask/label/dev
- conda-forge
- nvidia
dependencies:
- c-compiler
- clang-tools==15.0.7
- clang==15.0.7
- cmake>=3.26.4
- cudatoolkit=11.8
- cxx-compiler
- gcc_linux-64=11.*
- gmock>=1.13.0
- gtest>=1.13.0
- libcublas-dev=11.11.3.6
- libcublas=11.11.3.6
- libcufft-dev=10.9.0.58
- libcufft=10.9.0.58
- libcumlprims==23.8.*
- libcurand-dev=10.3.0.86
- libcurand=10.3.0.86
- libcusolver-dev=11.4.1.48
- libcusolver=11.4.1.48
- libcusparse-dev=11.7.5.86
- libcusparse=11.7.5.86
- libraft-headers==23.8.*
- libraft==23.8.*
- librmm==23.8.*
- ninja
- nvcc_linux-64=11.8
- sysroot_linux-64==2.17
- tomli
name: clang_tidy_cuda-118_arch-x86_64
5 changes: 4 additions & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ files:
- checks
- py_version
clang_tidy:
output: none
output: conda
matrix:
cuda: ["11.8"]
arch: [x86_64]
includes:
- clang_tidy
- common_build
Expand Down

0 comments on commit c4e6565

Please sign in to comment.