How to build and install a BLAS-enabled llama-cpp-python (GGML_BLAS=ON) on WSL (Ubuntu)?

5 days ago 3
ARTICLE AD BOX

I’m trying to install a BLAS-enabled version of llama-cpp-python on WSL so that the GGML library uses OpenBLAS. I attempted two different pip install invocations with CMAKE_ARGS, but the module imports without any visible BLAS confirmation and I’m not sure whether BLAS actually got enabled.

I have used the particular commands

# Try 1: request OpenBLAS vendor explicitly CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" \ pip install llama-cpp-python --force-reinstall --no-cache-dir # Try 2: request BLAS with parallel build CMAKE_ARGS="-DGGML_BLAS=ON -DCMAKE_BUILD_PARALLEL_LEVEL=2" \ pip install llama-cpp-python --force-reinstall --no-cache-dir # Verify import python3 -c "from llama_cpp import Llama; print('Import successful - llama-cpp-python installed')"

But there’s no message confirming that GGML was built with BLAS/OpenBLAS, and I don’t see any runtime evidence that BLAS is being used. I can’t tell whether the build actually used OpenBLAS or whether it fell back to the scalar implementation.

What I want to know

What are the exact steps to build llama-cpp-python with GGML BLAS enabled on WSL so it actually links against OpenBLAS?

Which packages should I install in the WSL distro (e.g., libopenblas-dev, build-essential, cmake, etc.) before running pip install?

How can I confirm after installation that llama-cpp-python / GGML is using BLAS (i.e., a command or method to verify at runtime or build-time)?

If CMAKE_ARGS is the right approach, what exact CMAKE_ARGS values are required on WSL? Any environment variables or pip flags I should use?

Read Entire Article