diff --git a/.appveyor.yml b/.appveyor.yml index 240269bca8ac..e02c3e9d8151 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,9 +1,9 @@ -version: 3.3.3 +version: 3.3.2.99.{build} image: Visual Studio 2015 platform: x64 configuration: # a trick to construct a build matrix with multiple Python versions - - 3.7 + - '3.7' # only build pull requests and # commits to 'master' @@ -27,11 +27,7 @@ install: - set PYTHON_VERSION=%CONFIGURATION% - set CONDA_ENV="test-env" - ps: | - switch ($env:PYTHON_VERSION) { - "3.6" {$env:MINICONDA = "C:\Miniconda36-x64"} - "3.7" {$env:MINICONDA = "C:\Miniconda37-x64"} - default {$env:MINICONDA = "C:\Miniconda37-x64"} - } + $env:MINICONDA = "C:\Miniconda3-x64" $env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH" $env:BUILD_SOURCESDIRECTORY = "$env:APPVEYOR_BUILD_FOLDER" $env:LGB_VER = (Get-Content $env:APPVEYOR_BUILD_FOLDER\VERSION.txt).trim() @@ -39,5 +35,7 @@ install: build: false 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 diff --git a/.ci/test.sh b/.ci/test.sh index 00b2a3a38356..c75cf33d8565 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -36,13 +36,20 @@ cd $BUILD_DIRECTORY if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then cd $BUILD_DIRECTORY/docs - conda install -q -y -n $CONDA_ENV -c conda-forge doxygen rstcheck - pip install --user -r requirements.txt + conda env update \ + -n $CONDA_ENV \ + --file ./env.yml || exit -1 + conda install \ + -q \ + -y \ + -n $CONDA_ENV \ + doxygen \ + 'rstcheck>=6.0.0' || exit -1 # check reStructuredText formatting cd $BUILD_DIRECTORY/python-package - rstcheck --report warning $(find . -type f -name "*.rst") || exit -1 + rstcheck --report-level warning $(find . -type f -name "*.rst") || exit -1 cd $BUILD_DIRECTORY/docs - rstcheck --report warning --ignore-directives=autoclass,autofunction,doxygenfile $(find . -type f -name "*.rst") || exit -1 + rstcheck --report-level warning --ignore-directives=autoclass,autofunction,autosummary,doxygenfile $(find . -type f -name "*.rst") || exit -1 # build docs make html || exit -1 if [[ $TASK == "check-links" ]]; then @@ -62,16 +69,13 @@ fi if [[ $TASK == "lint" ]]; then conda install -q -y -n $CONDA_ENV \ + cmakelint \ + cpplint \ + isort \ + mypy \ pycodestyle \ pydocstyle \ - r-stringi # stringi needs to be installed separate from r-lintr to avoid issues like 'unable to load shared object stringi.so' - # r-xfun below has to be upgraded because lintr requires > 0.19 for that package - conda install -q -y -n $CONDA_ENV \ - -c conda-forge \ - libxml2 \ - "r-xfun>=0.19" \ - "r-lintr>=2.0" - pip install --user cmakelint cpplint isort mypy + "r-lintr>=3.0" echo "Linting Python code" pycodestyle --ignore=E501,W503 --exclude=./.nuget,./external_libs . || exit -1 pydocstyle --convention=numpy --add-ignore=D105 --match-dir="^(?!^external_libs|test|example).*" --match="(?!^test_|setup).*\.py" . || exit -1 @@ -82,7 +86,7 @@ if [[ $TASK == "lint" ]]; then echo "Linting C++ code" cpplint --filter=-build/c++11,-build/include_subdir,-build/header_guard,-whitespace/line_length --recursive ./src ./include ./R-package ./swig ./tests || exit -1 cmake_files=$(find . -name CMakeLists.txt -o -path "*/cmake/*.cmake") - cmakelint --linelength=120 ${cmake_files} || true + cmakelint --linelength=120 --filter=-convention/filename,-package/stdargs,-readability/wonkycase ${cmake_files} || exit -1 exit 0 fi @@ -114,15 +118,27 @@ if [[ $TASK == "swig" ]]; then exit 0 fi -# temporary fix for https://github.com/microsoft/LightGBM/issues/4769 -if [[ $PYTHON_VERSION == "3.6" ]]; then - DASK_DEPENDENCIES="dask distributed" +# temporary fix for https://github.com/microsoft/LightGBM/issues/5390 +if [[ $PYTHON_VERSION == "3.7" ]]; then + DEPENDENCIES="dask distributed" else - DASK_DEPENDENCIES="dask=2021.9.1 distributed=2021.9.1" + DEPENDENCIES="dask=2022.7.0 distributed=2022.7.0 scipy<1.9" fi -conda install -q -y -n $CONDA_ENV cloudpickle ${DASK_DEPENDENCIES} joblib matplotlib numpy pandas psutil pytest scikit-learn scipy -pip install graphviz # python-graphviz from Anaconda is not allowed to be installed with Python 3.9 +conda install -q -y -n $CONDA_ENV \ + cloudpickle \ + ${DEPENDENCIES} \ + joblib \ + matplotlib \ + numpy \ + pandas \ + psutil \ + pytest \ + scikit-learn || exit -1 + +# python-graphviz has to be installed separately to prevent conda from downgrading to pypy +conda install -q -y -n $CONDA_ENV \ + python-graphviz || exit -1 if [[ $OS_NAME == "macos" ]] && [[ $COMPILER == "clang" ]]; then # fix "OMP: Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized." (OpenMP library conflict due to conda's MKL) @@ -140,7 +156,7 @@ if [[ $TASK == "sdist" ]]; then elif [[ $TASK == "bdist" ]]; then if [[ $OS_NAME == "macos" ]]; then cd $BUILD_DIRECTORY/python-package && python setup.py bdist_wheel --plat-name=macosx --python-tag py3 || exit -1 - mv dist/lightgbm-$LGB_VER-py3-none-macosx.whl dist/lightgbm-$LGB_VER-py3-none-macosx_10_14_x86_64.macosx_10_15_x86_64.macosx_11_0_x86_64.whl + mv dist/lightgbm-$LGB_VER-py3-none-macosx.whl dist/lightgbm-$LGB_VER-py3-none-macosx_10_15_x86_64.macosx_11_6_x86_64.macosx_12_0_x86_64.whl if [[ $PRODUCES_ARTIFACTS == "true" ]]; then cp dist/lightgbm-$LGB_VER-py3-none-macosx*.whl $BUILD_ARTIFACTSTAGINGDIRECTORY fi @@ -168,32 +184,52 @@ if [[ $TASK == "gpu" ]]; then grep -q 'std::string device_type = "gpu"' $BUILD_DIRECTORY/include/LightGBM/config.h || exit -1 # make sure that changes were really done if [[ $METHOD == "pip" ]]; then cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1 - pip install --user $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--gpu --install-option="--opencl-include-dir=$AMDAPPSDK_PATH/include/" || exit -1 + pip install --user $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--gpu || exit -1 pytest $BUILD_DIRECTORY/tests/python_package_test || exit -1 exit 0 elif [[ $METHOD == "wheel" ]]; then - cd $BUILD_DIRECTORY/python-package && python setup.py bdist_wheel --gpu --opencl-include-dir="$AMDAPPSDK_PATH/include/" || exit -1 + cd $BUILD_DIRECTORY/python-package && python setup.py bdist_wheel --gpu || exit -1 pip install --user $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER*.whl -v || exit -1 pytest $BUILD_DIRECTORY/tests || exit -1 exit 0 elif [[ $METHOD == "source" ]]; then - cmake -DUSE_GPU=ON -DOpenCL_INCLUDE_DIR=$AMDAPPSDK_PATH/include/ .. + cmake -DUSE_GPU=ON .. + fi +elif [[ $TASK == "cuda" || $TASK == "cuda_exp" ]]; then + if [[ $TASK == "cuda" ]]; then + sed -i'.bak' 's/std::string device_type = "cpu";/std::string device_type = "cuda";/' $BUILD_DIRECTORY/include/LightGBM/config.h + grep -q 'std::string device_type = "cuda"' $BUILD_DIRECTORY/include/LightGBM/config.h || exit -1 # make sure that changes were really done + else + sed -i'.bak' 's/std::string device_type = "cpu";/std::string device_type = "cuda_exp";/' $BUILD_DIRECTORY/include/LightGBM/config.h + grep -q 'std::string device_type = "cuda_exp"' $BUILD_DIRECTORY/include/LightGBM/config.h || exit -1 # make sure that changes were really done + # by default ``gpu_use_dp=false`` for efficiency. change to ``true`` here for exact results in ci tests + sed -i'.bak' 's/gpu_use_dp = false;/gpu_use_dp = true;/' $BUILD_DIRECTORY/include/LightGBM/config.h + grep -q 'gpu_use_dp = true' $BUILD_DIRECTORY/include/LightGBM/config.h || exit -1 # make sure that changes were really done fi -elif [[ $TASK == "cuda" ]]; then - sed -i'.bak' 's/std::string device_type = "cpu";/std::string device_type = "cuda";/' $BUILD_DIRECTORY/include/LightGBM/config.h - grep -q 'std::string device_type = "cuda"' $BUILD_DIRECTORY/include/LightGBM/config.h || exit -1 # make sure that changes were really done if [[ $METHOD == "pip" ]]; then cd $BUILD_DIRECTORY/python-package && python setup.py sdist || exit -1 - pip install --user $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--cuda || exit -1 + if [[ $TASK == "cuda" ]]; then + pip install --user $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--cuda || exit -1 + else + pip install --user $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER.tar.gz -v --install-option=--cuda-exp || exit -1 + fi pytest $BUILD_DIRECTORY/tests/python_package_test || exit -1 exit 0 elif [[ $METHOD == "wheel" ]]; then - cd $BUILD_DIRECTORY/python-package && python setup.py bdist_wheel --cuda || exit -1 + if [[ $TASK == "cuda" ]]; then + cd $BUILD_DIRECTORY/python-package && python setup.py bdist_wheel --cuda || exit -1 + else + cd $BUILD_DIRECTORY/python-package && python setup.py bdist_wheel --cuda-exp || exit -1 + fi pip install --user $BUILD_DIRECTORY/python-package/dist/lightgbm-$LGB_VER*.whl -v || exit -1 pytest $BUILD_DIRECTORY/tests || exit -1 exit 0 elif [[ $METHOD == "source" ]]; then - cmake -DUSE_CUDA=ON .. + if [[ $TASK == "cuda" ]]; then + cmake -DUSE_CUDA=ON .. + else + cmake -DUSE_CUDA_EXP=ON .. + fi fi elif [[ $TASK == "mpi" ]]; then if [[ $METHOD == "pip" ]]; then @@ -236,7 +272,11 @@ import matplotlib\ matplotlib.use\(\"Agg\"\)\ ' plot_example.py # prevent interactive window mode sed -i'.bak' 's/graph.render(view=True)/graph.render(view=False)/' plot_example.py - conda install -q -y -n $CONDA_ENV h5py ipywidgets notebook # requirements for examples + # requirements for examples + conda install -q -y -n $CONDA_ENV \ + h5py \ + ipywidgets \ + notebook for f in *.py **/*.py; do python $f || exit -1; done # run all examples cd $BUILD_DIRECTORY/examples/python-guide/notebooks sed -i'.bak' 's/INTERACTIVE = False/assert False, \\"Interactive mode disabled\\"/' interactive_plot_example.ipynb diff --git a/R-package/configure b/R-package/configure index 79470dc515aa..5bb4a1973ef6 100755 --- a/R-package/configure +++ b/R-package/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for lightgbm 3.3.2. +# Generated by GNU Autoconf 2.69 for lightgbm 3.3.2.99. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -576,8 +576,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='lightgbm' PACKAGE_TARNAME='lightgbm' -PACKAGE_VERSION='3.3.2' -PACKAGE_STRING='lightgbm 3.3.2' +PACKAGE_VERSION='3.3.2.99' +PACKAGE_STRING='lightgbm 3.3.2.99' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1182,7 +1182,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures lightgbm 3.3.2 to adapt to many kinds of systems. +\`configure' configures lightgbm 3.3.2.99 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1244,7 +1244,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of lightgbm 3.3.2:";; + short | recursive ) echo "Configuration of lightgbm 3.3.2.99:";; esac cat <<\_ACEOF @@ -1311,7 +1311,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -lightgbm configure 3.3.2 +lightgbm configure 3.3.2.99 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1328,7 +1328,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by lightgbm $as_me 3.3.2, which was +It was created by lightgbm $as_me 3.3.2.99, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -1713,7 +1713,7 @@ LGB_CPPFLAGS="" # Eigen # ######### -LGB_CPPFLAGS="${LGB_CPPFLAGS} -DEIGEN_MPL2_ONLY" +LGB_CPPFLAGS="${LGB_CPPFLAGS} -DEIGEN_MPL2_ONLY -DEIGEN_DONT_PARALLELIZE" ############### # MM_PREFETCH # @@ -2398,7 +2398,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by lightgbm $as_me 3.3.2, which was +This file was extended by lightgbm $as_me 3.3.2.99, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -2451,7 +2451,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -lightgbm config.status 3.3.2 +lightgbm config.status 3.3.2.99 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/VERSION.txt b/VERSION.txt index 619b53766848..49678dc178bd 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.3 +3.3.2.99 diff --git a/src/network/socket_wrapper.hpp b/src/network/socket_wrapper.hpp index e4d63c434fc4..528f5105eedf 100644 --- a/src/network/socket_wrapper.hpp +++ b/src/network/socket_wrapper.hpp @@ -35,12 +35,7 @@ #include #include -// ifaddrs.h is not available on Solaris 10 -#if (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)) - #include "ifaddrs_patch.h" -#else - #include -#endif +#include #endif // defined(_WIN32) @@ -60,11 +55,8 @@ const int INVALID_SOCKET = -1; #endif #ifdef _WIN32 -#ifndef _UCRT -// Recent MinGW has inet_pton, which then causes compiler error in -// combination with this replacement. -#ifndef _MSC_VER -// not using visual studio in windows +// existence of inet_pton is checked in CMakeLists.txt and configure.win, then stored in WIN_HAS_INET_PTON +#ifndef WIN_HAS_INET_PTON inline int inet_pton(int af, const char *src, void *dst) { struct sockaddr_storage ss; int size = sizeof(ss); @@ -89,7 +81,6 @@ inline int inet_pton(int af, const char *src, void *dst) { } #endif #endif -#endif #define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x)) #define FREE(x) HeapFree(GetProcessHeap(), 0, (x)) @@ -257,7 +248,7 @@ class TcpSocket { } inline bool Connect(const char *url, int port) { - sockaddr_in server_addr = GetAddress(url, port); + sockaddr_in server_addr = GetAddress(url, port); if (connect(sockfd_, reinterpret_cast(&server_addr), sizeof(sockaddr_in)) == 0) { return true; }