## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = FALSE
)

## ----install-gpu--------------------------------------------------------------
# install.packages("cuda.ml")
# library(cuda.ml)
# cuda_ml_install()

## ----install-cpu--------------------------------------------------------------
# library(cuda.ml)
# cuda_ml_install(device = "cpu")

## ----custom-cache-------------------------------------------------------------
# Sys.setenv(CUDA_ML_CACHE_DIR = "/opt/cuda-ml-cache")
# cuda_ml_install()

## ----backend-mirror-----------------------------------------------------------
# Sys.setenv(
#   CUDA_ML_BACKEND_MIRROR = "file:///srv/cuda-ml-backends"
# )
# cuda_ml_install()

## ----backend-info-------------------------------------------------------------
# info <- cuda_ml_backend_info()
# 
# info[c(
#   "backend",
#   "build_mode",
#   "runtime_installed",
#   "runtime_path",
#   "backend_loaded"
# )]
# 
# info[c(
#   "nvforest_cpu_runtime_installed",
#   "nvforest_cpu_runtime_path",
#   "nvforest_cpu_backend_loaded"
# )]

## ----audit--------------------------------------------------------------------
# cuda_ml_runtime_audit()
# 
# # After cuda_ml_install(device = "cpu"):
# cuda_ml_runtime_audit(device = "cpu")

## ----clean-cache--------------------------------------------------------------
# library(cuda.ml)
# cuda_ml_cache_clean()

## ----source-managed-----------------------------------------------------------
# cuda_ml_install(source = TRUE)

## ----source-architectures-----------------------------------------------------
# # Require successful detection from a CUDA-visible GPU.
# cuda_ml_install(source = TRUE, architectures = "native")
# 
# # Build the package's relocatable architecture set.
# cuda_ml_install(source = TRUE, architectures = "portable")
# 
# # Build explicit CMake CUDA targets.
# cuda_ml_install(
#   source = TRUE,
#   architectures = "86-real;89-real"
# )

## ----source-host--------------------------------------------------------------
# Sys.setenv(
#   CUDA_HOME = "/usr/local/cuda-13.2",
#   CUML_PREFIX = "/opt/rapids-26.06",
#   CUML_CUDA_ARCHITECTURES = "86-real",
#   CUDA_ML_CXX = "/usr/bin/g++-14"
# )
# 
# cuda_ml_install(source = TRUE, dependencies = "host")

