Skip to content

Commit

Permalink
LightGBM: update to 4.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Jun 16, 2024
1 parent 01c4e09 commit 9f823d0
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 43 deletions.
14 changes: 7 additions & 7 deletions math/LightGBM/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PortGroup cmake 1.1
PortGroup compiler_blacklist_versions 1.0
PortGroup github 1.0

github.setup microsoft LightGBM 4.3.0 v
github.setup microsoft LightGBM 4.4.0 v
revision 0
categories math
license MIT
Expand All @@ -16,13 +16,12 @@ long_description {*}${description}, based on decision tree algorithms, \
used for ranking, classification and many other \
machine learning tasks.
homepage https://lightgbm.readthedocs.io
checksums rmd160 6e713e9b99a624d35ea063219afcf2c638af1a0a \
sha256 9e5a88bc231addfe4a0e57aa5ceb157f045103cd69ad8c2f393ef941ef52a9ac \
size 7070807
checksums rmd160 9ef56d2fc66be5a85fbac7805290dbd3d23e5d7c \
sha256 2633afd64f4f28c5563cb64e96adf8aa6fae58af11b13345166392fb05e56215 \
size 7088819
github.tarball_from archive

patchfiles-append 0001-Fix-CMakeLists.txt.patch \
0002-common.h-fix-includes.patch
patchfiles-append 0001-Fix-CMakeLists.txt.patch

set libfmt_ver 10

Expand All @@ -49,7 +48,8 @@ configure.args-append \
-DUSE_HDFS=OFF \
-DUSE_MPI=OFF \
-DUSE_OPENMP=ON \
-DUSE_SANITIZER=OFF
-DUSE_SANITIZER=OFF \
-DUSE_SWIG=OFF

platform darwin {
configure.args-append \
Expand Down
116 changes: 113 additions & 3 deletions math/LightGBM/files/0001-Fix-CMakeLists.txt.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ diff --git CMakeLists.txt CMakeLists.txt
index 1ff289b9..43f6bcea 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -31,11 +31,7 @@ cmake_minimum_required(VERSION 3.18)
@@ -35,11 +35,7 @@

project(lightgbm LANGUAGES C CXX)

Expand All @@ -24,7 +24,7 @@ index 1ff289b9..43f6bcea 100644
set(CMAKE_CXX_STANDARD_REQUIRED ON)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
@@ -111,7 +107,10 @@ if(USE_SWIG)
@@ -115,19 +111,16 @@
endif()
endif()

Expand All @@ -36,7 +36,19 @@ index 1ff289b9..43f6bcea 100644
include_directories(${EIGEN_DIR})

# See https://gitlab.com/libeigen/eigen/-/blob/master/COPYING.README
@@ -149,24 +148,7 @@ if(USE_CUDA)
add_definitions(-DEIGEN_MPL2_ONLY)
add_definitions(-DEIGEN_DONT_PARALLELIZE)

-set(FAST_DOUBLE_PARSER_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/external_libs/fast_double_parser/include")
-include_directories(${FAST_DOUBLE_PARSER_INCLUDE_DIR})
-
-set(FMT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/external_libs/fmt/include")
-include_directories(${FMT_INCLUDE_DIR})
-
if(__BUILD_FOR_R)
find_package(LibR REQUIRED)
message(STATUS "LIBR_EXECUTABLE: ${LIBR_EXECUTABLE}")
@@ -159,24 +152,7 @@
endif()

if(USE_OPENMP)
Expand All @@ -62,3 +74,101 @@ index 1ff289b9..43f6bcea 100644
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()

@@ -707,83 +683,6 @@
set(CMAKE_INSTALL_PREFIX "lightgbm")
endif()

-# The macOS linker puts an absolute path to linked libraries in lib_lightgb.dylib.
-# This block overrides that information for LightGBM's OpenMP dependency, to allow
-# finding that library in more places.
-#
-# This reduces the risk of runtime issues resulting from multiple libomp.dylib being loaded.
-#
-if(APPLE AND USE_OPENMP)
- # store path to libomp found at build time in a variable
- get_target_property(
- OpenMP_LIBRARY_LOCATION
- OpenMP::OpenMP_CXX
- INTERFACE_LINK_LIBRARIES
- )
- # get just the filename of that path
- # (to deal with the possibility that it might be 'libomp.dylib' or 'libgomp.dylib' or 'libiomp.dylib')
- get_filename_component(
- OpenMP_LIBRARY_NAME
- ${OpenMP_LIBRARY_LOCATION}
- NAME
- )
- # get directory of that path
- get_filename_component(
- OpenMP_LIBRARY_DIR
- ${OpenMP_LIBRARY_LOCATION}
- DIRECTORY
- )
- # get exact name of the library in a variable
- get_target_property(
- __LIB_LIGHTGBM_OUTPUT_NAME
- _lightgbm
- OUTPUT_NAME
- )
- if(NOT __LIB_LIGHTGBM_OUTPUT_NAME)
- set(__LIB_LIGHTGBM_OUTPUT_NAME "lib_lightgbm")
- endif()
-
- if(CMAKE_SHARED_LIBRARY_SUFFIX_CXX)
- set(
- __LIB_LIGHTGBM_FILENAME "${__LIB_LIGHTGBM_OUTPUT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX_CXX}"
- CACHE INTERNAL "lightgbm shared library filename"
- )
- else()
- set(
- __LIB_LIGHTGBM_FILENAME "${__LIB_LIGHTGBM_OUTPUT_NAME}.dylib"
- CACHE INTERNAL "lightgbm shared library filename"
- )
- endif()
-
- # Override the absolute path to OpenMP with a relative one using @rpath.
- #
- # This also ensures that if a libomp.dylib has already been loaded, it'll just use that.
- add_custom_command(
- TARGET _lightgbm
- POST_BUILD
- COMMAND
- install_name_tool
- -change
- ${OpenMP_LIBRARY_LOCATION}
- "@rpath/${OpenMP_LIBRARY_NAME}"
- "${__LIB_LIGHTGBM_FILENAME}"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMENT "Replacing hard-coded OpenMP install_name with '@rpath/${OpenMP_LIBRARY_NAME}'..."
- )
- # add RPATH entries to ensure the loader looks in the following, in the following order:
- #
- # - /opt/homebrew/opt/libomp/lib (where 'brew install' / 'brew link' puts libomp.dylib)
- # - ${OpenMP_LIBRARY_DIR} (wherever find_package(OpenMP) found OpenMP at build time)
- #
- set_target_properties(
- _lightgbm
- PROPERTIES
- BUILD_WITH_INSTALL_RPATH TRUE
- INSTALL_RPATH "/opt/homebrew/opt/libomp/lib;${OpenMP_LIBRARY_DIR}"
- INSTALL_RPATH_USE_LINK_PATH FALSE
- )
-endif()
-
install(
TARGETS _lightgbm
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
@@ -796,13 +695,4 @@
DIRECTORY ${LightGBM_HEADER_DIR}/LightGBM
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
)
- install(
- FILES ${FAST_DOUBLE_PARSER_INCLUDE_DIR}/fast_double_parser.h
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/LightGBM/utils
- )
- install(
- DIRECTORY ${FMT_INCLUDE_DIR}/
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/LightGBM/utils
- FILES_MATCHING PATTERN "*.h"
- )
endif()
33 changes: 0 additions & 33 deletions math/LightGBM/files/0002-common.h-fix-includes.patch

This file was deleted.

0 comments on commit 9f823d0

Please sign in to comment.