New Tool Radar

Local AI

How to Check Which GPU Backend a llama.cpp Build Has

Check which GPU backend a llama.cpp build was compiled with before running a model.

Schematic with three steps: Run a model and read the startup; Match the backend to your hardware; Rebuild with the right flag if needed.

A llama.cpp build compiled for the wrong backend still runs, but everything falls back to the CPU and looks slow. The startup log states which backend was compiled in and how many layers were offloaded, so read it before concluding the GPU is slow.

What you need

  • llama.cpp built or installed
  • A GGUF model file
  • Knowledge of your hardware: NVIDIA, AMD, Apple Silicon, or CPU only

Step 1: Run a model and read the startup log

Run llama-cli with a model and read the first lines of the log before the answer starts. The log states the backend compiled in and how many layers were offloaded to the GPU.

Step 2: Match the backend to your hardware

Check the backend against your card: CUDA for NVIDIA, Metal for Apple Silicon, which is on by default on macOS, or Vulkan for cross-vendor GPUs. A CPU-only build on a machine with a GPU means the wrong build flag was used.

Step 3: Rebuild with the right flag if needed

If the backend is wrong, rebuild with the matching flag, for example cmake -B build -DGGML_CUDA=ON for NVIDIA, or -DGGML_VULKAN=ON for Vulkan, and then re-check the log.

Worked example: synthetic backend check

The table below is a synthetic example. It shows the expected result of checking a backend; no build was checked.

Hardware Backend in log Verdict
NVIDIA GPU CUDA Correct
Apple Silicon Mac Metal Correct
NVIDIA GPU CPU only Wrong, rebuild with CUDA
No GPU CPU only Correct

Expected result (UNTESTED). the log shows CUDA on the NVIDIA machine and Metal on the Mac, and a CPU-only log on the NVIDIA machine means the build needs the CUDA flag. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • The log is the authority for your build; a tutorial for a different version may list different flags.
  • A correct backend does not guarantee full offload; a model too large for VRAM still splits layers to the CPU.
  • Run llama-cli –help to see the flags your build actually supports.

Sources

See all