Run local LLM inference with llama.cpp on Arm Zena CSS
Introduction
Set up the environment for LLM inference
Build llama.cpp in the Zena CSS guest
Prepare and verify a text model
Run CPU inference and inspect the result
Next Steps
Run local LLM inference with llama.cpp on Arm Zena CSS
Build a pinned llama.cpp version
Build the tested llama.cpp revision in the Zena CSS guest. Keep the source and build output in LP2_WORK_DIR, which you created on the previous page.
Make CMake available
Check whether CMake is already installed:
cmake --version
In the tested Zena guest, the command returned:
sh: cmake: command not found
If CMake isn’t available on your Zena guest, install the Kitware CMake 3.28.6 release for Linux AArch64 in the work directory:
pushd /tmp &&
wget https://github.com/Kitware/CMake/releases/download/v3.28.6/cmake-3.28.6-linux-aarch64.tar.gz &&
mkdir -p /opt /usr/local/bin &&
tar -xzf cmake-3.28.6-linux-aarch64.tar.gz -C /opt &&
ln -s /opt/cmake-3.28.6-linux-aarch64/bin/cmake /usr/local/bin/cmake &&
popd
Confirm that cmake is available:
cmake --version
The Zena download completes with a 53,907,530-byte archive.
If you check the hash and version of CMake, the output is similar to:
7909cc2128ce9442c63ce674a0bfb0e4f4ce04cef667d887e15ad5670d594ba7 cmake-3.28.6-linux-aarch64.tar.gz
cmake version 3.28.6
The SHA-256 value identifies the downloaded file that’s used in this run. It hasn’t been checked against a publisher-supplied checksum. If the download or extraction fails on your guest, keep the error output and stop before the llama.cpp build. Keep this shell open so that the CMake path remains available.
Clone the source
Clone llama.cpp:
git clone https://github.com/ggml-org/llama.cpp.git "$LP2_WORK_DIR/llama.cpp"
cd "$LP2_WORK_DIR/llama.cpp"
# uncomment below to go to specific working commit
# LP2_LLAMA_COMMIT=b86d2f07542b29ab099aed34fd6b6d1b2fd4b81c && git checkout --detach "$LP2_LLAMA_COMMIT"
If your checkout reports another commit, stop before configuring the build.
Configure a CPU build
In the same Zena guest shell, configure the source for a CPU build:
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DGGML_NATIVE=ON \
-DLLAMA_CURL=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DGGML_CPU_KLEIDIAI=ON
This CMake invocation was used for testing. The test output reported GNU 14.2.0 for C and C++. It showed that the CPU backend was included.
The output ended with the following lines:
-- Configuring done (3.3s)
-- Generating done (0.2s)
-- Build files have been written to: /root/zena-llamacpp/llama.cpp/build
Warnings about OpenMP not being found don’t prevent configuration and don’t establish how many threads a later inference run will use. Stop if the configuration reports an error.
Build and identify llama.cpp
After configuration succeeds, compile the CPU binary:
cmake --build build --config Release -j$(nproc)
./build/bin/llama-cli --version
The tested Zena build output reached Built target llama-cli, and the binary returned:
version: 1.1.0-dev (build 12790, commit 436d7e81c)
built with GNU 14.2.0 for Linux aarch6
The full build downloads UI assets from Hugging Face during compilation, so the build requires network access. -j4 limits build jobs but doesn’t set the virtual platform CPU count. If the build fails, save its error output and check the work filesystem before retrying.
What you’ve accomplished and what’s next
You have a source revision and a binary identity to associate with the inference result. Keep LP2_WORK_DIR available in this shell.
Next, you’ll prepare and verify a text model.