Unverified Commit b8cfaf61 authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

[CUDA] added support for Clang (#3886)

parent 763b5f3c
...@@ -35,6 +35,7 @@ else # Linux ...@@ -35,6 +35,7 @@ else # Linux
apt-utils \ apt-utils \
build-essential \ build-essential \
ca-certificates \ ca-certificates \
cmake \
curl \ curl \
git \ git \
iputils-ping \ iputils-ping \
...@@ -48,16 +49,16 @@ else # Linux ...@@ -48,16 +49,16 @@ else # Linux
unzip \ unzip \
wget \ wget \
zip zip
if [[ $COMPILER == "clang" ]]; then
sudo apt-get install --no-install-recommends -y \
clang \
libomp-dev
fi
export LANG="en_US.UTF-8" export LANG="en_US.UTF-8"
export LC_ALL="${LANG}" export LC_ALL="${LANG}"
sudo locale-gen ${LANG} sudo locale-gen ${LANG}
sudo update-locale sudo update-locale
sudo apt-get install -y --no-install-recommends \
cmake \
clang \
libomp-dev
fi fi
if [[ $TASK == "mpi" ]]; then if [[ $TASK == "mpi" ]]; then
sudo apt-get update sudo apt-get update
...@@ -84,6 +85,11 @@ else # Linux ...@@ -84,6 +85,11 @@ else # Linux
lsb-release \ lsb-release \
software-properties-common \ software-properties-common \
wget wget
if [[ $COMPILER == "clang" ]]; then
apt-get install --no-install-recommends -y \
clang \
libomp-dev
fi
curl -sL https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add - curl -sL https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add -
apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" -y apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" -y
apt-get update apt-get update
......
...@@ -11,7 +11,6 @@ on: ...@@ -11,7 +11,6 @@ on:
env: env:
github_actions: 'true' github_actions: 'true'
os_name: linux os_name: linux
compiler: gcc
task: cuda task: cuda
conda_env: test-env conda_env: test-env
...@@ -25,12 +24,15 @@ jobs: ...@@ -25,12 +24,15 @@ jobs:
matrix: matrix:
include: include:
- method: source - method: source
compiler: gcc
python_version: 3.7 python_version: 3.7
cuda_version: "11.2.0" cuda_version: "11.2.0"
- method: pip - method: pip
compiler: clang
python_version: 3.8 python_version: 3.8
cuda_version: "10.0" cuda_version: "10.0"
- method: wheel - method: wheel
compiler: gcc
python_version: 3.9 python_version: 3.9
cuda_version: "9.0" cuda_version: "9.0"
steps: steps:
...@@ -69,7 +71,7 @@ jobs: ...@@ -69,7 +71,7 @@ jobs:
cat > docker.env <<EOF cat > docker.env <<EOF
GITHUB_ACTIONS=${{ env.github_actions }} GITHUB_ACTIONS=${{ env.github_actions }}
OS_NAME=${{ env.os_name }} OS_NAME=${{ env.os_name }}
COMPILER=${{ env.compiler }} COMPILER=${{ matrix.compiler }}
TASK=${{ env.task }} TASK=${{ env.task }}
METHOD=${{ matrix.method }} METHOD=${{ matrix.method }}
CONDA_ENV=${{ env.conda_env }} CONDA_ENV=${{ env.conda_env }}
......
...@@ -24,11 +24,7 @@ else() ...@@ -24,11 +24,7 @@ else()
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
endif() endif()
if(USE_CUDA) PROJECT(lightgbm LANGUAGES C CXX)
PROJECT(lightgbm LANGUAGES C CXX CUDA)
else()
PROJECT(lightgbm LANGUAGES C CXX)
endif()
if(__INTEGRATE_OPENCL) if(__INTEGRATE_OPENCL)
set(__INTEGRATE_OPENCL ON CACHE BOOL "" FORCE) set(__INTEGRATE_OPENCL ON CACHE BOOL "" FORCE)
...@@ -117,6 +113,8 @@ else() ...@@ -117,6 +113,8 @@ else()
endif(USE_MPI) endif(USE_MPI)
if(USE_CUDA) if(USE_CUDA)
SET(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}")
enable_language(CUDA)
SET(USE_OPENMP ON CACHE BOOL "CUDA requires OpenMP" FORCE) SET(USE_OPENMP ON CACHE BOOL "CUDA requires OpenMP" FORCE)
endif(USE_CUDA) endif(USE_CUDA)
......
...@@ -590,11 +590,11 @@ The CUDA-based build is a separate implementation and requires an NVIDIA graphic ...@@ -590,11 +590,11 @@ The CUDA-based build is a separate implementation and requires an NVIDIA graphic
Linux Linux
^^^^^ ^^^^^
On Linux a CUDA version of LightGBM can be built using **CUDA**, **CMake** and **gcc**. On Linux a CUDA version of LightGBM can be built using **CUDA**, **CMake** and **gcc** or **Clang**.
The following dependencies should be installed before compilation: The following dependencies should be installed before compilation:
- **CUDA** 9.0 or later libraries. Please refer to `this detailed guide`_. - **CUDA** 9.0 or later libraries. Please refer to `this detailed guide`_. Pay great attention to the minimum required versions of host compilers listed in the table from that guide and use only recommended versions of compilers.
- **CMake** 3.16 or later. - **CMake** 3.16 or later.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment