diff --git a/.scripts/build_steps.sh b/.scripts/build_steps.sh index 064e539a..eba1dfdb 100755 --- a/.scripts/build_steps.sh +++ b/.scripts/build_steps.sh @@ -34,9 +34,9 @@ CONDARC export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1 mamba install --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \ - pip mamba conda-build conda-forge-ci-setup=4 + pip mamba conda-build boa conda-forge-ci-setup=4 mamba update --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \ - pip mamba conda-build conda-forge-ci-setup=4 + pip mamba conda-build boa conda-forge-ci-setup=4 # set up the condarc setup_conda_rc "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}" @@ -74,7 +74,7 @@ if [[ "${BUILD_WITH_CONDA_DEBUG:-0}" == 1 ]]; then # Drop into an interactive shell /bin/bash else - conda build "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ + conda mambabuild "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ --suppress-variables ${EXTRA_CB_OPTIONS:-} \ --clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" \ --extra-meta flow_run_id="${flow_run_id:-}" remote_url="${remote_url:-}" sha="${sha:-}" diff --git a/.scripts/run_osx_build.sh b/.scripts/run_osx_build.sh index 46ab346d..9259eb93 100755 --- a/.scripts/run_osx_build.sh +++ b/.scripts/run_osx_build.sh @@ -26,9 +26,9 @@ export CONDA_SOLVER="libmamba" export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1 mamba install --update-specs --quiet --yes --channel conda-forge --strict-channel-priority \ - pip mamba conda-build conda-forge-ci-setup=4 + pip mamba conda-build boa conda-forge-ci-setup=4 mamba update --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \ - pip mamba conda-build conda-forge-ci-setup=4 + pip mamba conda-build boa conda-forge-ci-setup=4 @@ -81,7 +81,7 @@ else EXTRA_CB_OPTIONS="${EXTRA_CB_OPTIONS:-} --no-test" fi - conda build ./recipe -m ./.ci_support/${CONFIG}.yaml \ + conda mambabuild ./recipe -m ./.ci_support/${CONFIG}.yaml \ --suppress-variables ${EXTRA_CB_OPTIONS:-} \ --clobber-file ./.ci_support/clobber_${CONFIG}.yaml \ --extra-meta flow_run_id="$flow_run_id" remote_url="$remote_url" sha="$sha" diff --git a/.scripts/run_win_build.bat b/.scripts/run_win_build.bat index 5b2b8492..48734de9 100755 --- a/.scripts/run_win_build.bat +++ b/.scripts/run_win_build.bat @@ -24,7 +24,7 @@ set "CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1" :: Provision the necessary dependencies to build the recipe later echo Installing dependencies -mamba.exe install "python=3.10" pip mamba conda-build conda-forge-ci-setup=4 -c conda-forge --strict-channel-priority --yes +mamba.exe install "python=3.10" pip mamba conda-build boa conda-forge-ci-setup=4 -c conda-forge --strict-channel-priority --yes if !errorlevel! neq 0 exit /b !errorlevel! :: Set basic configuration @@ -42,7 +42,9 @@ if EXIST LICENSE.txt ( copy LICENSE.txt "recipe\\recipe-scripts-license.txt" ) if NOT [%HOST_PLATFORM%] == [%BUILD_PLATFORM%] ( - set "EXTRA_CB_OPTIONS=%EXTRA_CB_OPTIONS% --no-test" + if [%CROSSCOMPILING_EMULATOR%] == [] ( + set "EXTRA_CB_OPTIONS=%EXTRA_CB_OPTIONS% --no-test" + ) ) if NOT [%flow_run_id%] == [] ( @@ -53,7 +55,7 @@ call :end_group :: Build the recipe echo Building recipe -conda.exe build "recipe" -m .ci_support\%CONFIG%.yaml --suppress-variables %EXTRA_CB_OPTIONS% +conda.exe mambabuild "recipe" -m .ci_support\%CONFIG%.yaml --suppress-variables %EXTRA_CB_OPTIONS% if !errorlevel! neq 0 exit /b !errorlevel! :: Prepare some environment variables for the upload step diff --git a/recipe/0001-conda-Unbundle-libxgboost.-dll-dylib-so.patch b/recipe/0001-conda-Unbundle-libxgboost.-dll-dylib-so.patch deleted file mode 100644 index 4534c74c..00000000 --- a/recipe/0001-conda-Unbundle-libxgboost.-dll-dylib-so.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/python-package/xgboost/libpath.py b/python-package/xgboost/libpath.py -index f7a7d9cd..70d73626 100644 ---- a/python-package/xgboost/libpath.py -+++ b/python-package/xgboost/libpath.py -@@ -29,7 +29,10 @@ def find_lib_path() -> List[str]: - # option. - os.path.join(sys.prefix, 'lib'), - ] -- -+ if sys.platform == 'win32': -+ dll_path = [os.path.join(sys.prefix, 'Library', 'mingw-w64', 'bin')] -+ else: -+ dll_path = [os.path.join(sys.prefix, 'lib')] - if sys.platform == 'win32': - if platform.architecture()[0] == '64bit': - dll_path.append( diff --git a/recipe/0002-Enable-latest-libcxx-on-MacOS.patch b/recipe/0002-Enable-latest-libcxx-on-MacOS.patch new file mode 100644 index 00000000..0951d0ec --- /dev/null +++ b/recipe/0002-Enable-latest-libcxx-on-MacOS.patch @@ -0,0 +1,25 @@ +From 59ac1090da5ba692238f4baf87d46a4c81b9282c Mon Sep 17 00:00:00 2001 +From: Hyunsu Cho +Date: Wed, 1 Nov 2023 01:01:34 -0700 +Subject: [PATCH] Enable latest libcxx on MacOS + +--- + R-package/src/Makevars.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/R-package/src/Makevars.in b/R-package/src/Makevars.in +index 9e7cbfed..8b3af0ae 100644 +--- a/R-package/src/Makevars.in ++++ b/R-package/src/Makevars.in +@@ -7,7 +7,7 @@ CXX_STD = CXX17 + + XGB_RFLAGS = -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0\ + -DDMLC_ENABLE_STD_THREAD=$(ENABLE_STD_THREAD) -DDMLC_DISABLE_STDIN=1\ +- -DDMLC_LOG_CUSTOMIZE=1 ++ -DDMLC_LOG_CUSTOMIZE=1 -D_LIBCPP_DISABLE_AVAILABILITY + + # disable the use of thread_local for 32 bit windows: + ifeq ($(R_OSTYPE)$(WIN),windows) +-- +2.25.1 + diff --git a/recipe/0003-Use-mingw-w64-path.patch b/recipe/0003-Use-mingw-w64-path.patch new file mode 100644 index 00000000..9afa6b05 --- /dev/null +++ b/recipe/0003-Use-mingw-w64-path.patch @@ -0,0 +1,41 @@ +From 8007af85d3dab8369fbb89234e33ebb06d58dca6 Mon Sep 17 00:00:00 2001 +From: Hyunsu Cho +Date: Wed, 1 Nov 2023 08:47:29 -0700 +Subject: [PATCH] Use mingw-w64 path + +--- + python-package/packager/nativelib.py | 3 +++ + python-package/xgboost/libpath.py | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/python-package/packager/nativelib.py b/python-package/packager/nativelib.py +index 9d3fec2b..74942f42 100644 +--- a/python-package/packager/nativelib.py ++++ b/python-package/packager/nativelib.py +@@ -140,6 +140,9 @@ def locate_or_build_libxgboost( + sys_prefix / "Library", + sys_prefix / "Library" / "bin", + sys_prefix / "Library" / "lib", ++ sys_prefix / "Library" / "mingw-w64", ++ sys_prefix / "Library" / "mingw-w64" / "bin", ++ sys_prefix / "Library" / "mingw-w64" / "lib", + ] + sys_prefix_candidates = [ + p.expanduser().resolve() for p in sys_prefix_candidates +diff --git a/python-package/xgboost/libpath.py b/python-package/xgboost/libpath.py +index 58c78df0..92d46a0b 100644 +--- a/python-package/xgboost/libpath.py ++++ b/python-package/xgboost/libpath.py +@@ -38,6 +38,9 @@ def find_lib_path() -> List[str]: + os.path.join(sys.base_prefix, "Library"), + os.path.join(sys.base_prefix, "Library", "bin"), + os.path.join(sys.base_prefix, "Library", "lib"), ++ os.path.join(sys.base_prefix, "Library", "mingw-w64"), ++ os.path.join(sys.base_prefix, "Library", "mingw-w64", "bin"), ++ os.path.join(sys.base_prefix, "Library", "mingw-w64", "lib"), + ] + ) + dll_path = [os.path.join(p, "xgboost.dll") for p in dll_path] +-- +2.25.1 + diff --git a/recipe/0004-Undo-dmlc-xgboost-9436.patch b/recipe/0004-Undo-dmlc-xgboost-9436.patch new file mode 100644 index 00000000..2cbfbb3c --- /dev/null +++ b/recipe/0004-Undo-dmlc-xgboost-9436.patch @@ -0,0 +1,55 @@ +From 667a855dfa024ea392e60fa7f352a0781cb7f1e0 Mon Sep 17 00:00:00 2001 +From: Hyunsu Cho +Date: Thu, 2 Nov 2023 08:12:43 -0700 +Subject: [PATCH] Undo dmlc/xgboost#9436 + +--- + CMakeLists.txt | 9 --------- + cmake/Utils.cmake | 4 +--- + 2 files changed, 1 insertion(+), 12 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d6b861ab..ca0125cb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -253,15 +253,6 @@ add_subdirectory(${xgboost_SOURCE_DIR}/plugin) + + if (PLUGIN_RMM) + find_package(rmm REQUIRED) +- +- # Patch the rmm targets so they reference the static cudart +- # Remove this patch once RMM stops specifying cudart requirement +- # (since RMM is a header-only library, it should not specify cudart in its CMake config) +- get_target_property(rmm_link_libs rmm::rmm INTERFACE_LINK_LIBRARIES) +- list(REMOVE_ITEM rmm_link_libs CUDA::cudart) +- list(APPEND rmm_link_libs CUDA::cudart_static) +- set_target_properties(rmm::rmm PROPERTIES INTERFACE_LINK_LIBRARIES "${rmm_link_libs}") +- get_target_property(rmm_link_libs rmm::rmm INTERFACE_LINK_LIBRARIES) + endif (PLUGIN_RMM) + + #-- library +diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake +index 08050205..98e96e30 100644 +--- a/cmake/Utils.cmake ++++ b/cmake/Utils.cmake +@@ -177,8 +177,7 @@ function(xgboost_set_cuda_flags target) + set_target_properties(${target} PROPERTIES + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON +- CUDA_SEPARABLE_COMPILATION OFF +- CUDA_RUNTIME_LIBRARY Static) ++ CUDA_SEPARABLE_COMPILATION OFF) + endfunction(xgboost_set_cuda_flags) + + macro(xgboost_link_nccl target) +@@ -280,7 +279,6 @@ macro(xgboost_target_link_libraries target) + + if (USE_CUDA) + xgboost_set_cuda_flags(${target}) +- target_link_libraries(${target} PUBLIC CUDA::cudart_static) + endif (USE_CUDA) + + if (PLUGIN_RMM) +-- +2.25.1 + diff --git a/recipe/build.sh b/recipe/build.sh index 5fef5d6d..18ee1e4b 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -4,8 +4,16 @@ set -exuo pipefail mkdir -p build-target +XGB_CMAKE_ARGS=() + +if [[ "$target_platform" == osx-* ]] +then + XGB_CMAKE_ARGS=(-DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I${PREFIX}/include" -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I${PREFIX}/include" -DOpenMP_C_LIB_NAMES=libomp -DOpenMP_CXX_LIB_NAMES=libomp -DOpenMP_libomp_LIBRARY=${PREFIX}/lib/libomp.dylib ${XGB_CMAKE_ARGS[@]+"${XGB_CMAKE_ARGS[@]}"} ) +fi + + if [[ ${cuda_compiler_version} != "None" ]]; then - export CMAKE_ARGS="-DUSE_CUDA=ON -DUSE_NCCL=ON -DBUILD_WITH_SHARED_NCCL=ON ${CMAKE_ARGS}" + XGB_CMAKE_ARGS=(-DUSE_CUDA=ON -DUSE_NCCL=ON -DBUILD_WITH_SHARED_NCCL=ON ${XGB_CMAKE_ARGS[@]+"${XGB_CMAKE_ARGS[@]}"} ) fi # Limit number of threads used to avoid hardware oversubscription @@ -14,11 +22,12 @@ if [[ "${target_platform}" == "linux-aarch64" ]] || [[ "${target_platform}" == " fi pushd build-target -cmake ${CMAKE_ARGS} \ +cmake ${CMAKE_ARGS} ${XGB_CMAKE_ARGS[@]+"${XGB_CMAKE_ARGS[@]}"} \ -GNinja \ -DCMAKE_BUILD_TYPE:STRING="Release" \ -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON \ -DCMAKE_INSTALL_PREFIX:PATH="${PREFIX}" \ + -DCMAKE_CXX_FLAGS="-D_LIBCPP_DISABLE_AVAILABILITY" \ "${SRC_DIR}" cmake --build . --config Release popd diff --git a/recipe/install-py-xgboost.sh b/recipe/install-py-xgboost.sh index 91e08668..ee992d49 100644 --- a/recipe/install-py-xgboost.sh +++ b/recipe/install-py-xgboost.sh @@ -1,5 +1,5 @@ #!/bin/bash pushd ${SRC_DIR}/python-package - ${PYTHON} setup.py install --use-system-libxgboost --single-version-externally-managed --record=record.txt + ${PYTHON} -m pip install . -vv --config-settings use_system_libxgboost=True popd diff --git a/recipe/install-r-xgboost.sh b/recipe/install-r-xgboost.sh index 07651ce2..00c7aab0 100644 --- a/recipe/install-r-xgboost.sh +++ b/recipe/install-r-xgboost.sh @@ -5,5 +5,5 @@ pushd ${SRC_DIR}/R-package # This file is only used for windows compilation from github # It will be replaced with Makevars.in for the CRAN version # rm src/Makevars.win - ${R} CMD INSTALL --preclean --build . ${R_ARGS} + ${R} CMD INSTALL --preclean --build . --configure-args="CXXFLAGS=-D_LIBCPP_DISABLE_AVAILABILITY" ${R_ARGS} popd diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 0d00cf94..149e52a8 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,6 +1,6 @@ {% set name = "xgboost" %} -{% set version = "1.7.6" %} -{% set build_number = 6 %} +{% set version = "2.0.3" %} +{% set build_number = 0 %} {% set string_prefix = "cuda" ~ (cuda_compiler_version | replace('.', '')) %} # [cuda_compiler_version != "None"] {% set string_prefix = "cpu" %} # [cuda_compiler_version == "None"] @@ -16,8 +16,10 @@ source: git_tag: v{{ version }} patches: # xgboost patches - - 0001-conda-Unbundle-libxgboost.-dll-dylib-so.patch - 0001-Force-endian-flag-in-cross-compilation-mode.patch # [arm64 or aarch64 or ppc64le] + - 0002-Enable-latest-libcxx-on-MacOS.patch # [osx] + - 0003-Use-mingw-w64-path.patch + - 0004-Undo-dmlc-xgboost-9436.patch build: number: {{ build_number }} @@ -61,7 +63,7 @@ outputs: run: - __cuda # [cuda_compiler != "None"] {% if (cuda_compiler_version or "").startswith("11") %} - - cuda-version >={{ cuda_compiler_version }},<12 + - cuda-version >=11.2,<12 {% endif %} - name: _py-xgboost-mutex @@ -74,6 +76,14 @@ outputs: script: install-win-wrapper.bat # [win] build: string: {{ string_prefix }}_py{{ CONDA_PY }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} + script_env: + # Workaround an upstream conda-build issue w/pip & `outputs` by setting env vars manually. + # xref: https://github.com/conda/conda-build/issues/3993 + - PIP_NO_BUILD_ISOLATION=False + - PIP_NO_DEPENDENCIES=True + - PIP_IGNORE_INSTALLED=True + - PIP_CACHE_DIR=pip_cache + - PIP_NO_INDEX=True requirements: build: - python # [build_platform != target_platform] @@ -81,7 +91,7 @@ outputs: host: - {{ pin_subpackage('libxgboost', exact=True) }} - python - - setuptools + - hatchling >=1.12.1 - pip run: - {{ pin_subpackage('libxgboost', exact=True) }}