From 36e5fb7d1c04e678999b6e9c70292a8c8a6b664b Mon Sep 17 00:00:00 2001 From: Marco Vela <36453977+characat0@users.noreply.github.com> Date: Thu, 2 May 2024 20:02:42 -0500 Subject: [PATCH 1/8] build LightGBM v4.3.0 with OpenCL/CUDA support --- L/LightGBM/build_tarballs.jl | 93 ++++++++++++++----- .../patches/windows/Ws2_32-iphlpapi.patch | 18 ---- 2 files changed, 71 insertions(+), 40 deletions(-) mode change 100644 => 100755 L/LightGBM/build_tarballs.jl delete mode 100644 L/LightGBM/bundled/patches/windows/Ws2_32-iphlpapi.patch diff --git a/L/LightGBM/build_tarballs.jl b/L/LightGBM/build_tarballs.jl old mode 100644 new mode 100755 index f29e7d1f8b5..7fca9b687eb --- a/L/LightGBM/build_tarballs.jl +++ b/L/LightGBM/build_tarballs.jl @@ -1,14 +1,18 @@ # Note that this script can accept some limited command-line arguments, run # `julia build_tarballs.jl --help` to see a usage message. using BinaryBuilder, Pkg +using Base.BinaryPlatforms: arch, tags name = "LightGBM" -version = v"3.3.5" +version = v"4.3.0" + +const YGGDRASIL_DIR = "../.." +include(joinpath(YGGDRASIL_DIR, "fancy_toys.jl")) +include(joinpath(YGGDRASIL_DIR, "platforms", "cuda.jl")) # Collection of sources required to complete build sources = [ - GitSource("https://github.com/microsoft/LightGBM.git", "ca035b2ee0c2be85832435917b1e0c8301d2e0e0"), - DirectorySource("./bundled"), + GitSource("https://github.com/microsoft/LightGBM.git", "252828fd86627d7405021c3377534d6a8239dd69"), ] # Bash recipe for building across all platforms @@ -17,27 +21,49 @@ cd $WORKSPACE/srcdir/LightGBM git submodule update --init --depth=1 git submodule update --checkout --depth=1 +FLAGS=() +cmake_extra_args="" -if [[ $target == *"apple-darwin"* ]]; then - cmake_extra_args="-DAPPLE=1 -DAPPLE_OUTPUT_DYLIB=1" +if [[ "${bb_full_target}" == *"apple-darwin"* ]]; then + cmake_extra_args+="-DAPPLE=1 -DAPPLE_OUTPUT_DYLIB=1 " fi -FLAGS=() - -if [[ "${target}" == *-mingw* ]]; then - # Parches windows - for p in $WORKSPACE/srcdir/patches/windows/*.patch; do - atomic_patch -p1 "${p}" - done - cmake_extra_args="-DWIN32=1 -DMINGW=1" +if [[ "${bb_full_target}" == *-mingw* ]]; then + cmake_extra_args+="-DWIN32=1 -DMINGW=1 " FLAGS+=(LDFLAGS="-no-undefined") fi -cmake \ - -DCMAKE_INSTALL_PREFIX=$prefix\ - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ - -DCMAKE_BUILD_TYPE=Release \ - $cmake_extra_args +if [[ "${bb_full_target}" == *-linux* ]]; then + cmake_extra_args+="-DUSE_GPU=1 " +fi + +if [[ ("${bb_full_target}" == *-cuda*) && ("${bb_full_target}" != *-cuda+none*) ]]; then + # nvcc writes to /tmp, which is a small tmpfs in our sandbox. + # make it use the workspace instead + export TMPDIR=${WORKSPACE}/tmpdir + mkdir ${TMPDIR} + export CUDA_HOME=${WORKSPACE}/destdir/cuda + export PATH=$PATH:$CUDA_HOME/bin/ + + ln -s $CUDA_HOME/lib $CUDA_HOME/lib64 + + cmake_extra_args+="\ + -DUSE_CUDA=1 \ + -DCUDA_TOOLKIT_ROOT_DIR=$CUDA_HOME \ + -DCUDA_TOOLKIT_INCLUDE=$CUDA_HOME/include \ + -DCUDA_CUDART_LIBRARY=$CUDA_HOME/lib64/libcudart.$dlext " +fi +configure () { + cmake . \ + -DCMAKE_INSTALL_PREFIX=$prefix\ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ + -DCMAKE_BUILD_TYPE=Release \ + $cmake_extra_args +} + +# Need to call twice due to FindCUDA issues in cmake +configure || configure + make -j${nproc} "${FLAGS[@]}" make install install_license LICENSE @@ -46,6 +72,10 @@ install_license LICENSE # These are the platforms we will build for by default, unless further # platforms are passed in on the command line platforms = expand_cxxstring_abis(supported_platforms()) +cuda_platforms = expand_cxxstring_abis(CUDA.supported_platforms(; min_version=v"11")) + +# CUDA errors for other platforms +filter!(p -> (Sys.islinux(p) && arch(p) == "x86_64"), cuda_platforms) # The products that we will ensure are always built products = [ @@ -53,13 +83,32 @@ products = [ ExecutableProduct("lightgbm", :lightgbm), ] +all_platforms = [platforms; cuda_platforms] + # Dependencies that must be installed before this package can be built dependencies = [ # For OpenMP we use libomp from `LLVMOpenMP_jll` where we use LLVM as compiler (BSD # systems), and libgomp from `CompilerSupportLibraries_jll` everywhere else. - Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"); platforms=filter(!Sys.isbsd, platforms)), - Dependency(PackageSpec(name="LLVMOpenMP_jll", uuid="1d63c593-3942-5779-bab2-d838dc0a180e"); platforms=filter(Sys.isbsd, platforms)), + Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"); platforms=filter(!Sys.isbsd, all_platforms)), + Dependency(PackageSpec(name="LLVMOpenMP_jll", uuid="1d63c593-3942-5779-bab2-d838dc0a180e"); platforms=filter(Sys.isbsd, all_platforms)), + + # GPU support is enabled via OpenCL and is hard to cross compile for other platforms + Dependency(PackageSpec(name="OpenCL_jll", uuid="6cb37087-e8b6-5417-8430-1f242f1e46e4"); platforms=filter(Sys.islinux, all_platforms)), + BuildDependency(PackageSpec(name="OpenCL_Headers_jll", uuid="a7aa756b-2b7f-562a-9e9d-e94076c5c8ee"); platforms=filter(Sys.islinux, all_platforms)), + + Dependency(PackageSpec(name="boost_jll", uuid="28df3c45-c428-5900-9ff8-a3135698ca75"); platforms=filter(Sys.islinux, all_platforms)), ] -# Build the tarballs, and possibly a `build.jl` as well. -build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"8.1.0") +for platform in all_platforms + if platform in platforms && CUDA.is_supported(platform) + platform["cuda"] = "none" + end + + deps = [dependencies; CUDA.required_dependencies(platform; static_sdk=true)] + + should_build_platform(triplet(platform)) || continue + + # Build the tarballs, and possibly a `build.jl` as well. + build_tarballs(ARGS, name, version, sources, script, [platform], products, deps; + julia_compat="1.6", preferred_gcc_version = v"8.1", augment_platform_block=CUDA.augment) +end diff --git a/L/LightGBM/bundled/patches/windows/Ws2_32-iphlpapi.patch b/L/LightGBM/bundled/patches/windows/Ws2_32-iphlpapi.patch deleted file mode 100644 index 77057ca8154..00000000000 --- a/L/LightGBM/bundled/patches/windows/Ws2_32-iphlpapi.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 95610d55..9d272e38 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -490,10 +490,10 @@ endif(USE_HDFS) - - if(WIN32) - if(MINGW OR CYGWIN) -- TARGET_LINK_LIBRARIES(lightgbm Ws2_32) -- TARGET_LINK_LIBRARIES(_lightgbm Ws2_32) -- TARGET_LINK_LIBRARIES(lightgbm IPHLPAPI) -- TARGET_LINK_LIBRARIES(_lightgbm IPHLPAPI) -+ TARGET_LINK_LIBRARIES(lightgbm ws2_32) -+ TARGET_LINK_LIBRARIES(_lightgbm ws2_32) -+ TARGET_LINK_LIBRARIES(lightgbm iphlpapi) -+ TARGET_LINK_LIBRARIES(_lightgbm iphlpapi) - endif(MINGW OR CYGWIN) - endif(WIN32) From 89cc3821e8927aa0c5352b5a39f56fd8a600f6d4 Mon Sep 17 00:00:00 2001 From: Marco Vela <36453977+characat0@users.noreply.github.com> Date: Thu, 16 May 2024 12:08:40 -0500 Subject: [PATCH 2/8] fix: replace FindCuda with FindCUDAToolkit --- L/LightGBM/build_tarballs.jl | 23 +++++++++++-------- .../patches/lightgbm-cmake-find-cuda.patch | 13 +++++++++++ 2 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 L/LightGBM/bundled/patches/lightgbm-cmake-find-cuda.patch diff --git a/L/LightGBM/build_tarballs.jl b/L/LightGBM/build_tarballs.jl index 7fca9b687eb..6da16043bb7 100755 --- a/L/LightGBM/build_tarballs.jl +++ b/L/LightGBM/build_tarballs.jl @@ -13,6 +13,7 @@ include(joinpath(YGGDRASIL_DIR, "platforms", "cuda.jl")) # Collection of sources required to complete build sources = [ GitSource("https://github.com/microsoft/LightGBM.git", "252828fd86627d7405021c3377534d6a8239dd69"), + DirectorySource("./bundled"), ] # Bash recipe for building across all platforms @@ -21,6 +22,12 @@ cd $WORKSPACE/srcdir/LightGBM git submodule update --init --depth=1 git submodule update --checkout --depth=1 +for p in $WORKSPACE/srcdir/patches/*.patch; do + atomic_patch -p1 "${p}" +done + +cat CMakeLists.txt + FLAGS=() cmake_extra_args="" @@ -53,16 +60,12 @@ if [[ ("${bb_full_target}" == *-cuda*) && ("${bb_full_target}" != *-cuda+none*) -DCUDA_TOOLKIT_INCLUDE=$CUDA_HOME/include \ -DCUDA_CUDART_LIBRARY=$CUDA_HOME/lib64/libcudart.$dlext " fi -configure () { - cmake . \ - -DCMAKE_INSTALL_PREFIX=$prefix\ - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ - -DCMAKE_BUILD_TYPE=Release \ - $cmake_extra_args -} - -# Need to call twice due to FindCUDA issues in cmake -configure || configure + +cmake . \ + -DCMAKE_INSTALL_PREFIX=$prefix\ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ + -DCMAKE_BUILD_TYPE=Release \ + $cmake_extra_args make -j${nproc} "${FLAGS[@]}" make install diff --git a/L/LightGBM/bundled/patches/lightgbm-cmake-find-cuda.patch b/L/LightGBM/bundled/patches/lightgbm-cmake-find-cuda.patch new file mode 100644 index 00000000000..116976bd6dc --- /dev/null +++ b/L/LightGBM/bundled/patches/lightgbm-cmake-find-cuda.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1ff289b9..cfda9e20 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -198,7 +198,7 @@ if(__INTEGRATE_OPENCL) + endif() + + if(USE_CUDA) +- find_package(CUDA 11.0 REQUIRED) ++ find_package(CUDAToolkit 11.0 REQUIRED) + include_directories(${CUDA_INCLUDE_DIRS}) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=${OpenMP_CXX_FLAGS} -Xcompiler=-fPIC -Xcompiler=-Wall") + From 0e0932cc20fbd47d0b13a5286f22bedcb6cde06c Mon Sep 17 00:00:00 2001 From: Marco Vela <36453977+characat0@users.noreply.github.com> Date: Thu, 16 May 2024 13:34:46 -0500 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=98=B6=20oops?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- L/LightGBM/build_tarballs.jl | 2 -- 1 file changed, 2 deletions(-) diff --git a/L/LightGBM/build_tarballs.jl b/L/LightGBM/build_tarballs.jl index 6da16043bb7..b5edeefe835 100755 --- a/L/LightGBM/build_tarballs.jl +++ b/L/LightGBM/build_tarballs.jl @@ -26,8 +26,6 @@ for p in $WORKSPACE/srcdir/patches/*.patch; do atomic_patch -p1 "${p}" done -cat CMakeLists.txt - FLAGS=() cmake_extra_args="" From 7c912953752e67588db70d611ebcadcd632cd9f6 Mon Sep 17 00:00:00 2001 From: Marco Vela <36453977+characat0@users.noreply.github.com> Date: Thu, 16 May 2024 16:21:41 -0500 Subject: [PATCH 4/8] patch switch to findcudatoolkit --- L/LightGBM/build_tarballs.jl | 11 ++-- .../patches/lightgbm-cmake-find-cuda.patch | 65 ++++++++++++++++++- 2 files changed, 66 insertions(+), 10 deletions(-) diff --git a/L/LightGBM/build_tarballs.jl b/L/LightGBM/build_tarballs.jl index b5edeefe835..7dbb1d618cc 100755 --- a/L/LightGBM/build_tarballs.jl +++ b/L/LightGBM/build_tarballs.jl @@ -47,16 +47,13 @@ if [[ ("${bb_full_target}" == *-cuda*) && ("${bb_full_target}" != *-cuda+none*) # make it use the workspace instead export TMPDIR=${WORKSPACE}/tmpdir mkdir ${TMPDIR} - export CUDA_HOME=${WORKSPACE}/destdir/cuda - export PATH=$PATH:$CUDA_HOME/bin/ + export CUDA_PATH=${WORKSPACE}/destdir/cuda + export PATH=$PATH:$CUDA_PATH/bin/ - ln -s $CUDA_HOME/lib $CUDA_HOME/lib64 + ln -s $CUDA_PATH/lib $CUDA_PATH/lib64 cmake_extra_args+="\ - -DUSE_CUDA=1 \ - -DCUDA_TOOLKIT_ROOT_DIR=$CUDA_HOME \ - -DCUDA_TOOLKIT_INCLUDE=$CUDA_HOME/include \ - -DCUDA_CUDART_LIBRARY=$CUDA_HOME/lib64/libcudart.$dlext " + -DUSE_CUDA=1 " fi cmake . \ diff --git a/L/LightGBM/bundled/patches/lightgbm-cmake-find-cuda.patch b/L/LightGBM/bundled/patches/lightgbm-cmake-find-cuda.patch index 116976bd6dc..55406fadb5f 100644 --- a/L/LightGBM/bundled/patches/lightgbm-cmake-find-cuda.patch +++ b/L/LightGBM/bundled/patches/lightgbm-cmake-find-cuda.patch @@ -1,13 +1,72 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1ff289b9..cfda9e20 100644 +index 1ff289b9..e71d5b99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -198,7 +198,7 @@ if(__INTEGRATE_OPENCL) +@@ -198,32 +198,28 @@ if(__INTEGRATE_OPENCL) endif() if(USE_CUDA) - find_package(CUDA 11.0 REQUIRED) +- include_directories(${CUDA_INCLUDE_DIRS}) + find_package(CUDAToolkit 11.0 REQUIRED) - include_directories(${CUDA_INCLUDE_DIRS}) ++ include_directories(${CUDAToolkit_INCLUDE_DIRS}) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=${OpenMP_CXX_FLAGS} -Xcompiler=-fPIC -Xcompiler=-Wall") + # reference for mapping of CUDA toolkit component versions to supported architectures ("compute capabilities"): + # https://en.wikipedia.org/wiki/CUDA#GPUs_supported +- set(CUDA_ARCHS "6.0" "6.1" "6.2" "7.0" "7.5") +- if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0") +- list(APPEND CUDA_ARCHS "8.0") ++ set(CUDA_ARCHS "60" "61" "62" "70" "75") ++ if(CUDA_VERSION VERSION_GREATER_EQUAL "110") ++ list(APPEND CUDA_ARCHS "80") + endif() +- if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1") +- list(APPEND CUDA_ARCHS "8.6") ++ if(CUDA_VERSION VERSION_GREATER_EQUAL "111") ++ list(APPEND CUDA_ARCHS "86") + endif() +- if(CUDA_VERSION VERSION_GREATER_EQUAL "11.5") +- list(APPEND CUDA_ARCHS "8.7") ++ if(CUDA_VERSION VERSION_GREATER_EQUAL "115") ++ list(APPEND CUDA_ARCHS "87") + endif() +- if(CUDA_VERSION VERSION_GREATER_EQUAL "11.8") +- list(APPEND CUDA_ARCHS "8.9") +- list(APPEND CUDA_ARCHS "9.0") ++ if(CUDA_VERSION VERSION_GREATER_EQUAL "118") ++ list(APPEND CUDA_ARCHS "89") ++ list(APPEND CUDA_ARCHS "90") + endif() + list(POP_BACK CUDA_ARCHS CUDA_LAST_SUPPORTED_ARCH) + list(APPEND CUDA_ARCHS "${CUDA_LAST_SUPPORTED_ARCH}+PTX") +- cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS ${CUDA_ARCHS}) +- string(REPLACE ";" " " CUDA_ARCH_FLAGS "${CUDA_ARCH_FLAGS}") +- +- set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${CUDA_ARCH_FLAGS}") + if(USE_DEBUG) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -g") + else() +@@ -260,7 +256,7 @@ if(USE_CUDA) + function(add_histogram hsize hname hadd hconst hdir) + add_library(histo${hsize}${hname} OBJECT src/treelearner/kernels/histogram${hsize}.cu) + set_target_properties(histo${hsize}${hname} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) +- set_target_properties(histo${hsize}${hname} PROPERTIES CUDA_ARCHITECTURES OFF) ++ set_target_properties(histo${hsize}${hname} PROPERTIES CUDA_ARCHITECTURES ${CUDA_ARCHS}) + if(hadd) + list(APPEND histograms histo${hsize}${hname}) + set(histograms ${histograms} PARENT_SCOPE) +@@ -600,10 +596,10 @@ if(USE_CUDA) + # Disable cmake warning about policy CMP0104. Refer to issue #3754 and PR #4268. + # Custom target properties does not propagate, thus we need to specify for + # each target that contains or depends on cuda source. +- set_target_properties(lightgbm_objs PROPERTIES CUDA_ARCHITECTURES OFF) +- set_target_properties(_lightgbm PROPERTIES CUDA_ARCHITECTURES OFF) ++ set_target_properties(lightgbm_objs PROPERTIES CUDA_ARCHITECTURES ${CUDA_ARCHS}) ++ set_target_properties(_lightgbm PROPERTIES CUDA_ARCHITECTURES ${CUDA_ARCHS}) + if(BUILD_CLI) +- set_target_properties(lightgbm PROPERTIES CUDA_ARCHITECTURES OFF) ++ set_target_properties(lightgbm PROPERTIES CUDA_ARCHITECTURES ${CUDA_ARCHS}) + endif() + + set_target_properties(lightgbm_objs PROPERTIES CUDA_SEPARABLE_COMPILATION ON) From 16681bfae79c3b1fe35b12dce1cbac982f14f810 Mon Sep 17 00:00:00 2001 From: Marco Vela <36453977+characat0@users.noreply.github.com> Date: Thu, 16 May 2024 17:53:36 -0500 Subject: [PATCH 5/8] boost pin compat --- L/LightGBM/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 L/LightGBM/build_tarballs.jl diff --git a/L/LightGBM/build_tarballs.jl b/L/LightGBM/build_tarballs.jl old mode 100755 new mode 100644 index 7dbb1d618cc..5981b7fde18 --- a/L/LightGBM/build_tarballs.jl +++ b/L/LightGBM/build_tarballs.jl @@ -94,7 +94,7 @@ dependencies = [ Dependency(PackageSpec(name="OpenCL_jll", uuid="6cb37087-e8b6-5417-8430-1f242f1e46e4"); platforms=filter(Sys.islinux, all_platforms)), BuildDependency(PackageSpec(name="OpenCL_Headers_jll", uuid="a7aa756b-2b7f-562a-9e9d-e94076c5c8ee"); platforms=filter(Sys.islinux, all_platforms)), - Dependency(PackageSpec(name="boost_jll", uuid="28df3c45-c428-5900-9ff8-a3135698ca75"); platforms=filter(Sys.islinux, all_platforms)), + Dependency(PackageSpec(name="boost_jll", uuid="28df3c45-c428-5900-9ff8-a3135698ca75"); compat="=1.76.0", platforms=filter(Sys.islinux, all_platforms)), ] for platform in all_platforms From 4fb837ddc10074d9d9cbe9a29b20d64f9f55be51 Mon Sep 17 00:00:00 2001 From: Marco Vela <36453977+characat0@users.noreply.github.com> Date: Sun, 19 May 2024 07:16:09 -0500 Subject: [PATCH 6/8] Update build_tarballs.jl --- L/LightGBM/build_tarballs.jl | 2 -- 1 file changed, 2 deletions(-) diff --git a/L/LightGBM/build_tarballs.jl b/L/LightGBM/build_tarballs.jl index 5981b7fde18..a9fc78e9b65 100644 --- a/L/LightGBM/build_tarballs.jl +++ b/L/LightGBM/build_tarballs.jl @@ -50,8 +50,6 @@ if [[ ("${bb_full_target}" == *-cuda*) && ("${bb_full_target}" != *-cuda+none*) export CUDA_PATH=${WORKSPACE}/destdir/cuda export PATH=$PATH:$CUDA_PATH/bin/ - ln -s $CUDA_PATH/lib $CUDA_PATH/lib64 - cmake_extra_args+="\ -DUSE_CUDA=1 " fi From 1765d5b5b8c7cb36d1b2c1c8f5b21dc79cdc5029 Mon Sep 17 00:00:00 2001 From: Marco Vela <36453977+characat0@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:58:21 -0500 Subject: [PATCH 7/8] fix: add libs to CMAKE_CUDA_FLAGS --- L/LightGBM/build_tarballs.jl | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/L/LightGBM/build_tarballs.jl b/L/LightGBM/build_tarballs.jl index 5981b7fde18..82413c02e11 100644 --- a/L/LightGBM/build_tarballs.jl +++ b/L/LightGBM/build_tarballs.jl @@ -27,19 +27,19 @@ for p in $WORKSPACE/srcdir/patches/*.patch; do done FLAGS=() -cmake_extra_args="" +cmake_extra_args=() if [[ "${bb_full_target}" == *"apple-darwin"* ]]; then - cmake_extra_args+="-DAPPLE=1 -DAPPLE_OUTPUT_DYLIB=1 " + cmake_extra_args+=(-DAPPLE=1 -DAPPLE_OUTPUT_DYLIB=1) fi if [[ "${bb_full_target}" == *-mingw* ]]; then - cmake_extra_args+="-DWIN32=1 -DMINGW=1 " + cmake_extra_args+=(-DWIN32=1 -DMINGW=1) FLAGS+=(LDFLAGS="-no-undefined") fi if [[ "${bb_full_target}" == *-linux* ]]; then - cmake_extra_args+="-DUSE_GPU=1 " + cmake_extra_args+=(-DUSE_GPU=1) fi if [[ ("${bb_full_target}" == *-cuda*) && ("${bb_full_target}" != *-cuda+none*) ]]; then @@ -50,17 +50,14 @@ if [[ ("${bb_full_target}" == *-cuda*) && ("${bb_full_target}" != *-cuda+none*) export CUDA_PATH=${WORKSPACE}/destdir/cuda export PATH=$PATH:$CUDA_PATH/bin/ - ln -s $CUDA_PATH/lib $CUDA_PATH/lib64 - - cmake_extra_args+="\ - -DUSE_CUDA=1 " + cmake_extra_args+=(-DUSE_CUDA=1 -DCMAKE_CUDA_FLAGS="-L${CUDA_PATH}/lib -L${CUDA_PATH}/lib/stubs") fi cmake . \ -DCMAKE_INSTALL_PREFIX=$prefix\ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - $cmake_extra_args + "${cmake_extra_args[@]}" make -j${nproc} "${FLAGS[@]}" make install From 457202b34a3a4654d8c9e1bed894c22d8278122b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Thu, 13 Jun 2024 01:33:41 +0100 Subject: [PATCH 8/8] Update L/LightGBM/build_tarballs.jl --- L/LightGBM/build_tarballs.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/L/LightGBM/build_tarballs.jl b/L/LightGBM/build_tarballs.jl index 82413c02e11..1215bef0935 100644 --- a/L/LightGBM/build_tarballs.jl +++ b/L/LightGBM/build_tarballs.jl @@ -22,9 +22,8 @@ cd $WORKSPACE/srcdir/LightGBM git submodule update --init --depth=1 git submodule update --checkout --depth=1 -for p in $WORKSPACE/srcdir/patches/*.patch; do - atomic_patch -p1 "${p}" -done +# https://github.com/microsoft/LightGBM/pull/6457 +atomic_patch -p1 "$WORKSPACE/srcdir/patches/lightgbm-cmake-find-cuda.patch" FLAGS=() cmake_extra_args=()