Unofficial Julia wrapper for the RAPIDS.ai ecosystem.
The goal of this library is to provide a simple method for accessing the GPU accelerated models withing RAPIDS from Julia, and integrating the models into MLJ. This library relies on PythonCall.jl and CondaPkg.jl for efficient installations of the Python dependencies.
This wrapper could be broken up into several libraries (cuDF, cuML, cuGraph, cuSpatial), but there would be significant overlap between these libraries. Large dependencies such as cudatoolkit would be repeated.
Long term, directly wrapping libcudf, libcuml... would greatly improve this library, but I don't have time to tackle that at this moment.
More information is available here.
- CUDA 11.2+
- NVIDIA driver 470.42.01+
- Pascal architecture or better (Compute Capability >=6.0)
- Ubuntu 20.04/22.04 or CentOS 7 / Rocky Linux 8 with gcc/++ 9.0+
From the Julia General Registry:
julia> ] # enters the pkg interface
pkg> add RAPIDSjulia> using Pkg; Pkg.add("RAPIDS")From source:
julia> ]add https://github.com/tylerjthomas9/RAPIDS.jljulia> using Pkg; Pkg.add(url="https://github.com/tylerjthomas9/RAPIDS.jl")You can access the following python libraries with their standard syntax:
cupycudfcumlcugraphcuspatialcuxfilterdaskdask_cudadask_cudfnumpypickle
Here is an example of using LogisticRegression, make_classification via the Python API.
using RAPIDS
const make_classification = cuml.datasets.classification.make_classification
X_py, y_py = make_classification(n_samples=200, n_features=4,
n_informative=2, n_classes=2)
lr = cuml.LogisticRegression(max_iter=100)
lr.fit(X_py, y_py)
preds = lr.predict(X_py)
print(lr.coef_)A MLJ interface is also available for supported models. The model hyperparameters are the same as described in the cuML docs. The only difference is that the models will always input/output numpy arrays, which will be converted back to Julia arrays (output_type="input").
using MLJBase
using RAPIDS.CuML
const make_classification = cuml.datasets.classification.make_classification
X_py, y_py = make_classification(n_samples=200, n_features=4,
n_informative=2, n_classes=2)
X = RAPIDS.pyconvert(Matrix{Float32}, X_py.get())
y = RAPIDS.pyconvert(Vector{Float32}, y_py.get().flatten())
lr = LogisticRegression(max_iter=100)
mach = machine(lr, X, y)
fit!(mach)
preds = predict(mach, X)
print(mach.fitresult.coef_)MLJ Support:
- Clustering
KMeansDBSCANAgglomerativeClusteringHDBSCAN
- Classification
LogisticRegressionMBSGDClassifierRandomForestClassifierSVCLinearSVCKNeighborsClassifier
- Regression
LinearRegressionRidgeLassoElasticNetMBSGDRegressorRandomForestRegressorCDSVRLinearSVRKNeighborsRegressor
- Dimensionality Reduction
PCAIncrementalPCATruncatedSVDUMAPTSNEGaussianRandomProjection
- Time Series
ExponentialSmoothingARIMA