зеркало из https://github.com/microsoft/LightGBM.git
Merge branch 'master' into ci/libboost
This commit is contained in:
Коммит
144f092c74
|
@ -39,4 +39,4 @@ test_script:
|
|||
- conda config --add channels conda-forge
|
||||
- conda config --set channel_priority strict
|
||||
- conda init powershell
|
||||
- powershell.exe -ExecutionPolicy Bypass -File %APPVEYOR_BUILD_FOLDER%\.ci\test_windows.ps1
|
||||
- powershell.exe -ExecutionPolicy Bypass -File %APPVEYOR_BUILD_FOLDER%\.ci\test-windows.ps1
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Update comment appending a given body to the specified original comment.
|
||||
#
|
||||
# [usage]
|
||||
# append_comment.sh <COMMENT_ID> <BODY>
|
||||
# append-comment.sh <COMMENT_ID> <BODY>
|
||||
#
|
||||
# COMMENT_ID: ID of comment that should be modified.
|
||||
#
|
|
@ -8,20 +8,20 @@ from shutil import copyfile
|
|||
|
||||
if __name__ == "__main__":
|
||||
source = Path(sys.argv[1])
|
||||
current_dir = Path(__file__).absolute().parent
|
||||
linux_folder_path = current_dir / "runtimes" / "linux-x64" / "native"
|
||||
nuget_dir = Path(__file__).absolute().parent / "nuget"
|
||||
linux_folder_path = nuget_dir / "runtimes" / "linux-x64" / "native"
|
||||
linux_folder_path.mkdir(parents=True, exist_ok=True)
|
||||
osx_folder_path = current_dir / "runtimes" / "osx-x64" / "native"
|
||||
osx_folder_path = nuget_dir / "runtimes" / "osx-x64" / "native"
|
||||
osx_folder_path.mkdir(parents=True, exist_ok=True)
|
||||
windows_folder_path = current_dir / "runtimes" / "win-x64" / "native"
|
||||
windows_folder_path = nuget_dir / "runtimes" / "win-x64" / "native"
|
||||
windows_folder_path.mkdir(parents=True, exist_ok=True)
|
||||
build_folder_path = current_dir / "build"
|
||||
build_folder_path = nuget_dir / "build"
|
||||
build_folder_path.mkdir(parents=True, exist_ok=True)
|
||||
copyfile(source / "lib_lightgbm.so", linux_folder_path / "lib_lightgbm.so")
|
||||
copyfile(source / "lib_lightgbm.dylib", osx_folder_path / "lib_lightgbm.dylib")
|
||||
copyfile(source / "lib_lightgbm.dll", windows_folder_path / "lib_lightgbm.dll")
|
||||
copyfile(source / "lightgbm.exe", windows_folder_path / "lightgbm.exe")
|
||||
version = (current_dir.parent / "VERSION.txt").read_text(encoding="utf-8").strip().replace("rc", "-rc")
|
||||
version = (nuget_dir.parents[1] / "VERSION.txt").read_text(encoding="utf-8").strip().replace("rc", "-rc")
|
||||
nuget_str = rf"""<?xml version="1.0"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
||||
<metadata>
|
||||
|
@ -76,6 +76,6 @@ if __name__ == "__main__":
|
|||
</Target>
|
||||
</Project>
|
||||
"""
|
||||
(current_dir / "LightGBM.nuspec").write_text(nuget_str, encoding="utf-8")
|
||||
(current_dir / "build" / "LightGBM.props").write_text(prop_str, encoding="utf-8")
|
||||
(current_dir / "build" / "LightGBM.targets").write_text(target_str, encoding="utf-8")
|
||||
(nuget_dir / "LightGBM.nuspec").write_text(nuget_str, encoding="utf-8")
|
||||
(nuget_dir / "build" / "LightGBM.props").write_text(prop_str, encoding="utf-8")
|
||||
(nuget_dir / "build" / "LightGBM.targets").write_text(target_str, encoding="utf-8")
|
|
@ -2,7 +2,7 @@
|
|||
"""Get the most recent status of workflow for the current PR.
|
||||
|
||||
[usage]
|
||||
python get_workflow_status.py TRIGGER_PHRASE
|
||||
python get-workflow-status.py TRIGGER_PHRASE
|
||||
|
||||
TRIGGER_PHRASE: Code phrase that triggers workflow.
|
||||
"""
|
|
@ -286,7 +286,7 @@ def gen_parameter_code(
|
|||
* Licensed under the MIT License. See LICENSE file in the project root for license information.
|
||||
*
|
||||
* \note
|
||||
* This file is auto generated by LightGBM\helpers\parameter_generator.py from LightGBM\include\LightGBM\config.h file.
|
||||
* This file is auto generated by LightGBM\.ci\parameter-generator.py from LightGBM\include\LightGBM\config.h file.
|
||||
*/
|
||||
"""
|
||||
str_to_write += "#include<LightGBM/config.h>\nnamespace LightGBM {\n"
|
|
@ -4,7 +4,7 @@
|
|||
# Rerun specified workflow for given pull request.
|
||||
#
|
||||
# [usage]
|
||||
# rerun_workflow.sh <WORKFLOW_ID> <PR_NUMBER> <PR_BRANCH>
|
||||
# rerun-workflow.sh <WORKFLOW_ID> <PR_NUMBER> <PR_BRANCH>
|
||||
#
|
||||
# WORKFLOW_ID: Identifier (config name of ID) of a workflow to be rerun.
|
||||
#
|
|
@ -4,7 +4,7 @@
|
|||
# Set a status with a given name to the specified commit.
|
||||
#
|
||||
# [usage]
|
||||
# set_commit_status.sh <NAME> <STATUS> <SHA>
|
||||
# set-commit-status.sh <NAME> <STATUS> <SHA>
|
||||
#
|
||||
# NAME: Name of status.
|
||||
# Status with existing name overwrites a previous one.
|
33
.ci/setup.sh
33
.ci/setup.sh
|
@ -29,6 +29,25 @@ if [[ $OS_NAME == "macos" ]]; then
|
|||
brew install swig
|
||||
fi
|
||||
else # Linux
|
||||
if type -f apt 2>&1 > /dev/null; then
|
||||
sudo apt-get update
|
||||
sudo apt-get install --no-install-recommends -y \
|
||||
ca-certificates \
|
||||
curl
|
||||
else
|
||||
sudo yum update -y
|
||||
sudo yum install -y \
|
||||
ca-certificates \
|
||||
curl
|
||||
fi
|
||||
CMAKE_VERSION="3.30.0"
|
||||
curl -O -L \
|
||||
https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-${ARCH}.sh \
|
||||
|| exit 1
|
||||
sudo mkdir /opt/cmake || exit 1
|
||||
sudo sh cmake-${CMAKE_VERSION}-linux-${ARCH}.sh --skip-license --prefix=/opt/cmake || exit 1
|
||||
sudo ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake || exit 1
|
||||
|
||||
if [[ $IN_UBUNTU_BASE_CONTAINER == "true" ]]; then
|
||||
# fixes error "unable to initialize frontend: Dialog"
|
||||
# https://github.com/moby/moby/issues/27988#issuecomment-462809153
|
||||
|
@ -40,9 +59,6 @@ else # Linux
|
|||
|
||||
sudo apt-get install --no-install-recommends -y \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
git \
|
||||
libcurl4 \
|
||||
libicu-dev \
|
||||
|
@ -120,21 +136,12 @@ else # Linux
|
|||
fi
|
||||
if [[ $TASK == "cuda" ]]; then
|
||||
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||
apt-get update
|
||||
apt-get install --no-install-recommends -y \
|
||||
curl \
|
||||
lsb-release \
|
||||
software-properties-common
|
||||
if [[ $COMPILER == "clang" ]]; then
|
||||
apt-get update
|
||||
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
|
||||
apt-get install --no-install-recommends -y \
|
||||
cmake
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -45,6 +45,8 @@ Remove-From-Path ".*android.*"
|
|||
Remove-From-Path ".*Android.*"
|
||||
Remove-From-Path ".*chocolatey.*"
|
||||
Remove-From-Path ".*Chocolatey.*"
|
||||
Remove-From-Path ".*cmake.*"
|
||||
Remove-From-Path ".*CMake.*"
|
||||
Remove-From-Path ".*\\Git\\.*"
|
||||
Remove-From-Path "(?!.*pandoc.*).*hostedtoolcache.*"
|
||||
Remove-From-Path ".*Microsoft SDKs.*"
|
||||
|
@ -87,10 +89,12 @@ if ($env:R_MAJOR_VERSION -eq "3") {
|
|||
Write-Output "[ERROR] Unrecognized R version: $env:R_VERSION"
|
||||
Check-Output $false
|
||||
}
|
||||
$env:CMAKE_VERSION = "3.30.0"
|
||||
|
||||
$env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" -replace '[\\]', '/'
|
||||
$env:R_LIBS = "$env:R_LIB_PATH"
|
||||
$env:PATH = "$env:RTOOLS_BIN;" + "$env:RTOOLS_MINGW_BIN;" + "$env:R_LIB_PATH/R/bin/x64;"+ $env:PATH
|
||||
$env:CMAKE_PATH = "$env:BUILD_SOURCESDIRECTORY/CMake_installation"
|
||||
$env:PATH = "$env:RTOOLS_BIN;" + "$env:RTOOLS_MINGW_BIN;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:CMAKE_PATH/cmake-$env:CMAKE_VERSION-windows-x86_64/bin;" + $env:PATH
|
||||
if ([version]$env:R_VERSION -lt [version]"4.0") {
|
||||
$env:CRAN_MIRROR = "https://cran-archive.r-project.org"
|
||||
} else {
|
||||
|
@ -112,11 +116,13 @@ if (($env:COMPILER -eq "MINGW") -and ($env:R_BUILD_TYPE -eq "cmake")) {
|
|||
cd $env:BUILD_SOURCESDIRECTORY
|
||||
tzutil /s "GMT Standard Time"
|
||||
[Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH)
|
||||
[Void][System.IO.Directory]::CreateDirectory($env:CMAKE_PATH)
|
||||
|
||||
# download R and RTools
|
||||
Write-Output "Downloading R and Rtools"
|
||||
# download R, RTools and CMake
|
||||
Write-Output "Downloading R, Rtools and CMake"
|
||||
Download-File-With-Retries -url "$env:CRAN_MIRROR/bin/windows/base/old/$env:R_WINDOWS_VERSION/R-$env:R_WINDOWS_VERSION-win.exe" -destfile "R-win.exe"
|
||||
Download-File-With-Retries -url "https://github.com/microsoft/LightGBM/releases/download/v2.0.12/$env:RTOOLS_EXE_FILE" -destfile "Rtools.exe"
|
||||
Download-File-With-Retries -url "https://github.com/Kitware/CMake/releases/download/v$env:CMAKE_VERSION/cmake-$env:CMAKE_VERSION-windows-x86_64.zip" -destfile "$env:CMAKE_PATH/cmake.zip"
|
||||
|
||||
# Install R
|
||||
Write-Output "Installing R"
|
||||
|
@ -127,6 +133,13 @@ Write-Output "Installing Rtools"
|
|||
Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /DIR=$RTOOLS_INSTALL_PATH" ; Check-Output $?
|
||||
Write-Output "Done installing Rtools"
|
||||
|
||||
Write-Output "Installing CMake"
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("$env:CMAKE_PATH/cmake.zip", "$env:CMAKE_PATH") ; Check-Output $?
|
||||
# Remove old CMake shiped with RTools
|
||||
Remove-Item "$env:RTOOLS_MINGW_BIN/cmake.exe" -Force -ErrorAction Ignore
|
||||
Write-Output "Done installing CMake"
|
||||
|
||||
Write-Output "Installing dependencies"
|
||||
$packages = "c('data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'processx', 'R6', 'RhpcBLASctl', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo')"
|
||||
Run-R-Code-Redirect-Stderr "options(install.packages.check.source = 'no'); install.packages($packages, repos = '$env:CRAN_MIRROR', type = 'binary', lib = '$env:R_LIB_PATH', Ncpus = parallel::detectCores())" ; Check-Output $?
|
|
@ -4,7 +4,6 @@ set -e -E -u -o pipefail
|
|||
|
||||
# defaults
|
||||
ARCH=$(uname -m)
|
||||
INSTALL_CMAKE_FROM_RELEASES=${INSTALL_CMAKE_FROM_RELEASES:-"false"}
|
||||
|
||||
# set up R environment
|
||||
CRAN_MIRROR="https://cran.rstudio.com"
|
||||
|
@ -74,15 +73,6 @@ if [[ $OS_NAME == "linux" ]]; then
|
|||
automake \
|
||||
|| exit 1
|
||||
fi
|
||||
if [[ $INSTALL_CMAKE_FROM_RELEASES == "true" ]]; then
|
||||
curl -O -L \
|
||||
https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-linux-${ARCH}.sh \
|
||||
|| exit 1
|
||||
|
||||
sudo mkdir /opt/cmake || exit 1
|
||||
sudo sh cmake-3.25.1-linux-${ARCH}.sh --skip-license --prefix=/opt/cmake || exit 1
|
||||
sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake || exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Installing R precompiled for Mac OS 10.11 or higher
|
|
@ -17,7 +17,7 @@ Remove-Item $env:TMPDIR -Force -Recurse -ErrorAction Ignore
|
|||
[Void][System.IO.Directory]::CreateDirectory($env:TMPDIR)
|
||||
|
||||
if ($env:TASK -eq "r-package") {
|
||||
& .\.ci\test_r_package_windows.ps1 ; Check-Output $?
|
||||
& .\.ci\test-r-package-windows.ps1 ; Check-Output $?
|
||||
Exit 0
|
||||
}
|
||||
|
||||
|
@ -31,11 +31,22 @@ if ($env:TASK -eq "cpp-tests") {
|
|||
if ($env:TASK -eq "swig") {
|
||||
$env:JAVA_HOME = $env:JAVA_HOME_8_X64 # there is pre-installed Eclipse Temurin 8 somewhere
|
||||
$ProgressPreference = "SilentlyContinue" # progress bar bug extremely slows down download speed
|
||||
Invoke-WebRequest -Uri "https://github.com/microsoft/LightGBM/releases/download/v2.0.12/swigwin-4.0.2.zip" -OutFile $env:BUILD_SOURCESDIRECTORY/swig/swigwin.zip -UserAgent "NativeHost"
|
||||
Invoke-WebRequest -Uri "https://sourceforge.net/projects/swig/files/latest/download" -OutFile $env:BUILD_SOURCESDIRECTORY/swig/swigwin.zip -UserAgent "curl"
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("$env:BUILD_SOURCESDIRECTORY/swig/swigwin.zip", "$env:BUILD_SOURCESDIRECTORY/swig")
|
||||
$env:PATH = "$env:BUILD_SOURCESDIRECTORY/swig/swigwin-4.0.2;" + $env:PATH
|
||||
cmake -B build -S . -A x64 -DUSE_SWIG=ON ; Check-Output $?
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("$env:BUILD_SOURCESDIRECTORY/swig/swigwin.zip", "$env:BUILD_SOURCESDIRECTORY/swig") ; Check-Output $?
|
||||
$SwigFolder = Get-ChildItem -Directory -Name -Path "$env:BUILD_SOURCESDIRECTORY/swig"
|
||||
$env:PATH = "$env:BUILD_SOURCESDIRECTORY/swig/$SwigFolder;" + $env:PATH
|
||||
$BuildLogFileName = "$env:BUILD_SOURCESDIRECTORY\cmake_build.log"
|
||||
cmake -B build -S . -A x64 -DUSE_SWIG=ON *> "$BuildLogFileName" ; $build_succeeded = $?
|
||||
Write-Output "CMake build logs:"
|
||||
Get-Content -Path "$BuildLogFileName"
|
||||
Check-Output $build_succeeded
|
||||
$checks = Select-String -Path "${BuildLogFileName}" -Pattern "-- Found SWIG.*${SwigFolder}/swig.exe"
|
||||
$checks_cnt = $checks.Matches.length
|
||||
if ($checks_cnt -eq 0) {
|
||||
Write-Output "Wrong SWIG version was found (expected '${SwigFolder}'). Check the build logs."
|
||||
Check-Output $False
|
||||
}
|
||||
cmake --build build --target ALL_BUILD --config Release ; Check-Output $?
|
||||
if ($env:AZURE -eq "true") {
|
||||
cp ./build/lightgbmlib.jar $env:BUILD_ARTIFACTSTAGINGDIRECTORY/lightgbmlib_win.jar ; Check-Output $?
|
||||
|
@ -77,7 +88,7 @@ if ($env:TASK -eq "regular") {
|
|||
}
|
||||
elseif ($env:TASK -eq "sdist") {
|
||||
sh ./build-python.sh sdist ; Check-Output $?
|
||||
sh ./.ci/check_python_dists.sh ./dist ; Check-Output $?
|
||||
sh ./.ci/check-python-dists.sh ./dist ; Check-Output $?
|
||||
cd dist; pip install @(Get-ChildItem *.gz) -v ; Check-Output $?
|
||||
}
|
||||
elseif ($env:TASK -eq "bdist") {
|
||||
|
@ -92,7 +103,7 @@ elseif ($env:TASK -eq "bdist") {
|
|||
|
||||
conda activate $env:CONDA_ENV
|
||||
sh "build-python.sh" bdist_wheel --integrated-opencl ; Check-Output $?
|
||||
sh ./.ci/check_python_dists.sh ./dist ; Check-Output $?
|
||||
sh ./.ci/check-python-dists.sh ./dist ; Check-Output $?
|
||||
cd dist; pip install @(Get-ChildItem *py3-none-win_amd64.whl) ; Check-Output $?
|
||||
cp @(Get-ChildItem *py3-none-win_amd64.whl) $env:BUILD_ARTIFACTSTAGINGDIRECTORY
|
||||
} elseif (($env:APPVEYOR -eq "true") -and ($env:TASK -eq "python")) {
|
28
.ci/test.sh
28
.ci/test.sh
|
@ -43,7 +43,7 @@ else
|
|||
fi
|
||||
|
||||
if [[ "${TASK}" == "r-package" ]] || [[ "${TASK}" == "r-rchk" ]]; then
|
||||
bash "${BUILD_DIRECTORY}/.ci/test_r_package.sh" || exit 1
|
||||
bash "${BUILD_DIRECTORY}/.ci/test-r-package.sh" || exit 1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@ -86,7 +86,7 @@ if [[ $TASK == "swig" ]]; then
|
|||
if [[ $OS_NAME == "linux" ]] && [[ $COMPILER == "gcc" ]]; then
|
||||
objdump -T ./lib_lightgbm.so > ./objdump.log || exit 1
|
||||
objdump -T ./lib_lightgbm_swig.so >> ./objdump.log || exit 1
|
||||
python ./helpers/check_dynamic_dependencies.py ./objdump.log || exit 1
|
||||
python ./.ci/check-dynamic-dependencies.py ./objdump.log || exit 1
|
||||
fi
|
||||
if [[ $PRODUCES_ARTIFACTS == "true" ]]; then
|
||||
cp ./build/lightgbmlib.jar $BUILD_ARTIFACTSTAGINGDIRECTORY/lightgbmlib_$OS_NAME.jar
|
||||
|
@ -108,7 +108,7 @@ if [[ $TASK == "lint" ]]; then
|
|||
echo "Linting Python code"
|
||||
bash ./.ci/lint-python.sh || exit 1
|
||||
echo "Linting R code"
|
||||
Rscript ./.ci/lint_r_code.R "${BUILD_DIRECTORY}" || exit 1
|
||||
Rscript ./.ci/lint-r-code.R "${BUILD_DIRECTORY}" || exit 1
|
||||
echo "Linting C++ code"
|
||||
bash ./.ci/lint-cpp.sh || exit 1
|
||||
exit 0
|
||||
|
@ -143,7 +143,7 @@ if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then
|
|||
cd "${BUILD_DIRECTORY}"
|
||||
cp ./docs/Parameters.rst ./docs/Parameters-backup.rst
|
||||
cp ./src/io/config_auto.cpp ./src/io/config_auto-backup.cpp
|
||||
python ./helpers/parameter_generator.py || exit 1
|
||||
python ./.ci/parameter-generator.py || exit 1
|
||||
diff ./docs/Parameters-backup.rst ./docs/Parameters.rst || exit 1
|
||||
diff ./src/io/config_auto-backup.cpp ./src/io/config_auto.cpp || exit 1
|
||||
exit 0
|
||||
|
@ -170,7 +170,7 @@ cd "${BUILD_DIRECTORY}"
|
|||
|
||||
if [[ $TASK == "sdist" ]]; then
|
||||
sh ./build-python.sh sdist || exit 1
|
||||
sh .ci/check_python_dists.sh ./dist || exit 1
|
||||
sh .ci/check-python-dists.sh ./dist || exit 1
|
||||
pip install ./dist/lightgbm-$LGB_VER.tar.gz -v || exit 1
|
||||
if [[ $PRODUCES_ARTIFACTS == "true" ]]; then
|
||||
cp ./dist/lightgbm-$LGB_VER.tar.gz $BUILD_ARTIFACTSTAGINGDIRECTORY || exit 1
|
||||
|
@ -180,7 +180,7 @@ if [[ $TASK == "sdist" ]]; then
|
|||
elif [[ $TASK == "bdist" ]]; then
|
||||
if [[ $OS_NAME == "macos" ]]; then
|
||||
sh ./build-python.sh bdist_wheel || exit 1
|
||||
sh .ci/check_python_dists.sh ./dist || exit 1
|
||||
sh .ci/check-python-dists.sh ./dist || exit 1
|
||||
if [[ $PRODUCES_ARTIFACTS == "true" ]]; then
|
||||
cp dist/lightgbm-$LGB_VER-py3-none-macosx*.whl $BUILD_ARTIFACTSTAGINGDIRECTORY || exit 1
|
||||
fi
|
||||
|
@ -199,7 +199,7 @@ elif [[ $TASK == "bdist" ]]; then
|
|||
mv \
|
||||
./dist/tmp.whl \
|
||||
./dist/lightgbm-$LGB_VER-py3-none-$PLATFORM.whl || exit 1
|
||||
sh .ci/check_python_dists.sh ./dist || exit 1
|
||||
sh .ci/check-python-dists.sh ./dist || exit 1
|
||||
if [[ $PRODUCES_ARTIFACTS == "true" ]]; then
|
||||
cp dist/lightgbm-$LGB_VER-py3-none-$PLATFORM.whl $BUILD_ARTIFACTSTAGINGDIRECTORY || exit 1
|
||||
fi
|
||||
|
@ -216,7 +216,7 @@ if [[ $TASK == "gpu" ]]; then
|
|||
grep -q 'std::string device_type = "gpu"' ./include/LightGBM/config.h || exit 1 # make sure that changes were really done
|
||||
if [[ $METHOD == "pip" ]]; then
|
||||
sh ./build-python.sh sdist || exit 1
|
||||
sh .ci/check_python_dists.sh ./dist || exit 1
|
||||
sh .ci/check-python-dists.sh ./dist || exit 1
|
||||
pip install \
|
||||
-v \
|
||||
--config-settings=cmake.define.USE_GPU=ON \
|
||||
|
@ -226,7 +226,7 @@ if [[ $TASK == "gpu" ]]; then
|
|||
exit 0
|
||||
elif [[ $METHOD == "wheel" ]]; then
|
||||
sh ./build-python.sh bdist_wheel --gpu || exit 1
|
||||
sh ./.ci/check_python_dists.sh ./dist || exit 1
|
||||
sh ./.ci/check-python-dists.sh ./dist || exit 1
|
||||
pip install ./dist/lightgbm-$LGB_VER*.whl -v || exit 1
|
||||
pytest ./tests || exit 1
|
||||
exit 0
|
||||
|
@ -241,7 +241,7 @@ elif [[ $TASK == "cuda" ]]; then
|
|||
grep -q 'gpu_use_dp = true' ./include/LightGBM/config.h || exit 1 # make sure that changes were really done
|
||||
if [[ $METHOD == "pip" ]]; then
|
||||
sh ./build-python.sh sdist || exit 1
|
||||
sh ./.ci/check_python_dists.sh ./dist || exit 1
|
||||
sh ./.ci/check-python-dists.sh ./dist || exit 1
|
||||
pip install \
|
||||
-v \
|
||||
--config-settings=cmake.define.USE_CUDA=ON \
|
||||
|
@ -251,7 +251,7 @@ elif [[ $TASK == "cuda" ]]; then
|
|||
exit 0
|
||||
elif [[ $METHOD == "wheel" ]]; then
|
||||
sh ./build-python.sh bdist_wheel --cuda || exit 1
|
||||
sh ./.ci/check_python_dists.sh ./dist || exit 1
|
||||
sh ./.ci/check-python-dists.sh ./dist || exit 1
|
||||
pip install ./dist/lightgbm-$LGB_VER*.whl -v || exit 1
|
||||
pytest ./tests || exit 1
|
||||
exit 0
|
||||
|
@ -261,7 +261,7 @@ elif [[ $TASK == "cuda" ]]; then
|
|||
elif [[ $TASK == "mpi" ]]; then
|
||||
if [[ $METHOD == "pip" ]]; then
|
||||
sh ./build-python.sh sdist || exit 1
|
||||
sh ./.ci/check_python_dists.sh ./dist || exit 1
|
||||
sh ./.ci/check-python-dists.sh ./dist || exit 1
|
||||
pip install \
|
||||
-v \
|
||||
--config-settings=cmake.define.USE_MPI=ON \
|
||||
|
@ -271,7 +271,7 @@ elif [[ $TASK == "mpi" ]]; then
|
|||
exit 0
|
||||
elif [[ $METHOD == "wheel" ]]; then
|
||||
sh ./build-python.sh bdist_wheel --mpi || exit 1
|
||||
sh ./.ci/check_python_dists.sh ./dist || exit 1
|
||||
sh ./.ci/check-python-dists.sh ./dist || exit 1
|
||||
pip install ./dist/lightgbm-$LGB_VER*.whl -v || exit 1
|
||||
pytest ./tests || exit 1
|
||||
exit 0
|
||||
|
@ -294,7 +294,7 @@ if [[ $TASK == "regular" ]]; then
|
|||
else
|
||||
if [[ $COMPILER == "gcc" ]]; then
|
||||
objdump -T ./lib_lightgbm.so > ./objdump.log || exit 1
|
||||
python ./helpers/check_dynamic_dependencies.py ./objdump.log || exit 1
|
||||
python ./.ci/check-dynamic-dependencies.py ./objdump.log || exit 1
|
||||
fi
|
||||
cp ./lib_lightgbm.so $BUILD_ARTIFACTSTAGINGDIRECTORY/lib_lightgbm.so
|
||||
fi
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Trigger manual workflow run by a dispatch event.
|
||||
#
|
||||
# [usage]
|
||||
# trigger_dispatch_run.sh <PR_URL> <COMMENT_ID> <DISPATCH_NAME>
|
||||
# trigger-dispatch-run.sh <PR_URL> <COMMENT_ID> <DISPATCH_NAME>
|
||||
#
|
||||
# PR_URL: URL of pull request from which dispatch is triggering.
|
||||
#
|
|
@ -98,7 +98,7 @@ jobs:
|
|||
linux_version: "ubuntu20.04"
|
||||
task: cuda
|
||||
steps:
|
||||
- name: Install latest git
|
||||
- name: Install latest git and sudo
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install --no-install-recommends -y \
|
||||
|
@ -107,7 +107,8 @@ jobs:
|
|||
add-apt-repository ppa:git-core/ppa -y
|
||||
apt-get update
|
||||
apt-get install --no-install-recommends -y \
|
||||
git
|
||||
git \
|
||||
sudo
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
|
|
|
@ -23,7 +23,7 @@ jobs:
|
|||
for i in "${workflows[@]}"; do
|
||||
workflow_name=${i%;*}
|
||||
trigger_phrase=${i#*;}
|
||||
python "$GITHUB_WORKSPACE/.ci/get_workflow_status.py" "$trigger_phrase" \
|
||||
python "$GITHUB_WORKSPACE/.ci/get-workflow-status.py" "$trigger_phrase" \
|
||||
|| { echo "The last reported status from workflow \"$workflow_name\" is failure. Commit fixes and rerun the workflow."; \
|
||||
exit 1; }
|
||||
done
|
||||
|
|
|
@ -181,13 +181,13 @@ jobs:
|
|||
- name: Install pandoc
|
||||
uses: r-lib/actions/setup-pandoc@v2
|
||||
if: matrix.container != 'ubuntu:18.04'
|
||||
# R 3.6 binary isn't easily available on buntu 18.04,
|
||||
# R 3.6 binary isn't easily available on Ubuntu 18.04,
|
||||
# but setup-pandoc>=2.7.1 is uses a too-new glibc for it.
|
||||
# ref: https://github.com/microsoft/LightGBM/issues/6298
|
||||
- name: Install pandoc
|
||||
uses: r-lib/actions/setup-pandoc@v2.6.0
|
||||
if: matrix.container == 'ubuntu:18.04'
|
||||
- name: install tinytex
|
||||
- name: Install tinytex
|
||||
if: startsWith(matrix.os, 'windows')
|
||||
uses: r-lib/actions/setup-tinytex@v2
|
||||
env:
|
||||
|
@ -204,11 +204,6 @@ jobs:
|
|||
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
|
||||
export OS_NAME="linux"
|
||||
export IN_UBUNTU_BASE_CONTAINER="true"
|
||||
# the default version of cmake provided on Ubuntu 18.04 (v3.10.2), is not supported by LightGBM
|
||||
# see https://github.com/microsoft/LightGBM/issues/5642
|
||||
if [[ "${{ matrix.container }}" == "ubuntu:18.04" ]]; then
|
||||
export INSTALL_CMAKE_FROM_RELEASES="true"
|
||||
fi
|
||||
fi
|
||||
export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
|
||||
export R_VERSION="${{ matrix.r_version }}"
|
||||
|
@ -226,7 +221,7 @@ jobs:
|
|||
$env:R_BUILD_TYPE = "${{ matrix.build_type }}"
|
||||
$env:COMPILER = "${{ matrix.compiler }}"
|
||||
$env:TASK = "${{ matrix.task }}"
|
||||
& "$env:GITHUB_WORKSPACE/.ci/test_windows.ps1"
|
||||
& "$env:GITHUB_WORKSPACE/.ci/test-windows.ps1"
|
||||
test-r-sanitizers:
|
||||
name: r-sanitizers (ubuntu-latest, R-devel, ${{ matrix.compiler }} ASAN/UBSAN)
|
||||
timeout-minutes: 60
|
||||
|
|
|
@ -33,24 +33,24 @@ jobs:
|
|||
- name: Send init status
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
$GITHUB_WORKSPACE/.ci/set_commit_status.sh "${{ github.workflow }}" "pending" "${{ github.event.client_payload.pr_sha }}"
|
||||
$GITHUB_WORKSPACE/.ci/append_comment.sh \
|
||||
$GITHUB_WORKSPACE/.ci/set-commit-status.sh "${{ github.workflow }}" "pending" "${{ github.event.client_payload.pr_sha }}"
|
||||
$GITHUB_WORKSPACE/.ci/append-comment.sh \
|
||||
"${{ github.event.client_payload.comment_number }}" \
|
||||
"Workflow **${{ github.workflow }}** has been triggered! 🚀\r\n${GITHUB_SERVER_URL}/microsoft/LightGBM/actions/runs/${GITHUB_RUN_ID}"
|
||||
- name: Run tests with valgrind
|
||||
shell: bash
|
||||
run: ./.ci/test_r_package_valgrind.sh
|
||||
run: ./.ci/test-r-package-valgrind.sh
|
||||
- name: Send final status
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
$GITHUB_WORKSPACE/.ci/set_commit_status.sh "${{ github.workflow }}" "${{ job.status }}" "${{ github.event.client_payload.pr_sha }}"
|
||||
$GITHUB_WORKSPACE/.ci/append_comment.sh \
|
||||
$GITHUB_WORKSPACE/.ci/set-commit-status.sh "${{ github.workflow }}" "${{ job.status }}" "${{ github.event.client_payload.pr_sha }}"
|
||||
$GITHUB_WORKSPACE/.ci/append-comment.sh \
|
||||
"${{ github.event.client_payload.comment_number }}" \
|
||||
"Status: ${{ job.status }}."
|
||||
- name: Rerun workflow-indicator
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
bash $GITHUB_WORKSPACE/.ci/rerun_workflow.sh \
|
||||
bash $GITHUB_WORKSPACE/.ci/rerun-workflow.sh \
|
||||
"optional_checks.yml" \
|
||||
"${{ github.event.client_payload.pr_number }}" \
|
||||
"${{ github.event.client_payload.pr_branch }}" \
|
||||
|
|
|
@ -20,7 +20,7 @@ jobs:
|
|||
- name: Trigger R valgrind tests
|
||||
if: github.event.comment.body == '/gha run r-valgrind'
|
||||
run: |
|
||||
$GITHUB_WORKSPACE/.ci/trigger_dispatch_run.sh \
|
||||
$GITHUB_WORKSPACE/.ci/trigger-dispatch-run.sh \
|
||||
"${{ github.event.issue.pull_request.url }}" \
|
||||
"${{ github.event.comment.id }}" \
|
||||
"gha_run_r_valgrind"
|
||||
|
@ -28,7 +28,7 @@ jobs:
|
|||
- name: Trigger update R configure
|
||||
if: github.event.comment.body == '/gha run r-configure'
|
||||
run: |
|
||||
$GITHUB_WORKSPACE/.ci/trigger_dispatch_run.sh \
|
||||
$GITHUB_WORKSPACE/.ci/trigger-dispatch-run.sh \
|
||||
"${{ github.event.issue.pull_request.url }}" \
|
||||
"${{ github.event.comment.id }}" \
|
||||
"gha_run_r_configure"
|
||||
|
|
|
@ -328,7 +328,7 @@ jobs:
|
|||
git clean -d -f -x
|
||||
displayName: 'Clean source directory'
|
||||
- script: |
|
||||
cmd /c "powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/install_opencl.ps1"
|
||||
cmd /c "powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/install-opencl.ps1"
|
||||
condition: eq(variables['TASK'], 'bdist')
|
||||
displayName: 'Install OpenCL'
|
||||
- script: |
|
||||
|
@ -337,7 +337,7 @@ jobs:
|
|||
cmd /c "conda config --add channels conda-forge"
|
||||
cmd /c "conda config --set channel_priority strict"
|
||||
cmd /c "conda init powershell"
|
||||
cmd /c "powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/test_windows.ps1"
|
||||
cmd /c "powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/test-windows.ps1"
|
||||
displayName: Test
|
||||
- task: PublishBuildArtifacts@1
|
||||
condition: and(succeeded(), in(variables['TASK'], 'regular', 'bdist', 'swig'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')))
|
||||
|
@ -419,12 +419,12 @@ jobs:
|
|||
artifactName: R-package
|
||||
downloadPath: $(Build.SourcesDirectory)/R
|
||||
- script: |
|
||||
python "$(Build.SourcesDirectory)/.nuget/create_nuget.py" "$(Build.SourcesDirectory)/binaries/PackageAssets"
|
||||
python "$(Build.SourcesDirectory)/.ci/create-nuget.py" "$(Build.SourcesDirectory)/binaries/PackageAssets"
|
||||
displayName: 'Create NuGet configuration files'
|
||||
- task: NuGetCommand@2
|
||||
inputs:
|
||||
command: pack
|
||||
packagesToPack: '$(Build.SourcesDirectory)/.nuget/*.nuspec'
|
||||
packagesToPack: '$(Build.SourcesDirectory)/.ci/nuget/*.nuspec'
|
||||
packDestination: '$(Build.ArtifactStagingDirectory)/nuget'
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
|
|
115
CMakeLists.txt
115
CMakeLists.txt
|
@ -23,7 +23,7 @@ option(__BUILD_FOR_PYTHON "Set to ON if building lib_lightgbm for use with the P
|
|||
option(__BUILD_FOR_R "Set to ON if building lib_lightgbm for use with the R package" OFF)
|
||||
option(__INTEGRATE_OPENCL "Set to ON if building LightGBM with the OpenCL ICD Loader and its dependencies included" OFF)
|
||||
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
|
||||
# If using Visual Studio generators, always target v10.x of the Windows SDK.
|
||||
# Doing this avoids lookups that could fall back to very old versions, e.g. by finding
|
||||
|
@ -415,40 +415,85 @@ if(USE_MPI)
|
|||
include_directories(${MPI_CXX_INCLUDE_PATH})
|
||||
endif()
|
||||
|
||||
file(
|
||||
GLOB
|
||||
SOURCES
|
||||
src/boosting/*.cpp
|
||||
src/io/*.cpp
|
||||
src/metric/*.cpp
|
||||
src/objective/*.cpp
|
||||
src/network/*.cpp
|
||||
src/treelearner/*.cpp
|
||||
src/utils/*.cpp
|
||||
set(
|
||||
LGBM_SOURCES
|
||||
src/boosting/boosting.cpp
|
||||
src/boosting/gbdt_model_text.cpp
|
||||
src/boosting/gbdt_prediction.cpp
|
||||
src/boosting/gbdt.cpp
|
||||
src/boosting/prediction_early_stop.cpp
|
||||
src/boosting/sample_strategy.cpp
|
||||
src/io/bin.cpp
|
||||
src/io/config_auto.cpp
|
||||
src/io/config.cpp
|
||||
src/io/dataset_loader.cpp
|
||||
src/io/dataset.cpp
|
||||
src/io/file_io.cpp
|
||||
src/io/json11.cpp
|
||||
src/io/metadata.cpp
|
||||
src/io/parser.cpp
|
||||
src/io/train_share_states.cpp
|
||||
src/io/tree.cpp
|
||||
src/metric/dcg_calculator.cpp
|
||||
src/metric/metric.cpp
|
||||
src/network/linker_topo.cpp
|
||||
src/network/linkers_mpi.cpp
|
||||
src/network/linkers_socket.cpp
|
||||
src/network/network.cpp
|
||||
src/objective/objective_function.cpp
|
||||
src/treelearner/data_parallel_tree_learner.cpp
|
||||
src/treelearner/feature_histogram.cpp
|
||||
src/treelearner/feature_parallel_tree_learner.cpp
|
||||
src/treelearner/gpu_tree_learner.cpp
|
||||
src/treelearner/gradient_discretizer.cpp
|
||||
src/treelearner/linear_tree_learner.cpp
|
||||
src/treelearner/serial_tree_learner.cpp
|
||||
src/treelearner/tree_learner.cpp
|
||||
src/treelearner/voting_parallel_tree_learner.cpp
|
||||
src/utils/openmp_wrapper.cpp
|
||||
)
|
||||
file(
|
||||
GLOB
|
||||
set(
|
||||
LGBM_CUDA_SOURCES
|
||||
src/treelearner/*.cu
|
||||
src/boosting/cuda/*.cpp
|
||||
src/boosting/cuda/*.cu
|
||||
src/metric/cuda/*.cpp
|
||||
src/metric/cuda/*.cu
|
||||
src/objective/cuda/*.cpp
|
||||
src/objective/cuda/*.cu
|
||||
src/treelearner/cuda/*.cpp
|
||||
src/treelearner/cuda/*.cu
|
||||
src/io/cuda/*.cu
|
||||
src/io/cuda/*.cpp
|
||||
src/cuda/*.cpp
|
||||
src/cuda/*.cu
|
||||
src/boosting/cuda/cuda_score_updater.cpp
|
||||
src/boosting/cuda/cuda_score_updater.cu
|
||||
src/metric/cuda/cuda_binary_metric.cpp
|
||||
src/metric/cuda/cuda_pointwise_metric.cpp
|
||||
src/metric/cuda/cuda_regression_metric.cpp
|
||||
src/metric/cuda/cuda_pointwise_metric.cu
|
||||
src/objective/cuda/cuda_binary_objective.cpp
|
||||
src/objective/cuda/cuda_multiclass_objective.cpp
|
||||
src/objective/cuda/cuda_rank_objective.cpp
|
||||
src/objective/cuda/cuda_regression_objective.cpp
|
||||
src/objective/cuda/cuda_binary_objective.cu
|
||||
src/objective/cuda/cuda_multiclass_objective.cu
|
||||
src/objective/cuda/cuda_rank_objective.cu
|
||||
src/objective/cuda/cuda_regression_objective.cu
|
||||
src/treelearner/cuda/cuda_best_split_finder.cpp
|
||||
src/treelearner/cuda/cuda_data_partition.cpp
|
||||
src/treelearner/cuda/cuda_histogram_constructor.cpp
|
||||
src/treelearner/cuda/cuda_leaf_splits.cpp
|
||||
src/treelearner/cuda/cuda_single_gpu_tree_learner.cpp
|
||||
src/treelearner/cuda/cuda_best_split_finder.cu
|
||||
src/treelearner/cuda/cuda_data_partition.cu
|
||||
src/treelearner/cuda/cuda_gradient_discretizer.cu
|
||||
src/treelearner/cuda/cuda_histogram_constructor.cu
|
||||
src/treelearner/cuda/cuda_leaf_splits.cu
|
||||
src/treelearner/cuda/cuda_single_gpu_tree_learner.cu
|
||||
src/io/cuda/cuda_column_data.cu
|
||||
src/io/cuda/cuda_tree.cu
|
||||
src/io/cuda/cuda_column_data.cpp
|
||||
src/io/cuda/cuda_metadata.cpp
|
||||
src/io/cuda/cuda_row_data.cpp
|
||||
src/io/cuda/cuda_tree.cpp
|
||||
src/cuda/cuda_utils.cpp
|
||||
src/cuda/cuda_algorithms.cu
|
||||
)
|
||||
|
||||
if(USE_CUDA)
|
||||
list(APPEND SOURCES ${LGBM_CUDA_SOURCES})
|
||||
list(APPEND LGBM_SOURCES ${LGBM_CUDA_SOURCES})
|
||||
endif()
|
||||
|
||||
add_library(lightgbm_objs OBJECT ${SOURCES})
|
||||
add_library(lightgbm_objs OBJECT ${LGBM_SOURCES})
|
||||
|
||||
if(BUILD_CLI)
|
||||
add_executable(lightgbm src/main.cpp src/application/application.cpp)
|
||||
|
@ -670,7 +715,19 @@ if(BUILD_CPP_TEST)
|
|||
set(LightGBM_TEST_HEADER_DIR ${PROJECT_SOURCE_DIR}/tests/cpp_tests)
|
||||
include_directories(${LightGBM_TEST_HEADER_DIR})
|
||||
|
||||
file(GLOB CPP_TEST_SOURCES tests/cpp_tests/*.cpp)
|
||||
set(
|
||||
CPP_TEST_SOURCES
|
||||
tests/cpp_tests/test_array_args.cpp
|
||||
tests/cpp_tests/test_arrow.cpp
|
||||
tests/cpp_tests/test_byte_buffer.cpp
|
||||
tests/cpp_tests/test_chunked_array.cpp
|
||||
tests/cpp_tests/test_common.cpp
|
||||
tests/cpp_tests/test_main.cpp
|
||||
tests/cpp_tests/test_serialize.cpp
|
||||
tests/cpp_tests/test_single_row.cpp
|
||||
tests/cpp_tests/test_stream.cpp
|
||||
tests/cpp_tests/testutils.cpp
|
||||
)
|
||||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-")
|
||||
endif()
|
||||
|
|
|
@ -15,14 +15,8 @@ if (.Machine$sizeof.pointer != 8L) {
|
|||
stop("LightGBM only supports 64-bit R, please check the version of R and Rtools.")
|
||||
}
|
||||
|
||||
R_int_UUID <- .Internal(internalsID())
|
||||
R_ver <- as.double(R.Version()$major) + as.double(R.Version()$minor) / 10.0
|
||||
|
||||
if (!(R_int_UUID == "0310d4b8-ccb1-4bb8-ba94-d36a55f60262"
|
||||
|| R_int_UUID == "2fdf6c18-697a-4ba7-b8ef-11c0d92f1327")) {
|
||||
warning("Warning: unmatched R_INTERNALS_UUID, may not run normally.")
|
||||
}
|
||||
|
||||
# Get some paths
|
||||
source_dir <- file.path(R_PACKAGE_SOURCE, "src", fsep = "/")
|
||||
build_dir <- file.path(source_dir, "build", fsep = "/")
|
||||
|
@ -133,7 +127,13 @@ if (WINDOWS && use_visual_studio) {
|
|||
}
|
||||
|
||||
# Prepare installation steps
|
||||
cmake_args <- NULL
|
||||
cmake_args <- c(
|
||||
"-D__BUILD_FOR_R=ON"
|
||||
# pass in R version, to help FindLibR find the R library
|
||||
, sprintf("-DCMAKE_R_VERSION='%s.%s'", R.Version()[["major"]], R.Version()[["minor"]])
|
||||
# ensure CMake build respects how R is configured (`R CMD config SHLIB_EXT`)
|
||||
, sprintf("-DCMAKE_SHARED_LIBRARY_SUFFIX_CXX='%s'", SHLIB_EXT)
|
||||
)
|
||||
build_cmd <- "make"
|
||||
build_args <- c("_lightgbm", make_args_from_build_script)
|
||||
lib_folder <- file.path(source_dir, fsep = "/")
|
||||
|
@ -174,18 +174,6 @@ windows_makefile_generator <- WINDOWS_BUILD_TOOLS[[windows_toolchain]][["makefil
|
|||
if (use_gpu) {
|
||||
cmake_args <- c(cmake_args, "-DUSE_GPU=ON")
|
||||
}
|
||||
cmake_args <- c(cmake_args, "-D__BUILD_FOR_R=ON")
|
||||
|
||||
# Pass in R version, used to help find R executable for linking
|
||||
R_version_string <- paste(
|
||||
R.Version()[["major"]]
|
||||
, R.Version()[["minor"]]
|
||||
, sep = "."
|
||||
)
|
||||
r_version_arg <- sprintf("-DCMAKE_R_VERSION='%s'", R_version_string)
|
||||
# ensure CMake build respects how R is configured (`R CMD config SHLIB_EXT`)
|
||||
shlib_ext_arg <- sprintf("-DCMAKE_SHARED_LIBRARY_SUFFIX_CXX='%s'", SHLIB_EXT)
|
||||
cmake_args <- c(cmake_args, r_version_arg, shlib_ext_arg)
|
||||
|
||||
# the checks below might already run `cmake -G`. If they do, set this flag
|
||||
# to TRUE to avoid re-running it later
|
||||
|
|
|
@ -16,20 +16,26 @@ include(FetchContent)
|
|||
FetchContent_Declare(OpenCL-Headers GIT_REPOSITORY ${OPENCL_HEADER_REPOSITORY} GIT_TAG ${OPENCL_HEADER_TAG})
|
||||
FetchContent_GetProperties(OpenCL-Headers)
|
||||
if(NOT OpenCL-Headers_POPULATED)
|
||||
FetchContent_Populate(OpenCL-Headers)
|
||||
FetchContent_MakeAvailable(OpenCL-Headers)
|
||||
message(STATUS "Populated OpenCL Headers")
|
||||
endif()
|
||||
set(OPENCL_ICD_LOADER_HEADERS_DIR ${opencl-headers_SOURCE_DIR} CACHE PATH "") # for OpenCL ICD Loader
|
||||
set(OpenCL_INCLUDE_DIR ${opencl-headers_SOURCE_DIR} CACHE PATH "") # for Boost::Compute
|
||||
|
||||
FetchContent_Declare(OpenCL-ICD-Loader GIT_REPOSITORY ${OPENCL_LOADER_REPOSITORY} GIT_TAG ${OPENCL_LOADER_TAG})
|
||||
FetchContent_Declare(
|
||||
OpenCL-ICD-Loader
|
||||
GIT_REPOSITORY
|
||||
${OPENCL_LOADER_REPOSITORY}
|
||||
GIT_TAG
|
||||
${OPENCL_LOADER_TAG}
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
FetchContent_GetProperties(OpenCL-ICD-Loader)
|
||||
if(NOT OpenCL-ICD-Loader_POPULATED)
|
||||
FetchContent_Populate(OpenCL-ICD-Loader)
|
||||
FetchContent_MakeAvailable(OpenCL-ICD-Loader)
|
||||
if(WIN32)
|
||||
set(USE_DYNAMIC_VCXX_RUNTIME ON)
|
||||
endif()
|
||||
add_subdirectory(${opencl-icd-loader_SOURCE_DIR} ${opencl-icd-loader_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
message(STATUS "Populated OpenCL ICD Loader")
|
||||
endif()
|
||||
list(APPEND INTEGRATED_OPENCL_INCLUDES ${OPENCL_ICD_LOADER_HEADERS_DIR})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.. List of parameters is auto generated by LightGBM\helpers\parameter_generator.py from LightGBM\include\LightGBM\config.h file.
|
||||
.. List of parameters is auto generated by LightGBM\.ci\parameter-generator.py from LightGBM\include\LightGBM\config.h file.
|
||||
|
||||
.. role:: raw-html(raw)
|
||||
:format: html
|
||||
|
|
|
@ -6,7 +6,7 @@ and `Breathe <https://breathe.readthedocs.io/>`__, which works on top of `Doxyge
|
|||
|
||||
List of parameters and their descriptions in `Parameters.rst <./Parameters.rst>`__
|
||||
is generated automatically from comments in `config file <https://github.com/microsoft/LightGBM/blob/master/include/LightGBM/config.h>`__
|
||||
by `this script <https://github.com/microsoft/LightGBM/blob/master/helpers/parameter_generator.py>`__.
|
||||
by `this script <https://github.com/microsoft/LightGBM/blob/master/.ci/parameter-generator.py>`__.
|
||||
|
||||
After each commit on ``master``, documentation is updated and published to `Read the Docs <https://lightgbm.readthedocs.io/>`__.
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ build-backend = "scikit_build_core.build"
|
|||
# based on https://github.com/scikit-build/scikit-build-core#configuration
|
||||
[tool.scikit-build]
|
||||
|
||||
cmake.version = ">=3.18"
|
||||
cmake.version = ">=3.28"
|
||||
ninja.version = ">=1.11"
|
||||
ninja.make-fallback = true
|
||||
cmake.args = [
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See LICENSE file in the project root for license information.
|
||||
*
|
||||
* \note
|
||||
* This file is auto generated by LightGBM\helpers\parameter_generator.py from LightGBM\include\LightGBM\config.h file.
|
||||
* This file is auto generated by LightGBM\.ci\parameter-generator.py from LightGBM\include\LightGBM\config.h file.
|
||||
*/
|
||||
#include<LightGBM/config.h>
|
||||
namespace LightGBM {
|
||||
|
|
|
@ -175,11 +175,12 @@ def test_dataset():
|
|||
free_dataset(train)
|
||||
|
||||
|
||||
def test_booster():
|
||||
def test_booster(tmp_path):
|
||||
binary_example_dir = Path(__file__).absolute().parents[2] / "examples" / "binary_classification"
|
||||
train = load_from_mat(binary_example_dir / "binary.train", None)
|
||||
test = load_from_mat(binary_example_dir / "binary.test", train)
|
||||
booster = ctypes.c_void_p()
|
||||
model_path = tmp_path / "model.txt"
|
||||
LIB.LGBM_BoosterCreate(train, c_str("app=binary metric=auc num_leaves=31 verbose=0"), ctypes.byref(booster))
|
||||
LIB.LGBM_BoosterAddValidData(booster, test)
|
||||
is_finished = ctypes.c_int(0)
|
||||
|
@ -192,13 +193,13 @@ def test_booster():
|
|||
)
|
||||
if i % 10 == 0:
|
||||
print(f"{i} iteration test AUC {result[0]:.6f}")
|
||||
LIB.LGBM_BoosterSaveModel(booster, ctypes.c_int(0), ctypes.c_int(-1), ctypes.c_int(0), c_str("model.txt"))
|
||||
LIB.LGBM_BoosterSaveModel(booster, ctypes.c_int(0), ctypes.c_int(-1), ctypes.c_int(0), c_str(str(model_path)))
|
||||
LIB.LGBM_BoosterFree(booster)
|
||||
free_dataset(train)
|
||||
free_dataset(test)
|
||||
booster2 = ctypes.c_void_p()
|
||||
num_total_model = ctypes.c_int(0)
|
||||
LIB.LGBM_BoosterCreateFromModelfile(c_str("model.txt"), ctypes.byref(num_total_model), ctypes.byref(booster2))
|
||||
LIB.LGBM_BoosterCreateFromModelfile(c_str(str(model_path)), ctypes.byref(num_total_model), ctypes.byref(booster2))
|
||||
data = np.loadtxt(str(binary_example_dir / "binary.test"), dtype=np.float64)
|
||||
mat = data[:, 1:]
|
||||
preb = np.empty(mat.shape[0], dtype=np.float64)
|
||||
|
|
|
@ -1112,15 +1112,15 @@ def test_early_stopping_can_be_triggered_via_custom_callback():
|
|||
assert bst.current_iteration() == 7
|
||||
|
||||
|
||||
def test_continue_train():
|
||||
def test_continue_train(tmp_path):
|
||||
X, y = make_synthetic_regression()
|
||||
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.1, random_state=42)
|
||||
params = {"objective": "regression", "metric": "l1", "verbose": -1}
|
||||
lgb_train = lgb.Dataset(X_train, y_train, free_raw_data=False)
|
||||
lgb_eval = lgb.Dataset(X_test, y_test, reference=lgb_train, free_raw_data=False)
|
||||
init_gbm = lgb.train(params, lgb_train, num_boost_round=20)
|
||||
model_name = "model.txt"
|
||||
init_gbm.save_model(model_name)
|
||||
model_path = tmp_path / "model.txt"
|
||||
init_gbm.save_model(model_path)
|
||||
evals_result = {}
|
||||
gbm = lgb.train(
|
||||
params,
|
||||
|
@ -1130,7 +1130,7 @@ def test_continue_train():
|
|||
# test custom eval metrics
|
||||
feval=(lambda p, d: ("custom_mae", mean_absolute_error(p, d.get_label()), False)),
|
||||
callbacks=[lgb.record_evaluation(evals_result)],
|
||||
init_model="model.txt",
|
||||
init_model=model_path,
|
||||
)
|
||||
ret = mean_absolute_error(y_test, gbm.predict(X_test))
|
||||
assert ret < 13.6
|
||||
|
@ -1713,7 +1713,7 @@ def test_all_expected_params_are_written_out_to_model_text(tmp_path):
|
|||
|
||||
# why fixed seed?
|
||||
# sometimes there is no difference how cols are treated (cat or not cat)
|
||||
def test_pandas_categorical(rng_fixed_seed):
|
||||
def test_pandas_categorical(rng_fixed_seed, tmp_path):
|
||||
pd = pytest.importorskip("pandas")
|
||||
X = pd.DataFrame(
|
||||
{
|
||||
|
@ -1756,8 +1756,9 @@ def test_pandas_categorical(rng_fixed_seed):
|
|||
gbm3 = lgb.train(params, lgb_train, num_boost_round=10, categorical_feature=["A", "B", "C", "D"])
|
||||
pred3 = gbm3.predict(X_test)
|
||||
assert lgb_train.categorical_feature == ["A", "B", "C", "D"]
|
||||
gbm3.save_model("categorical.model")
|
||||
gbm4 = lgb.Booster(model_file="categorical.model")
|
||||
categorical_model_path = tmp_path / "categorical.model"
|
||||
gbm3.save_model(categorical_model_path)
|
||||
gbm4 = lgb.Booster(model_file=categorical_model_path)
|
||||
pred4 = gbm4.predict(X_test)
|
||||
model_str = gbm4.model_to_string()
|
||||
gbm4.model_from_string(model_str)
|
||||
|
|
|
@ -558,7 +558,7 @@ def test_feature_importances_type():
|
|||
|
||||
# why fixed seed?
|
||||
# sometimes there is no difference how cols are treated (cat or not cat)
|
||||
def test_pandas_categorical(rng_fixed_seed):
|
||||
def test_pandas_categorical(rng_fixed_seed, tmp_path):
|
||||
pd = pytest.importorskip("pandas")
|
||||
X = pd.DataFrame(
|
||||
{
|
||||
|
@ -593,8 +593,9 @@ def test_pandas_categorical(rng_fixed_seed):
|
|||
pred2 = gbm2.predict(X_test, raw_score=True)
|
||||
gbm3 = lgb.sklearn.LGBMClassifier(n_estimators=10).fit(X, y, categorical_feature=["A", "B", "C", "D"])
|
||||
pred3 = gbm3.predict(X_test, raw_score=True)
|
||||
gbm3.booster_.save_model("categorical.model")
|
||||
gbm4 = lgb.Booster(model_file="categorical.model")
|
||||
categorical_model_path = tmp_path / "categorical.model"
|
||||
gbm3.booster_.save_model(categorical_model_path)
|
||||
gbm4 = lgb.Booster(model_file=categorical_model_path)
|
||||
pred4 = gbm4.predict(X_test)
|
||||
gbm5 = lgb.sklearn.LGBMClassifier(n_estimators=10).fit(X, y, categorical_feature=["A", "B", "C", "D", "E"])
|
||||
pred5 = gbm5.predict(X_test, raw_score=True)
|
||||
|
|
Загрузка…
Ссылка в новой задаче