pip install cuml-cu12★pip wheel for CUDA 12.x. The package name encodes the CUDA major version (cuml-cu12). Needs an NVIDIA GPU — there is no CPU-only build.conda install -c rapidsai -c conda-forge -c nvidia cuml=26.08Conda is the fully-supported path (pulls the matchingcudf,cupy, CUDA runtime). Versions are CalVer =YY.MM.import cuml; cuml.__version__ # requires NVIDIA GPU, compute capability 7.0+ (Volta or newer), CUDA 12★One conda env should share ONE RAPIDS version acrosscuml/cudf/cupy— mismatches are the #1 install failure.
# Jupyter/IPython: FIRST cell, before importing sklearn %load_ext cuml.accel from sklearn.ensemble import RandomForestClassifier★The headline feature. Load the extension, then use unmodified scikit-learn code — it runs on the GPU automatically. Accelerates scikit-learn, umap-learn, and hdbscan.python -m cuml.accel my_script.py★Run any existing sklearn script GPU-accelerated, unchanged, from the CLI. Nothing in the script needs editing.import cuml cuml.accel.install() from sklearn.cluster import KMeans # re-import AFTER install()Programmatic form. Import order matters: callinstall()before importing the ML libraries so their estimators get intercepted.install(log_level="debug")to trace.# unsupported op (e.g. sparse input) → silent CPU fallbackWhen an algorithm/param isn't GPU-supported, cuml.accel gracefully falls back to CPU — correct results, no error. Enable logging to see what ran where.
import cudf gdf = cudf.read_csv("data.csv") # GPU DataFrame★cuDF is the GPU-DataFrame companion (pandas-like). cuML also accepts cupy arrays, numpy arrays, and pandas — non-GPU inputs are copied to the device.X = gdf[["f1","f2"]]; y = gdf["label"] model.fit(X, y); model.predict(X)★Samefit/predict/transform/fit_transformcontract as scikit-learn.cuml.set_global_output_type("numpy") # or "cudf","cupy","input"★Controls return types. Default output tracks input; set"input"to mirror what you passed, or"numpy"to always get host arrays back.with cuml.using_output_type("cudf"): preds = model.predict(X)Context manager to switch output type for just one block, without changing the global setting.