3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #217333 from ConnorBaker/fix/xgboost-cmake-cuda-compiler

xgboost: CMakeLists.txt does not respect CUDA_HOST_COMPILER
This commit is contained in:
Samuel Ainsworth 2023-02-21 20:48:33 -05:00 committed by GitHub
commit e475831fcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,18 @@
{ config, stdenv, lib, fetchFromGitHub, cmake, gtest, doCheck ? true
, cudaSupport ? config.cudaSupport or false, ncclSupport ? false
, rLibrary ? false, cudaPackages, llvmPackages, R, rPackages }:
{ config
, stdenv
, lib
, fetchFromGitHub
, cmake
, gtest
, doCheck ? true
, cudaSupport ? config.cudaSupport or false
, ncclSupport ? false
, rLibrary ? false
, cudaPackages
, llvmPackages
, R
, rPackages
}:
assert ncclSupport -> cudaSupport;
# Disable regular tests when building the R package
@ -51,9 +63,13 @@ stdenv.mkDerivation rec {
cmakeFlags = lib.optionals doCheck [ "-DGOOGLE_TEST=ON" ]
++ lib.optionals cudaSupport [
"-DUSE_CUDA=ON"
"-DCUDA_HOST_COMPILER=${cudaPackages.cudatoolkit.cc}/bin/cc"
] ++ lib.optionals (cudaSupport
"-DUSE_CUDA=ON"
# Their CMakeLists.txt does not respect CUDA_HOST_COMPILER, instead using the CXX compiler.
# https://github.com/dmlc/xgboost/blob/ccf43d4ba0a94e2f0a3cc5a526197539ae46f410/CMakeLists.txt#L145
"-DCMAKE_C_COMPILER=${cudaPackages.cudatoolkit.cc}/bin/gcc"
"-DCMAKE_CXX_COMPILER=${cudaPackages.cudatoolkit.cc}/bin/g++"
] ++ lib.optionals
(cudaSupport
&& lib.versionAtLeast cudaPackages.cudatoolkit.version "11.4.0")
[ "-DBUILD_WITH_CUDA_CUB=ON" ]
++ lib.optionals ncclSupport [ "-DUSE_NCCL=ON" ]