Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ggml-org/ggml/llms.txt
Use this file to discover all available pages before exploring further.
Install Python dependencies (optional)
Some examples require Python tooling to download model weights. Skip this
step if you only want to build the library.
Working examples
The twosimple examples demonstrate the two main APIs.
- simple-ctx (legacy CPU API)
- simple-backend (modern multi-backend API)
This example allocates a context that owns tensor data, builds a matrix
multiplication graph, and executes it on the CPU.Key points:
simple-ctx.cpp
ggml_init()creates a context that owns tensor memory (no_alloc = false).ggml_new_tensor_2d()allocates a tensor inside the context.ggml_mul_mat()records the operation in the graph — no computation yet.ggml_graph_compute_with_ctx()executes the graph on the CPU.ggml_free()releases the entire context and all its tensors.
