ag_device: Set the default compute device for ag_* operations

View source: R/ag_device.R

ag_deviceR Documentation

Set the default compute device for ag_* operations

Description

Switches all subsequent ag_tensor / ag_param operations to run on the specified device. Calling ag_device("gpu") initialises the best available ggml backend (Vulkan, Metal, CUDA, or CPU fallback) the first time it is called.

Usage

ag_device(device)

Arguments

device

"cpu" (default) or "gpu"

Details

Switching to the CPU moves every ag_buffer on the GPU to the host first; plan for host memory of about twice the buffers' device size (R stores the values as doubles).

Value

Invisibly the previous device string


ggmlR documentation built on Oct. 23, 2026, 1:07 a.m.