-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Perform clang-tidy on both cpp and cuda source. (#4034)
* Basic script for using compilation database. * Add `GENERATE_COMPILATION_DATABASE' to CMake. * Rearrange CMakeLists.txt. * Add basic python clang-tidy script. * Remove modernize-use-auto. * Add clang-tidy to Jenkins * Refine logic for correct path detection In Jenkins, the project root is of form /home/ubuntu/workspace/xgboost_PR-XXXX * Run clang-tidy in CUDA 9.2 container * Use clang_tidy container
- Loading branch information
1 parent
1088dff
commit 8905df4
Showing
7 changed files
with
328 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
ARG CUDA_VERSION | ||
FROM nvidia/cuda:$CUDA_VERSION-devel-ubuntu18.04 | ||
|
||
# Environment | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Install all basic requirements | ||
RUN \ | ||
apt-get update && \ | ||
apt-get install -y tar unzip wget git build-essential cmake python3 python3-pip llvm-7 clang-tidy-7 clang-7 | ||
|
||
# Set default clang-tidy version | ||
RUN \ | ||
update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-7 100 && \ | ||
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-7 100 | ||
|
||
# NCCL2 (License: https://docs.nvidia.com/deeplearning/sdk/nccl-sla/index.html) | ||
RUN \ | ||
export CUDA_SHORT=`echo $CUDA_VERSION | egrep -o '[0-9]+\.[0-9]'` && \ | ||
if [ "${CUDA_SHORT}" != "10.0" ]; then \ | ||
wget https://developer.download.nvidia.com/compute/redist/nccl/v2.2/nccl_2.2.13-1%2Bcuda${CUDA_SHORT}_x86_64.txz && \ | ||
tar xf "nccl_2.2.13-1+cuda${CUDA_SHORT}_x86_64.txz" && \ | ||
cp nccl_2.2.13-1+cuda${CUDA_SHORT}_x86_64/include/nccl.h /usr/include && \ | ||
cp nccl_2.2.13-1+cuda${CUDA_SHORT}_x86_64/lib/* /usr/lib && \ | ||
rm -f nccl_2.2.13-1+cuda${CUDA_SHORT}_x86_64.txz && \ | ||
rm -r nccl_2.2.13-1+cuda${CUDA_SHORT}_x86_64; fi | ||
|
||
# Install Python packages | ||
RUN \ | ||
pip3 install pyyaml | ||
|
||
ENV GOSU_VERSION 1.10 | ||
|
||
# Install lightweight sudo (not bound to TTY) | ||
RUN set -ex; \ | ||
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" && \ | ||
chmod +x /usr/local/bin/gosu && \ | ||
gosu nobody true | ||
|
||
# Default entry-point to use if running locally | ||
# It will preserve attributes of created files | ||
COPY entrypoint.sh /scripts/ | ||
|
||
WORKDIR /workspace | ||
ENTRYPOINT ["/scripts/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
rm -rf gtest googletest-release-1.7.0 | ||
wget -nc https://github.com/google/googletest/archive/release-1.7.0.zip | ||
unzip -n release-1.7.0.zip | ||
mv googletest-release-1.7.0 gtest && cd gtest | ||
cmake . && make | ||
mkdir lib && mv libgtest.a lib | ||
cd .. | ||
rm -rf release-1.7.0.zip* | ||
|
||
python3 tests/ci_build/tidy.py --gtest-path=${PWD}/gtest |
Oops, something went wrong.