Add xgboost 1.5.2 (#28462)

Also remove obsolete py-dask-xgboost package
This commit is contained in:
Adam J. Stewart 2022-01-18 20:11:08 -06:00 committed by GitHub
parent 05df2c3371
commit 95fe66cb18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 52 deletions

View File

@ -1,28 +0,0 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyDaskXgboost(PythonPackage):
"""Distributed training with XGBoost and Dask.distributed.
Deprecated: use `py-xgboost+dask` instead."""
homepage = "https://github.com/dask/dask-xgboost/"
pypi = "dask-xgboost/dask-xgboost-0.1.11.tar.gz"
# Deprecated, see https://github.com/dask/dask-xgboost/issues/80
version('0.1.11', sha256='3fbe1bf4344dc74edfbe9f928c7e3e6acc26dc57cefd8da8ae56a15469c6941c', deprecated=True)
variant('sparse', default=False, description='Add sparse support')
depends_on('py-setuptools', type='build')
depends_on('py-xgboost@:0.90', type=('build', 'run'))
depends_on('py-dask', type=('build', 'run'))
depends_on('py-distributed@1.15.2:', type=('build', 'run'))
depends_on('py-sparse', type=('build', 'run'), when='+sparse')
depends_on('py-scipy', type=('build', 'run'), when='+sparse')

View File

@ -18,22 +18,18 @@ class PyXgboost(PythonPackage):
maintainers = ['adamjstewart']
import_modules = ['xgboost']
version('1.5.2', sha256='404dc09dca887ef5a9bc0268f882c54b33bfc16ac365a859a11e7b24d49da387')
version('1.3.3', sha256='397051647bb837915f3ff24afc7d49f7fca57630ffd00fb5ef66ae2a0881fb43')
version('0.90', sha256='d69f90d61a63e8889fd39a31ad00c629bac1ca627f8406b9b6d4594c9e29ab84', deprecated=True)
variant('pandas', default=False, description='Enable Pandas extensions for training.')
variant('scikit-learn', default=False, description='Enable scikit-learn extensions for training.')
variant('dask', default=False, description='Enables Dask extensions for distributed training.')
variant('plotting', default=False, description='Enables tree and importance plotting.')
for ver in ['1.3.3']:
for ver in ['1.3.3', '1.5.2']:
depends_on('xgboost@' + ver, when='@' + ver)
depends_on('cmake@3.12:', when='@1.0:1.2', type='build')
depends_on('llvm-openmp', when='@:1.2 %apple-clang')
depends_on('python@3.6:', when='@1.2:', type=('build', 'run'))
depends_on('python@3.5:', when='@1.0:', type=('build', 'run'))
depends_on('python@3.4:', type=('build', 'run'))
depends_on('python@3.6:', type=('build', 'run'))
depends_on('py-setuptools', type=('build'))
depends_on('py-numpy', type=('build', 'run'))
depends_on('py-scipy', type=('build', 'run'))
@ -49,19 +45,6 @@ class PyXgboost(PythonPackage):
depends_on('py-graphviz', when='+plotting', type=('build', 'run'))
depends_on('py-matplotlib', when='+plotting', type=('build', 'run'))
conflicts('+pandas', when='@:0')
conflicts('+scikit-learn', when='@:0')
conflicts('+dask', when='@:0')
conflicts('+plotting', when='@:0')
@when('@:0.90')
def patch(self):
# Fix OpenMP support on macOS
filter_file("OPENMP_FLAGS = -fopenmp",
"OPENMP_FLAGS = {0}".format(self.compiler.openmp_flag),
os.path.join("xgboost", "Makefile"), string=True)
@when('@1.3:')
def patch(self):
# https://github.com/dmlc/xgboost/issues/6706
# 'setup.py' is hard-coded to search in Python installation prefix
@ -74,6 +57,5 @@ def patch(self):
"'{0}',".format(self.spec['xgboost'].libs.directories[0]),
os.path.join('xgboost', 'libpath.py'), string=True)
@when('@1.3:')
def install_options(self, spec, prefix):
return ['--use-system-libxgboost']

View File

@ -20,9 +20,8 @@ class Xgboost(CMakePackage, CudaPackage):
maintainers = ['adamjstewart']
version('master', branch='master', submodules=True)
version('1.5.2', tag='v1.5.2', submodules=True)
version('1.3.3', tag='v1.3.3', submodules=True)
version('0.90', tag='v0.90', submodules=True, deprecated=True)
version('0.81', tag='v0.81', submodules=True, deprecated=True)
variant('nccl', default=False, description='Build with NCCL to enable distributed GPU support')
variant('openmp', default=True, description='Build with OpenMP support')
@ -31,12 +30,17 @@ class Xgboost(CMakePackage, CudaPackage):
depends_on('cmake@3.16:', when='platform=darwin', type='build')
depends_on('ninja', type='build')
depends_on('cuda@10:', when='+cuda')
# https://github.com/dmlc/xgboost/pull/7379
depends_on('cuda@10:11.4', when='@:1.5.0+cuda')
depends_on('nccl', when='+nccl')
depends_on('llvm-openmp', when='%apple-clang +openmp')
conflicts('%gcc@:4', msg='GCC version must be at least 5.0!')
conflicts('+nccl', when='~cuda', msg='NCCL requires CUDA')
conflicts('+cuda', when='~openmp', msg='CUDA requires OpenMP')
conflicts('cuda_arch=none', when='+cuda',
msg='Must specify CUDA compute capabilities of your GPU, see '
'https://developer.nvidia.com/cuda-gpus')
generator = 'Ninja'
@ -48,8 +52,11 @@ def cmake_args(self):
self.define_from_variant('USE_OPENMP', 'openmp'),
]
if '+cuda' in self.spec and 'cuda_arch=none' not in self.spec:
if '+cuda' in self.spec:
args.append(self.define(
'GPU_COMPUTE_VER', self.spec.variants['cuda_arch'].value))
if '@1.5: ^cuda@11.4:' in self.spec:
args.append(self.define('BUILD_WITH_CUDA_CUB', True))
return args