Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable cuml-cpu nightly #5585

Merged
merged 27 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
14ff3e2
FEA apply necessary changes to enable nightly builds
dantegd Sep 19, 2023
4fa5681
FIX multiple small fixes
dantegd Sep 19, 2023
2840e1c
FIX few more fixes
dantegd Sep 19, 2023
62b2a8f
FIX forgot NN in initial set
dantegd Sep 19, 2023
56728d5
FIX multuple style fixes
dantegd Sep 21, 2023
8a4406f
FIX more style fixes
dantegd Sep 21, 2023
fa5077a
FIX import fixes
dantegd Sep 22, 2023
fe92560
FIX import in tsvd
dantegd Sep 22, 2023
b2c42f6
FIX missing parameter from bad merge
dantegd Sep 22, 2023
1da95ca
FIX typo
dantegd Sep 22, 2023
d575a2d
FIX lr cimports and missing device changes
dantegd Sep 25, 2023
4007663
FIX cython extension
dantegd Sep 25, 2023
cdff65f
FIX copyright
dantegd Sep 25, 2023
ed3eb98
FIX Multiple minor fixes
dantegd Sep 26, 2023
2acd3f9
Merge branch 'branch-23.10' into fea-enable-cumlcpu-nightly
dantegd Sep 26, 2023
b766c97
FIX forgot to commit internal changes
dantegd Sep 26, 2023
4990d8a
FIX copyright
dantegd Sep 26, 2023
4a7fe11
FIX cython lint style fixes
dantegd Sep 26, 2023
b2efeba
FIX cython fix from merge conflict
dantegd Sep 26, 2023
32ff897
FIX wrong cmake conditional by accident
dantegd Sep 26, 2023
62baaf4
FIX Cmake verbosity
dantegd Sep 26, 2023
8aebe03
FIX typo in targets was causing conda build error
dantegd Sep 26, 2023
3e814a1
FIX missing log regression mg from merge conflict
dantegd Sep 27, 2023
3f645a6
FIX typo
dantegd Sep 27, 2023
db61f17
Remove accidentally commited local changes
dantegd Sep 27, 2023
1272ab4
FIX actual typo fix
dantegd Sep 27, 2023
97b6044
FIX temprary skip
dantegd Sep 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ HELP="$0 [<target> ...] [<flag> ...]
libcuml - build the cuml C++ code only. Also builds the C-wrapper library
around the C++ code.
cuml - build the cuml Python package
cuml-cpu - build the cuml CPU Python package
cpp-mgtests - build libcuml mnmg tests. Builds MPI communicator, adding MPI as dependency.
prims - build the ml-prims tests
bench - build the libcuml C++ benchmark
Expand Down Expand Up @@ -294,3 +295,9 @@ if (! hasArg --configure-only) && (completeBuild || hasArg cuml || hasArg pydocs
make html
fi
fi

if hasArg cuml-cpu; then
SKBUILD_CONFIGURE_OPTIONS="${CUML_EXTRA_CMAKE_ARGS} -DCUML_CPU=ON -DFIND_CUML_CPP=OFF" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL}" \
python -m pip install --no-build-isolation --no-deps ${REPODIR}/python
fi
9 changes: 9 additions & 0 deletions ci/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,13 @@ rapids-conda-retry mambabuild \
--channel "${CPP_CHANNEL}" \
conda/recipes/cuml

# Build cuml-cpu only in CUDA 11 jobs since it only depends on python
# version
RAPIDS_CUDA_MAJOR="${RAPIDS_CUDA_VERSION%%.*}"
if [[ ${RAPIDS_CUDA_MAJOR} == "11" ]]; then
rapids-conda-retry mambabuild \
--no-test \
conda/recipes/cuml-cpu
fi

rapids-upload-conda-to-s3 python
5 changes: 5 additions & 0 deletions conda/recipes/cuml-cpu/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Copyright (c) 2023, NVIDIA CORPORATION.

# This assumes the script is executed from the root of the repo directory
./build.sh cuml-cpu -v
11 changes: 11 additions & 0 deletions conda/recipes/cuml-cpu/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
c_compiler_version:
- 11

cxx_compiler_version:
- 11

cmake_version:
- ">=3.26.4"

sysroot_version:
- "=2.17"
50 changes: 50 additions & 0 deletions conda/recipes/cuml-cpu/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright (c) 2023, NVIDIA CORPORATION.

# Usage:
# conda build . -c conda-forge -c numba -c rapidsai -c pytorch
{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set py_version = environ['CONDA_PY'] %}
{% set date_string = environ['RAPIDS_DATE_STRING'] %}

package:
name: cuml-cpu
version: {{ version }}

source:
git_url: ../../..

build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: py{{ py_version }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- VERSION_SUFFIX

requirements:
build:
- cmake {{ cmake_version }}
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- sysroot_{{ target_platform }} {{ sysroot_version }}
- ninja
host:
- python x.x
- setuptools
- scikit-build>=0.13.1
- cython>=3.0.0
run:
- python x.x
- numpy
- scikit-learn=1.2
- hdbscan<=0.8.30
- umap-learn=0.5.3
- nvtx

tests: # [linux64]
imports: # [linux64]
- cuml-cpu # [linux64]

about:
home: http://rapids.ai/
license: Apache-2.0
# license_file: LICENSE
summary: cuML-CPU library
57 changes: 45 additions & 12 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ include(../fetch_rapids.cmake)

set(CUML_VERSION 23.10.00)

# We always need CUDA for cuML because the raft dependency brings in a
# header-only cuco dependency that enables CUDA unconditionally.
include(rapids-cuda)
rapids_cuda_init_architectures(cuml-python)
option(CUML_CPU "Build only cuML CPU Python components." OFF)
set(language_list "C;CXX")

if(NOT CUML_CPU)
# We always need CUDA for cuML GPU because the raft dependency brings in a
# header-only cuco dependency that enables CUDA unconditionally.
include(rapids-cuda)
rapids_cuda_init_architectures(cuml-python)
list(APPEND language_list "CUDA")
endif()

project(
cuml-python
Expand All @@ -30,14 +36,12 @@ project(
# language to be enabled here. The test project that is built in scikit-build to verify
# various linking options for the python library is hardcoded to build with C, so until
# that is fixed we need to keep C.
C CXX CUDA
${language_list}
)

################################################################################
# - User Options --------------------------------------------------------------
option(CUML_UNIVERSAL "Build all cuML Python components." ON)
option(CUML_CPU "Build only cuML CPU Python components." OFF)
option(CUML_GPU "Build only cuML GPU Python components. Not supported yet, defaulting to CUML_UNIVERSAL" OFF)
option(FIND_CUML_CPP "Search for existing CUML C++ installations before defaulting to local files" OFF)
option(CUML_BUILD_WHEELS "Whether this build is generating a Python wheel." OFF)
option(SINGLEGPU "Disable all mnmg components and comms libraries" OFF)
Expand Down Expand Up @@ -80,7 +84,7 @@ else()
set(CUML_PYTHON_TREELITE_TARGET treelite::treelite)
endif()

if(NOT cuml_FOUND)
if(NOT cuml_FOUND AND NOT ${CUML_CPU})
set(BUILD_CUML_TESTS OFF)
set(BUILD_PRIMS_TESTS OFF)
set(BUILD_CUML_C_LIBRARY OFF)
Expand Down Expand Up @@ -118,10 +122,28 @@ if(CUML_CPU)
set(SINGLEGPU ON)

set(CUML_ALGORITHMS "linearregression")
endif()
list(APPEND CUML_ALGORITHMS "pca")
list(APPEND CUML_ALGORITHMS "tsvd")
list(APPEND CUML_ALGORITHMS "elasticnet")
list(APPEND CUML_ALGORITHMS "logisticregression")
list(APPEND CUML_ALGORITHMS "ridge")
list(APPEND CUML_ALGORITHMS "lasso")
list(APPEND CUML_ALGORITHMS "umap")
list(APPEND CUML_ALGORITHMS "knn")
list(APPEND CUML_ALGORITHMS "hdbscan")

# this won't be needed when we add CPU libcuml++ (FIL)
set(cuml_sg_libraries "")

list(APPEND CYTHON_FLAGS
"--compile-time-env GPUBUILD=0")
else()
set(cuml_sg_libraries cuml::${CUML_CPP_TARGET})
set(cuml_mg_libraries cuml::${CUML_CPP_TARGET})

set(cuml_sg_libraries cuml::${CUML_CPP_TARGET})
set(cuml_mg_libraries cuml::${CUML_CPP_TARGET})
list(APPEND CYTHON_FLAGS
"--compile-time-env GPUBUILD=1")
endif()

if(NOT SINGLEGPU)
include("${CUML_CPP_SRC}/cmake/thirdparty/get_cumlprims_mg.cmake")
Expand All @@ -131,9 +153,20 @@ if(NOT SINGLEGPU)
)
endif()

################################################################################
# - Build Cython artifacts -----------------------------------------------------

include("${CUML_CPP_SRC}/cmake/modules/ConfigureAlgorithms.cmake")
include(cmake/ConfigureCythonAlgorithms.cmake)

if(${CUML_CPU})
# libcuml requires metrics built if HDSCAN is built, which is not the case
# for cuml-cpu
unset(metrics_algo)
endif()

rapids_cython_init()

include(cmake/ConfigureAlgorithmsHelpers.cmake)

add_subdirectory(cuml/common)
add_subdirectory(cuml/internals)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@


function(add_module_gpu_default FILENAME)
set (extra_args ${ARGN})
list(LENGTH extra_args extra_count)
if (${extra_count} GREATER 0 OR
${CUML_UNIVERSAL} OR
${CUML_GPU})
list(APPEND cython_sources
${FILENAME})
set (cython_sources ${cython_sources} PARENT_SCOPE)
endif()
endfunction()


function(add_module_universal_default FILENAME)
set (extra_args ${ARGN})
list(LENGTH extra_args extra_count)
if (${extra_count} GREATER 0 OR
Expand Down
133 changes: 71 additions & 62 deletions python/cuml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,96 +15,105 @@
#

from cuml.internals.base import Base, UniversalBase
from cuml.internals.available_devices import is_cuda_available

# GPU only packages

import cuml.common.cuda as cuda
from cuml.common.handle import Handle
if is_cuda_available():
import cuml.common.cuda as cuda
from cuml.common.handle import Handle

from cuml.cluster.dbscan import DBSCAN
from cuml.cluster.kmeans import KMeans
from cuml.cluster.agglomerative import AgglomerativeClustering
from cuml.cluster.hdbscan import HDBSCAN
from cuml.cluster.dbscan import DBSCAN
from cuml.cluster.kmeans import KMeans
from cuml.cluster.agglomerative import AgglomerativeClustering

from cuml.datasets.arima import make_arima
from cuml.datasets.blobs import make_blobs
from cuml.datasets.regression import make_regression
from cuml.datasets.classification import make_classification
from cuml.datasets.arima import make_arima
from cuml.datasets.blobs import make_blobs
from cuml.datasets.regression import make_regression
from cuml.datasets.classification import make_classification

from cuml.decomposition.pca import PCA
from cuml.decomposition.tsvd import TruncatedSVD
from cuml.decomposition.incremental_pca import IncrementalPCA
from cuml.decomposition.incremental_pca import IncrementalPCA

from cuml.fil.fil import ForestInference
from cuml.fil.fil import ForestInference

from cuml.ensemble.randomforestclassifier import RandomForestClassifier
from cuml.ensemble.randomforestregressor import RandomForestRegressor
from cuml.ensemble.randomforestclassifier import RandomForestClassifier
from cuml.ensemble.randomforestregressor import RandomForestRegressor

from cuml.explainer.kernel_shap import KernelExplainer
from cuml.explainer.permutation_shap import PermutationExplainer
from cuml.explainer.tree_shap import TreeExplainer
from cuml.explainer.kernel_shap import KernelExplainer
from cuml.explainer.permutation_shap import PermutationExplainer
from cuml.explainer.tree_shap import TreeExplainer

import cuml.feature_extraction
from cuml.fil import fil
import cuml.feature_extraction
from cuml.fil import fil

from cuml.internals.global_settings import (
GlobalSettings,
_global_settings_data,
)
from cuml.kernel_ridge.kernel_ridge import KernelRidge

from cuml.kernel_ridge.kernel_ridge import KernelRidge
from cuml.linear_model.mbsgd_classifier import MBSGDClassifier
from cuml.linear_model.mbsgd_regressor import MBSGDRegressor

from cuml.linear_model.elastic_net import ElasticNet
from cuml.linear_model.lasso import Lasso
from cuml.linear_model.logistic_regression import LogisticRegression
from cuml.linear_model.mbsgd_classifier import MBSGDClassifier
from cuml.linear_model.mbsgd_regressor import MBSGDRegressor
from cuml.linear_model.ridge import Ridge
from cuml.manifold.t_sne import TSNE
from cuml.metrics.accuracy import accuracy_score
from cuml.metrics.cluster.adjusted_rand_index import adjusted_rand_score
from cuml.metrics.regression import r2_score
from cuml.model_selection import train_test_split

from cuml.manifold.t_sne import TSNE
from cuml.manifold.umap import UMAP
from cuml.metrics.accuracy import accuracy_score
from cuml.metrics.cluster.adjusted_rand_index import adjusted_rand_score
from cuml.metrics.regression import r2_score
from cuml.model_selection import train_test_split
from cuml.naive_bayes.naive_bayes import MultinomialNB

from cuml.naive_bayes.naive_bayes import MultinomialNB
from cuml.neighbors.nearest_neighbors import NearestNeighbors
from cuml.neighbors.kernel_density import KernelDensity
from cuml.neighbors.kneighbors_classifier import KNeighborsClassifier
from cuml.neighbors.kneighbors_regressor import KNeighborsRegressor

from cuml.neighbors.nearest_neighbors import NearestNeighbors
from cuml.neighbors.kernel_density import KernelDensity
from cuml.neighbors.kneighbors_classifier import KNeighborsClassifier
from cuml.neighbors.kneighbors_regressor import KNeighborsRegressor
from cuml.preprocessing.LabelEncoder import LabelEncoder

from cuml.preprocessing.LabelEncoder import LabelEncoder
from cuml.random_projection.random_projection import (
GaussianRandomProjection,
)
from cuml.random_projection.random_projection import SparseRandomProjection
from cuml.random_projection.random_projection import (
johnson_lindenstrauss_min_dim,
)

from cuml.random_projection.random_projection import GaussianRandomProjection
from cuml.random_projection.random_projection import SparseRandomProjection
from cuml.random_projection.random_projection import (
johnson_lindenstrauss_min_dim,
)
from cuml.svm import SVC
from cuml.svm import SVR
from cuml.svm import LinearSVC
from cuml.svm import LinearSVR

from cuml.solvers.cd import CD
from cuml.solvers.sgd import SGD
from cuml.solvers.qn import QN
from cuml.svm import SVC
from cuml.svm import SVR
from cuml.svm import LinearSVC
from cuml.svm import LinearSVR
from cuml.tsa import stationarity
from cuml.tsa.arima import ARIMA
from cuml.tsa.auto_arima import AutoARIMA
from cuml.tsa.holtwinters import ExponentialSmoothing

from cuml.common.pointer_utils import device_of_gpu_matrix

# Universal packages

from cuml.tsa import stationarity
from cuml.tsa.arima import ARIMA
from cuml.tsa.auto_arima import AutoARIMA
from cuml.tsa.holtwinters import ExponentialSmoothing
from cuml.internals.global_settings import (
GlobalSettings,
_global_settings_data,
)

from cuml.common.pointer_utils import device_of_gpu_matrix
from cuml.internals.memory_utils import (
set_global_output_type,
using_output_type,
)

# Universal packages
from cuml.cluster.hdbscan import HDBSCAN

from cuml.decomposition.pca import PCA
from cuml.decomposition.tsvd import TruncatedSVD

from cuml.linear_model.linear_regression import LinearRegression
from cuml.linear_model.elastic_net import ElasticNet
from cuml.linear_model.lasso import Lasso
from cuml.linear_model.logistic_regression import LogisticRegression
from cuml.linear_model.ridge import Ridge

from cuml.manifold.umap import UMAP

from cuml.solvers.cd import CD
from cuml.solvers.sgd import SGD
from cuml.solvers.qn import QN

# Version configuration
__version__ = "23.10.00"
Expand Down
Loading