| detect_gpu | R Documentation |
Probes the system for a GPU that Ollama can offload models to. Does not require Ollama itself; the checks are OS-level so users can verify their hardware is set up before pulling any models.
detect_gpu()
Checks in order:
macOS with Apple Silicon (Metal is used automatically).
nvidia-smi returning success – an NVIDIA GPU with a working
CUDA driver.
rocm-smi returning success – an AMD GPU with a working ROCm
driver.
Ollama itself decides how much of a model to offload to the GPU
(based on free VRAM); this function only reports whether the
underlying hardware is available. To verify Ollama is actually
using the GPU during a run, look at ollama ps in a terminal: the
SIZE (GPU) column shows how many bytes are on the GPU.
A list with:
available: logical
kind: one of "apple", "nvidia", "amd", or "none"
detail: a short human-readable string (e.g. the GPU model
name, or the reason detection failed)
info <- detect_gpu()
info$available
info$kind
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.