[CUDA] added support for Clang (#3886)

This commit is contained in:
Nikita Titov 2021-02-01 14:57:47 +03:00 коммит произвёл GitHub
Родитель 763b5f3cdc
Коммит b8cfaf61a7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 20 добавлений и 14 удалений

Просмотреть файл

@ -35,6 +35,7 @@ else # Linux
apt-utils \
build-essential \
ca-certificates \
cmake \
curl \
git \
iputils-ping \
@ -48,16 +49,16 @@ else # Linux
unzip \
wget \
zip
if [[ $COMPILER == "clang" ]]; then
sudo apt-get install --no-install-recommends -y \
clang \
libomp-dev
fi
export LANG="en_US.UTF-8"
export LC_ALL="${LANG}"
sudo locale-gen ${LANG}
sudo update-locale
sudo apt-get install -y --no-install-recommends \
cmake \
clang \
libomp-dev
fi
if [[ $TASK == "mpi" ]]; then
sudo apt-get update
@ -84,6 +85,11 @@ else # Linux
lsb-release \
software-properties-common \
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 -
apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" -y
apt-get update

6
.github/workflows/cuda.yml поставляемый
Просмотреть файл

@ -11,7 +11,6 @@ on:
env:
github_actions: 'true'
os_name: linux
compiler: gcc
task: cuda
conda_env: test-env
@ -25,12 +24,15 @@ jobs:
matrix:
include:
- method: source
compiler: gcc
python_version: 3.7
cuda_version: "11.2.0"
- method: pip
compiler: clang
python_version: 3.8
cuda_version: "10.0"
- method: wheel
compiler: gcc
python_version: 3.9
cuda_version: "9.0"
steps:
@ -69,7 +71,7 @@ jobs:
cat > docker.env <<EOF
GITHUB_ACTIONS=${{ env.github_actions }}
OS_NAME=${{ env.os_name }}
COMPILER=${{ env.compiler }}
COMPILER=${{ matrix.compiler }}
TASK=${{ env.task }}
METHOD=${{ matrix.method }}
CONDA_ENV=${{ env.conda_env }}

Просмотреть файл

@ -24,11 +24,7 @@ else()
cmake_minimum_required(VERSION 3.0)
endif()
if(USE_CUDA)
PROJECT(lightgbm LANGUAGES C CXX CUDA)
else()
PROJECT(lightgbm LANGUAGES C CXX)
endif()
PROJECT(lightgbm LANGUAGES C CXX)
if(__INTEGRATE_OPENCL)
set(__INTEGRATE_OPENCL ON CACHE BOOL "" FORCE)
@ -117,6 +113,8 @@ else()
endif(USE_MPI)
if(USE_CUDA)
SET(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}")
enable_language(CUDA)
SET(USE_OPENMP ON CACHE BOOL "CUDA requires OpenMP" FORCE)
endif(USE_CUDA)

Просмотреть файл

@ -590,11 +590,11 @@ The CUDA-based build is a separate implementation and requires an NVIDIA graphic
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:
- **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.