%global pkgvers 0 %global scdate0 20230403 %global schash0 15e073ca9d633d622eae94d33b846b9fd0ecfa3e %global branch0 master %global source0 https://github.com/dmlc/xgboost.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} %global vcu_maj 12 %global vcu_min 1 Name: xgboost Version: 1.7.5 Release: %{scdate0}.%{pkgvers}.git%{sshort0}.cu%{vcu_maj}_%{vcu_min}%{?dist} Summary: Scalable, Portable and Distributed Gradient Boosting License: Apache URL: https://github.com/dmlc/xgboost BuildRequires: doxygen cmake gcc-c++ git python3-setuptools BuildRequires: python3-devel gtest-devel dmlc-core-devel %define have_cuda 1 %define have_cuda_gcc 1 # last is always +PTX %define gpu_target_arch "61;75;86;89;90;50" %bcond_without cuda %if %{without cuda} %define have_cuda 0 %endif %if %{have_cuda} %if %{have_cuda_gcc} %if 0%{?fedora} || (0%{?rhel} > 8) BuildRequires: cuda-gcc-c++ %endif %endif BuildRequires: cuda-nvcc-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvtx-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-cudart-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvml-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvrtc-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-driver-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libnccl-devel libnccl Requires: cuda-cudart-%{vcu_maj}-%{vcu_min} Requires: cuda-nvrtc-%{vcu_maj}-%{vcu_min} %endif %undefine _hardened_build %undefine _annotated_build %undefine _strict_symbol_defs_build %global _lto_cflags %{nil} %global __cmake_in_source_build 1 %description Scalable, Portable and Distributed Gradient Boosting %package devel Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} %description devel This package contains development files for %{name}. %package python3 Summary: Python files for %{name} Requires: python3-cffi python3-psutil Requires: %{name} = %{version}-%{release} %description python3 This package contains python files for %{name}. %prep %setup -T -c -n %{name} git clone --depth 1 -n -b %{branch0} %{source0} . git fetch --depth 1 origin %{schash0} git reset --hard %{schash0} git submodule update --init --depth 1 gputreeshap git log --format=fuller # force PTX last arch sed -i -e 's|VERSION_GREATER_EQUAL "3.18")|VERSION_LESS_EQUAL "3.18")|' cmake/Utils.cmake # external dmlc-core sed -i '/add_subdirectory(${xgboost_SOURCE_DIR}\/dmlc-core)/,/endif (MSVC)/d' CMakeLists.txt sed -i 's|target xgboost objxgboost dmlc runxgboost|target xgboost objxgboost runxgboost|' CMakeLists.txt sed -i '/clean_copy_tree(dmlc_core/d' python-package/setup.py # build fixes sed -i -e 's|runxgboost PRIVATE|runxgboost PRIVATE %{_libdir}/libstdc++.so.6|g' CMakeLists.txt sed -i -e 's|xgboost PRIVATE objxgboost|xgboost PRIVATE objxgboost %{_libdir}/libstdc++.so.6|g' CMakeLists.txt sed -i -e 's|__CUDACC_VER_MINOR__ == 1|__CUDACC_VER_MINOR__ == 0|g' src/common/device_helpers.cuh sed -i -e 's|set(CMAKE_CUDA_HOST_COMPILER \${CMAKE_CXX_COMPILER})|set(CMAKE_CUDA_HOST_COMPILER ${CUDA_HOST_COMPILER})|' CMakeLists.txt # gcc13 sed -i -e '1i #include ' include/xgboost/base.h %build rm -rf cub rm -rf dmlc-core mkdir build pushd build %cmake .. -Wno-dev \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_CXX_STANDARD=17 \ %if %{have_cuda} -DUSE_CUDA=ON \ -DUSE_NCCL=ON \ -DBUILD_WITH_CUDA_CUB=ON \ -DBUILD_WITH_SHARED_NCCL=ON \ %if %{have_cuda_gcc} %if 0%{?fedora} || (0%{?rhel} > 8) -DCUDA_HOST_COMPILER="%{_bindir}/cuda-g++" \ %endif %endif -DGPU_COMPUTE_VER=%{gpu_target_arch} \ -DCMAKE_CUDA_COMPILER="/usr/local/cuda-%{vcu_maj}.%{vcu_min}/bin/nvcc" \ -DCMAKE_CUDA_FLAGS="--compiler-options -fPIC -Wno-deprecated-gpu-targets -allow-unsupported-compiler" \ %else -DUSE_CUDA=OFF \ %endif -DGOOGLE_TEST=OFF make %{?_smp_mflags} popd pushd python-package %{__python3} setup.py build popd %install pushd build make install DESTDIR=%{buildroot} popd pushd python-package %{__python3} setup.py install --root %{buildroot} popd mkdir -p %{buildroot}/%{_bindir} install -pm 0755 xgboost %{buildroot}/%{_bindir}/ # clean spurious files rm -rf %{buildroot}/usr/doc rm -rf %{buildroot}/usr/xgboost rm -rf %{buildroot}/%{python3_sitearch}/xgboost/rabit/test rm -rf %{buildroot}/%{python3_sitearch}/xgboost/rabit/guide rm -rf %{buildroot}/%{python3_sitearch}/xgboost/dmlc-core/scripts find %{buildroot}/%{python3_sitearch}/xgboost/ \ -type f \ -not -name '*.py' \ -not -name '*.pyc' \ -not -name '*.so' \ -not -name 'VERSION' \ -exec rm -rf {} \; # erase empty folders for d in `find %{buildroot}/%{python3_sitearch}/xgboost/ -type d -empty` do rm -rf $d | true done # python3 for f in `find %{buildroot} -name '*.py'`; do sed -i -e '/env python/d' $f done %files %license LICENSE %doc README.md %doc CONTRIBUTORS.md %{_bindir}/* %{_libdir}/lib*.so* %files devel %{_includedir}/* %{_datadir}/* %{_libdir}/cmake/* %{_libdir}/pkgconfig/* %files python3 %{python3_sitearch}/* %changelog * Wed Mar 27 2019 Balint Cristian - github update releases