Skip to content

Commit

Permalink
Merge branch 'branch-25.02' into new-umap-defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
betatim committed Jan 14, 2025
2 parents 52b0bfa + 47bac70 commit 70750de
Show file tree
Hide file tree
Showing 17 changed files with 190 additions and 89 deletions.
8 changes: 3 additions & 5 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ cpp/ @rapidsai/cuml-cpp-codeowners
python/ @rapidsai/cuml-python-codeowners

#cmake code owners
**/CMakeLists.txt @rapidsai/cuml-cmake-codeowners
**/cmake/ @rapidsai/cuml-cmake-codeowners
python/cuml/pyproject.toml @rapidsai/cuml-cmake-codeowners
build.sh @rapidsai/cuml-cmake-codeowners
**/build.sh @rapidsai/cuml-cmake-codeowners
CMakeLists.txt @rapidsai/cuml-cmake-codeowners
*.cmake @rapidsai/cuml-cmake-codeowners
**/cmake/ @rapidsai/cuml-cmake-codeowners

#CI code owners
/.github/ @rapidsai/ci-codeowners
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@ jobs:
sha: ${{ inputs.sha }}
date: ${{ inputs.date }}
package-name: cuml
package-type: python
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ cpp/Doxyfile
# clang tooling
compile_commands.json
.clangd/

# generally prefer 'pyproject.toml' to 'pytest.ini' for pytest options
# ref: https://github.com/rapidsai/cuml/pull/6201
pytest.ini
!python/cuml/cuml/benchmark/automated/pytest.ini
7 changes: 4 additions & 3 deletions ci/test_wheel.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/bin/bash
# Copyright (c) 2023-2024, NVIDIA CORPORATION.
# Copyright (c) 2023-2025, NVIDIA CORPORATION.

set -euo pipefail

mkdir -p ./dist
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})"
RAPIDS_PY_WHEEL_NAME="cuml_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 ./dist
RAPIDS_PY_WHEEL_NAME="cuml_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 python ./dist

# echo to expand wildcard before adding `[extra]` requires for pip
python -m pip install $(echo ./dist/cuml*.whl)[test]
python -m pip install \
"$(echo ./dist/cuml*.whl)[test]"

RAPIDS_TESTS_DIR=${RAPIDS_TESTS_DIR:-"${PWD}/test-results"}
mkdir -p "${RAPIDS_TESTS_DIR}"
Expand Down
2 changes: 2 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ option(USE_CCACHE "Cache build artifacts with ccache" OFF)
option(CUDA_STATIC_RUNTIME "Statically link the CUDA runtime" OFF)
option(CUDA_STATIC_MATH_LIBRARIES "Statically link the CUDA math libraries" OFF)
option(CUML_USE_CUVS_STATIC "Build and statically link the CUVS library" OFF)
option(CUML_USE_RAFT_STATIC "Build and statically link the RAFT library" OFF)
option(CUML_USE_TREELITE_STATIC "Build and statically link the treelite library" OFF)
option(CUML_EXPORT_TREELITE_LINKAGE "Whether to publicly or privately link treelite to libcuml++" OFF)
option(CUML_USE_CUMLPRIMS_MG_STATIC "Build and statically link the cumlprims_mg library" OFF)
Expand Down Expand Up @@ -99,6 +100,7 @@ message(VERBOSE "CUML_CPP: Cache build artifacts with ccache: ${USE_CCACHE}")
message(VERBOSE "CUML_CPP: Statically link the CUDA runtime: ${CUDA_STATIC_RUNTIME}")
message(VERBOSE "CUML_CPP: Statically link the CUDA math libraries: ${CUDA_STATIC_MATH_LIBRARIES}")
message(VERBOSE "CUML_CPP: Build and statically link CUVS libraries: ${CUML_USE_CUVS_STATIC}")
message(VERBOSE "CUML_CPP: Build and statically link RAFT library: ${CUML_USE_RAFT_STATIC}")
message(VERBOSE "CUML_CPP: Build and statically link Treelite library: ${CUML_USE_TREELITE_STATIC}")

set(CUML_ALGORITHMS "ALL" CACHE STRING "Experimental: Choose which algorithms are built into libcuml++.so. Can specify individual algorithms or groups in a semicolon-separated list.")
Expand Down
3 changes: 2 additions & 1 deletion cpp/cmake/thirdparty/get_cuvs.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2024, NVIDIA CORPORATION.
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,6 +55,7 @@ function(find_and_configure_cuvs)
OPTIONS
"BUILD_TESTS OFF"
"BUILD_BENCH OFF"
"BUILD_CAGRA_HNSWLIB OFF"
"BUILD_MG_ALGOS ${CUVS_BUILD_MG_ALGOS}"

)
Expand Down
4 changes: 2 additions & 2 deletions cpp/cmake/thirdparty/get_raft.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
# Copyright (c) 2021-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,7 +43,7 @@ function(find_and_configure_raft)
message(VERBOSE "CUML: raft FIND_PACKAGE_ARGUMENTS COMPONENTS ${RAFT_COMPONENTS}")

rapids_cpm_find(raft ${PKG_VERSION}
GLOBAL_TARGETS raft::raft
GLOBAL_TARGETS raft::raft raft::raft_logger raft::raft_logger_impl
BUILD_EXPORT_SET cuml-exports
INSTALL_EXPORT_SET cuml-exports
COMPONENTS ${RAFT_COMPONENTS}
Expand Down
46 changes: 25 additions & 21 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ files:
- cuda
- cuda_version
- depends_on_cudf
- depends_on_cuda_python
- depends_on_cupy
- depends_on_cuvs
- depends_on_dask_cudf
Expand All @@ -21,8 +22,8 @@ files:
- depends_on_raft_dask
- depends_on_rmm
- docs
- py_build
- py_run
- py_build_cuml
- py_run_cuml
- py_version
- rapids_build_backend
- test_python
Expand Down Expand Up @@ -90,7 +91,7 @@ files:
- depends_on_pylibraft
- depends_on_raft_dask
- depends_on_rmm
- py_run
- py_run_cuml
- py_version
- test_notebooks
py_build_cuml:
Expand All @@ -108,27 +109,29 @@ files:
key: requires
includes:
- common_build
- depends_on_cuda_python
- depends_on_cuvs
- depends_on_libcumlprims
- depends_on_libraft_headers
- depends_on_pylibraft
- depends_on_rmm
- py_build
- py_build_cuml
py_run_cuml:
output: pyproject
pyproject_dir: python/cuml
extras:
table: project
includes:
- cuda_wheels
- depends_on_cuda_python
- depends_on_cudf
- depends_on_cupy
- depends_on_cuvs
- depends_on_dask_cudf
- depends_on_pylibraft
- depends_on_raft_dask
- depends_on_rmm
- py_run
- py_run_cuml
py_test_cuml:
output: pyproject
pyproject_dir: python/cuml
Expand Down Expand Up @@ -210,28 +213,14 @@ dependencies:
cuda: "12.*"
packages:
- cuda-nvcc
py_build:
py_build_cuml:
common:
- output_types: [conda, requirements, pyproject]
packages:
- &cython cython>=3.0.0
- &treelite treelite==4.3.0
specific:
- output_types: [conda, requirements, pyproject]
matrices:
- matrix:
cuda: "12.*"
packages:
- cuda-python>=12.6.2,<13.0a0
- matrix:
cuda: "11.*"
packages:
- cuda-python>=11.8.5,<12.0a0
- matrix:
packages:
- cuda-python

py_run:
py_run_cuml:
common:
- output_types: [conda, requirements, pyproject]
packages:
Expand Down Expand Up @@ -469,6 +458,21 @@ dependencies:
- *scikit_learn
- seaborn
- *xgboost
depends_on_cuda_python:
specific:
- output_types: [conda, requirements, pyproject]
matrices:
- matrix:
cuda: "12.*"
packages:
- cuda-python>=12.6.2,<13.0a0
- matrix:
cuda: "11.*"
packages:
- cuda-python>=11.8.5,<12.0a0
- matrix:
packages:
- cuda-python
depends_on_cudf:
common:
- output_types: conda
Expand Down
17 changes: 16 additions & 1 deletion docs/source/sphinxext/github_link.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# This contains code with copyright by the scikit-learn project, subject to the
# license in /thirdparty/LICENSES/LICENSE.scikit_learn
#
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import inspect
import os
Expand Down Expand Up @@ -103,7 +118,7 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
else:
if fn.endswith(".pyx"):
sp_path = next(x for x in sys.path if re.match(".*site-packages$", x))
fn = fn.replace("/opt/conda/conda-bld/work/python", sp_path)
fn = fn.replace("/opt/conda/conda-bld/work/python/cuml", sp_path)

# Convert to relative from module root
fn = os.path.relpath(fn,
Expand Down
4 changes: 2 additions & 2 deletions python/cuml/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =============================================================================
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
# Copyright (c) 2022-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -174,7 +174,7 @@ endif()
include("${CUML_CPP_SRC}/cmake/modules/ConfigureAlgorithms.cmake")
include(cmake/ConfigureCythonAlgorithms.cmake)

if(${CUML_CPU})
if(CUML_CPU)
# libcuml requires metrics built if HDSCAN is built, which is not the case
# for cuml-cpu
unset(metrics_algo)
Expand Down
11 changes: 7 additions & 4 deletions python/cuml/cuml/internals/import_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2024, NVIDIA CORPORATION.
# Copyright (c) 2019-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

import platform

from packaging.version import Version
Expand Down Expand Up @@ -145,11 +144,15 @@ def check_min_cupy_version(version):
return False


def has_scipy(raise_if_unavailable=False):
def has_scipy(raise_if_unavailable=False, min_version=None):
try:
import scipy # NOQA

return True
if min_version is None:
return True
else:
return Version(str(scipy.__version__)) >= Version(min_version)

except ImportError:
if not raise_if_unavailable:
return False
Expand Down
5 changes: 0 additions & 5 deletions python/cuml/cuml/tests/pytest.ini

This file was deleted.

18 changes: 14 additions & 4 deletions python/cuml/cuml/tests/test_arima.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,7 +36,10 @@
from cuml.internals.safe_imports import gpu_only_import
import statsmodels.api as sm
from sklearn.model_selection import train_test_split
from cuml.internals.safe_imports import cpu_only_import_from
from cuml.internals.safe_imports import (
cpu_only_import_from,
gpu_only_import_from,
)
import warnings
import os
import pytest
Expand All @@ -49,6 +52,7 @@
approx_fprime = cpu_only_import_from("scipy.optimize", "approx_fprime")

cudf = gpu_only_import("cudf")
cudf_pandas_active = gpu_only_import_from("cudf.pandas", "LOADED")


###############################################################################
Expand Down Expand Up @@ -143,7 +147,7 @@ def __init__(
n_obs=137,
n_test=10,
dataset="population_estimate",
tolerance_integration=0.01,
tolerance_integration=0.06,
)

# ARIMA(1,1,1) with intercept (missing observations)
Expand Down Expand Up @@ -255,7 +259,8 @@ def __init__(
((1, 1, 1, 0, 0, 0, 0, 1), test_111c_missing),
((1, 0, 1, 1, 1, 1, 4, 0), test_101_111_4),
((5, 1, 0, 0, 0, 0, 0, 0), test_510),
((1, 1, 1, 2, 0, 0, 4, 1), test_111_200_4c),
# Skip due to update to Scipy 1.15
# ((1, 1, 1, 2, 0, 0, 4, 1), test_111_200_4c),
((1, 1, 1, 2, 0, 0, 4, 1), test_111_200_4c_missing),
((1, 1, 1, 2, 0, 0, 4, 1), test_111_200_4c_missing_exog),
((1, 1, 2, 0, 1, 2, 4, 0), test_112_012_4),
Expand Down Expand Up @@ -409,6 +414,11 @@ def fill_interpolation(df_in):
@pytest.mark.parametrize("dtype", [np.float64])
def test_integration(key, data, dtype):
"""Full integration test: estimate, fit, forecast"""
if (
data.dataset == "endog_hourly_earnings_by_industry_missing_exog"
and cudf_pandas_active
):
pytest.skip(reason="https://github.com/rapidsai/cuml/issues/6209")
order, seasonal_order, intercept = extract_order(key)
s = max(1, seasonal_order[3])

Expand Down
10 changes: 8 additions & 2 deletions python/cuml/cuml/tests/test_batched_lbfgs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,9 @@
# limitations under the License.
#

import pytest

from cuml.common import has_scipy
from cuml.tsa.batched_lbfgs import batched_fmin_lbfgs_b
from cuml.internals.safe_imports import cpu_only_import

Expand Down Expand Up @@ -64,6 +67,10 @@ def g_batched_rosenbrock(
return gall


@pytest.mark.xfail(
condition=has_scipy(min_version="1.15"),
reason="https://github.com/rapidsai/cuml/issues/6210",
)
def test_batched_lbfgs_rosenbrock():
"""Test batched rosenbrock using batched lbfgs implemtnation"""

Expand Down Expand Up @@ -107,7 +114,6 @@ def gf(x, n=None):
res_xk, _, _ = batched_fmin_lbfgs_b(
f, x0, num_batches, gf, iprint=-1, factr=100
)

np.testing.assert_allclose(res_xk, res_true, rtol=1e-5)


Expand Down
Loading

0 comments on commit 70750de

Please sign in to comment.