NVIDIA cuML is an open-source CUDA-X Data Science library for GPU-accelerated machine learning. It provides two ways to run machine learning workloads on NVIDIA GPUs:
- The
cumlPython API provides GPU-native estimators with familiar scikit-learn-style APIs and direct control over machine learning workflows. cuml.accelaccelerates existing scikit-learn, UMAP, and HDBSCAN code without changing the Python code that uses those libraries.
On representative benchmarks, cuML can accelerate scikit-learn workflows by up to 50x. Performance depends on the algorithm, dataset, and hardware. See the cuML benchmarks for results and methodology.
The cuml Python API follows the familiar scikit-learn fit-predict-transform pattern while keeping data and computation on the GPU. The following example generates sample data and computes DBSCAN clusters on the GPU:
from cuml.datasets import make_blobs
from cuml.cluster import DBSCAN
# Create sample data
X, y = make_blobs(n_samples=100, centers=3, n_features=2, random_state=42)
# Fit clustering model
dbscan = DBSCAN(eps=1.0, min_samples=5)
dbscan.fit(X)
print(dbscan.labels_)cuml supports clustering, dimensionality reduction, regression,
classification, preprocessing, model selection, time series, model
explanation, and nearest-neighbor workflows. Browse the API
reference for the current list of
estimators and functions.
Run an existing Python script through the cuml.accel module:
python -m cuml.accel script.pyOr load the extension in a Jupyter notebook before importing scikit-learn, UMAP, or HDBSCAN:
%load_ext cuml.accelSupported operations run on the GPU. When an estimator or configuration cannot
be accelerated, cuml.accel uses the original CPU implementation so the rest
of the workflow can continue. See the cuml.accel compatibility
documentation for
current coverage and fallback conditions. Use the logging and profiling
tools to check
which operations ran on the GPU.
The cuml.dask API provides distributed implementations of selected algorithms
for multi-GPU and multi-node execution with Dask. See
the multi-GPU guide for
cluster setup, supported algorithms, and examples.
Use the installation selector to generate a command for installing nightly or release cuML packages with conda, pip, or Docker.
Additional resources:
- NVIDIA cuML documentation
- NVIDIA cuML product page
- Walkthrough notebooks
- CUDA-X Data Science libraries
See the build guide.
cuML is compatible with scikit-learn version 1.6 or higher.
cuML models can be serialized with pickle or joblib and loaded later for
inference. cuML uses cloudpickle so that models trained with cuml.accel can be
loaded and used with scikit-learn.
Only unpickle or deserialize from trusted sources. The pickle module (and
by extension joblib) is not secure: malicious payloads can execute arbitrary
code during deserialization and compromise your system. Do not unpickle or
load data from untrusted or tampered sources. This applies to pickle.load(),
pickle.loads(), joblib.load(), and any file-based model loading. For
details and patterns, see the Model Serialization and
Persistence notebook and the Python
pickle security documentation.
See the contributing guide to contribute to cuML. Report bugs and request features through GitHub issues. Join the broader community through the CUDA-X Data Science libraries page.
For additional details on the technologies behind cuML and the broader Python machine learning landscape, see Machine Learning in Python: Main developments and technology trends in data science, machine learning, and artificial intelligence (2020) by Sebastian Raschka, Joshua Patterson, and Corey Nolet.
Please consider citing this work when using cuML in a project:
@article{raschka2020machine,
title={Machine Learning in Python: Main developments and technology trends in data science, machine learning, and artificial intelligence},
author={Raschka, Sebastian and Patterson, Joshua and Nolet, Corey},
journal={arXiv preprint arXiv:2002.04803},
year={2020}
}