R packages that provide CUDA toolkit binaries by downloading pre-built libraries from PyPI at install time. Source packages are lightweight — all CUDA components are fetched during installation.
# Install the remotes package if needed
install.packages("remotes")
# Install a specific CUDA version
remotes::install_github("mlverse/cudatoolkit/cuda12.6")
remotes::install_github("mlverse/cudatoolkit/cuda12.8")
remotes::install_github("mlverse/cudatoolkit/cuda13.2")By default, all components are installed. Set the CUDA_COMPONENTS environment variable to install only what you need:
Sys.setenv(CUDA_COMPONENTS = "runtime,cublas,cudnn")
remotes::install_github("mlverse/cudatoolkit/cuda12.8")You can also override a component's pinned version:
Sys.setenv(CUDA_COMPONENTS = "runtime,cublas,cudnn@9.10.0.56")
remotes::install_github("mlverse/cudatoolkit/cuda12.8")Platform is auto-detected (Linux x86_64, Linux aarch64, Windows). To override:
Sys.setenv(CUDA_PLATFORM = "linux-x64") # or "linux-arm64", "windows-x64"
remotes::install_github("mlverse/cudatoolkit/cuda12.8")library(cuda12.8)
# Path to shared libraries (*.so / *.dll)
lib_path()
# Path to component headers
include_path("cudnn")
# Path to component binaries (e.g., nvcc, ptxas)
bin_path("nvcc")
# Path to a component's installation root
cuda_path("runtime")runtime, cublas, cudnn, cupti, nvrtc, cufft, cusolver, cusparse, nvjitlink, nccl, nvshmem, nvcc
Note: nccl and nvshmem are Linux-only and are skipped on Windows.
- Linux x86_64
- Linux aarch64
- Windows x86_64
macOS is not supported (no CUDA).
The repo uses a shared/ directory for files common to all CUDA versions. Version-specific configuration lives in each cuda*/inst/ directory.
- Edit
cuda*/inst/cuda-version.envwith new toolkit/package versions. - Run
./resolve.shto regenerateinst/components.tsvfrom PyPI. - Run
./sync.shto copy shared files and regenerate DESCRIPTION files. - Commit and push.
- Create a new directory:
mkdir -p cuda{X.Y}/inst - Add
cuda{X.Y}/inst/cuda-version.envwith the version info:CUDA_MINOR="X.Y" CUDA_MAJOR="X" TOOLKIT_VERSION="X.Y.Z" PKG_VERSION="1.0.0" CUDNN_VERSION="..." NCCL_VERSION="..." NVSHMEM_VERSION="..." - Run
./resolve.shand./sync.sh. - Commit and push.
Edit files in shared/ (configure, NAMESPACE, R/paths.R, LICENSE, DESCRIPTION.template), then run ./sync.sh to propagate changes to all packages.