llama_supports_gpu: Check whether GPU offloading is available

View source: R/llama.R

llama_supports_gpuR Documentation

Check whether GPU offloading is available

Description

Returns 'TRUE' if at least one GPU backend (e.g. Vulkan) was detected at runtime. Use the result to decide whether to pass 'n_gpu_layers != 0' to [llama_load_model].

Usage

llama_supports_gpu()

Value

A logical scalar: TRUE if at least one GPU backend (e.g. Vulkan) is available, FALSE otherwise.

Examples

if (llama_supports_gpu()) {
  message("GPU available, will use Vulkan backend")
} else {
  message("GPU not available, using CPU only")
}

llamaR documentation built on May 28, 2026, 1:06 a.m.