Environment:Intel Ipex llm NPU Cpp Environment
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, NPU_Inference |
| Last Updated | 2026-02-09 04:00 GMT |
Overview
C++ build environment for NPU CLI inference, providing native compilation tooling to build and run LLM inference applications directly on the Intel Neural Processing Unit.
Description
This environment provides a C++ build and runtime context for compiling and running LLM inference CLI tools on the Intel NPU. Unlike the Python-based NPU environment, this environment uses CMake and a C++ compiler to build native binaries that interface directly with the Intel NPU driver and runtime. The resulting CLI application supports interactive chat, batch inference, and model benchmarking with minimal overhead. This is suitable for deployment scenarios where Python runtime overhead is undesirable or where integration into C++ applications is required.
Usage
Use this environment for NPU C++ CLI Inference when building native LLM inference applications for the Intel NPU. It is the mandatory prerequisite for compiling and running the IPEX-LLM C++ NPU inference CLI tool.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Windows 11 or Ubuntu 22.04 LTS | Platform-specific build toolchain required |
| Hardware | Intel Meteor Lake or Lunar Lake CPU | Must have integrated NPU (Core Ultra series) |
| NPU Driver | Intel NPU Driver | Latest NPU driver with development headers |
| Build Tools | CMake 3.20+, C++17 compiler | GCC 12+ on Linux, MSVC 2022 on Windows |
Dependencies
System Packages
- Intel NPU Driver (with development headers/libraries)
- CMake >= 3.20
- C++17 compatible compiler (`g++-12` on Linux, MSVC 2022 on Windows)
- `make` or `ninja` build system
Python Packages
- None required (C++ native build)
Credentials
No credentials are required. The following build configuration is needed:
- NPU driver development libraries must be accessible to CMake via standard system paths or `CMAKE_PREFIX_PATH`.
Quick Install
# Install build tools (Ubuntu 22.04)
sudo apt-get update
sudo apt-get install -y cmake g++-12 make
# Install Intel NPU driver and development packages
# Follow Intel documentation for NPU driver installation
# Clone and build the NPU CLI inference tool
git clone https://github.com/intel/ipex-llm.git
cd ipex-llm/python/llm/src/ipex_llm/transformers/npu_models/cpp
# Build with CMake
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
# Run the NPU CLI
./llm_npu_cli --model /path/to/model --prompt "Hello, world"
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `CMake Error: Could not find NPU runtime` | NPU development libraries not installed | Install Intel NPU driver with development headers |
| `C++ compiler does not support C++17` | Compiler too old | Install `g++-12` or later; use MSVC 2022 on Windows |
| `NPU device not found at runtime` | NPU driver not loaded | Verify NPU driver installation and hardware presence |
| `Linker error: undefined reference to NPU symbols` | NPU libraries not in link path | Set `CMAKE_PREFIX_PATH` to NPU driver installation directory |
Compatibility Notes
- Native C++ Only: This environment produces native binaries without Python dependency. For Python-based NPU inference, use the NPU_Environment instead.
- Platform-Specific Build: Build artifacts are platform-specific. Linux builds produce ELF binaries; Windows builds produce PE executables.
- NPU Hardware Required: The built CLI tool requires Intel NPU hardware at runtime. It cannot fall back to CPU or GPU execution.