|
| 1 | +# Intel NPU device plugin for Kubernetes |
| 2 | + |
| 3 | +Table of Contents |
| 4 | + |
| 5 | +* [Introduction](#introduction) |
| 6 | +* [Modes and Configuration Options](#modes-and-configuration-options) |
| 7 | +* [UMD, KMD and firmware](#umd-kmd-and-firmware) |
| 8 | +* [Pre-built Images](#pre-built-images) |
| 9 | +* [Installation](#installation) |
| 10 | + * [Install with NFD](#install-with-nfd) |
| 11 | + * [Install with Operator](#install-with-operator) |
| 12 | + * [Verify Plugin Registration](#verify-plugin-registration) |
| 13 | +* [Testing and Demos](#testing-and-demos) |
| 14 | + |
| 15 | +## Introduction |
| 16 | + |
| 17 | +Intel NPU plugin facilitates Kubernetes workload offloading by providing access to Intel CPU neural processing units supported by the host kernel. |
| 18 | + |
| 19 | +The following CPU families are currently detected by the plugin: |
| 20 | +* Core Ultra Series 1 (Meteor Lake) |
| 21 | +* Core Ultra Series 2 (Arrow Lake) |
| 22 | +* Core Ultra 200V Series (Lunar Lake) |
| 23 | + |
| 24 | +Intel NPU plugin registers a resource to the Kubernetes cluster: |
| 25 | +| Resource | Description | |
| 26 | +|:---- |:-------- | |
| 27 | +| npu.intel.com/accel | NPU | |
| 28 | + |
| 29 | +## Modes and Configuration Options |
| 30 | + |
| 31 | +| Flag | Argument | Default | Meaning | |
| 32 | +|:---- |:-------- |:------- |:------- | |
| 33 | +| -shared-dev-num | int | 1 | Number of containers that can share the same NPU device | |
| 34 | + |
| 35 | +The plugin also accepts a number of other arguments (common to all plugins) related to logging. |
| 36 | +Please use the -h option to see the complete list of logging related options. |
| 37 | + |
| 38 | +## UMD, KMD, and Firmware |
| 39 | + |
| 40 | +To run workloads on the NPU device, three components are required: |
| 41 | + |
| 42 | +- **UMD (User Mode Driver):** Must be included in the container image. Download it from the [Intel NPU driver](https://github.com/intel/linux-npu-driver/) project. |
| 43 | +- **KMD (Kernel Mode Driver):** Provided by recent Linux distributions (e.g., Ubuntu 24.04) as part of the operating system. |
| 44 | +- **Firmware:** Also included in modern Linux distributions, or available from [linux-firmware](https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/intel/vpu) and [intel-npu-driver](https://github.com/intel/linux-npu-driver/tree/main/firmware/bin). |
| 45 | + |
| 46 | +For a detailed overview, see the Intel NPU driver [documentation](https://github.com/intel/linux-npu-driver/blob/main/docs/overview.md). |
| 47 | + |
| 48 | +An example [demo workload](#testing-and-demos) is provided in this repository. |
| 49 | + |
| 50 | +For reference: |
| 51 | +- The NPU KMD source is in the [Linux kernel](https://github.com/torvalds/linux/tree/master/drivers/accel/ivpu). |
| 52 | +- Firmware sources are in [linux-firmware](https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/intel/vpu) and [intel-npu-driver](https://github.com/intel/linux-npu-driver/tree/main/firmware/bin). |
| 53 | + |
| 54 | +## Pre-built Images |
| 55 | + |
| 56 | +[Pre-built images](https://hub.docker.com/r/intel/intel-npu-plugin) |
| 57 | +are available on the Docker hub. These images are automatically built and uploaded |
| 58 | +to the hub from the latest main branch of this repository. |
| 59 | + |
| 60 | +Release tagged images of the components are also available on the Docker hub, tagged with their |
| 61 | +release version numbers in the format `x.y.z`, corresponding to the branches and releases in this |
| 62 | +repository. |
| 63 | + |
| 64 | +See [the development guide](../../DEVEL.md) for details if you want to deploy a customized version of the plugin. |
| 65 | + |
| 66 | +## Installation |
| 67 | + |
| 68 | +There are multiple ways to install Intel NPU plugin to a cluster. The most common methods are described below. |
| 69 | + |
| 70 | +> **Note**: Replace `<RELEASE_VERSION>` with the desired [release tag](https://github.com/intel/intel-device-plugins-for-kubernetes/tags) or `main` to get `devel` images. |
| 71 | +
|
| 72 | +> **Note**: Add ```--dry-run=client -o yaml``` to the ```kubectl``` commands below to visualize the YAML content being applied. |
| 73 | +
|
| 74 | +### Install with NFD |
| 75 | + |
| 76 | +Deploy NPU plugin with the help of NFD ([Node Feature Discovery](https://github.com/kubernetes-sigs/node-feature-discovery)). It detects the presence of Intel NPUs and labels them accordingly. NPU plugin's node selector is used to deploy plugin to nodes which have such a NPU label. |
| 77 | + |
| 78 | +```bash |
| 79 | +# Start NFD - if your cluster doesn't have NFD installed yet |
| 80 | +$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd?ref=<RELEASE_VERSION>' |
| 81 | + |
| 82 | +# Create NodeFeatureRules for detecting NPUs on nodes |
| 83 | +$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/node-feature-rules?ref=<RELEASE_VERSION>' |
| 84 | + |
| 85 | +# Create NPU plugin daemonset |
| 86 | +$ kubectl apply -k 'https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/npu_plugin/overlays/nfd_labeled_nodes?ref=<RELEASE_VERSION>' |
| 87 | +``` |
| 88 | + |
| 89 | +### Install with Operator |
| 90 | + |
| 91 | +NPU plugin can be installed with the Intel Device Plugin Operator. It allows configuring NPU plugin parameters without kustomizing the deployment files. The general installation is described in the [install documentation](../operator/README.md#installation). |
| 92 | + |
| 93 | +### Verify Plugin Registration |
| 94 | + |
| 95 | +You can verify that the plugin has been installed on the expected nodes by searching for the relevant |
| 96 | +resource allocation status on the nodes: |
| 97 | + |
| 98 | +```bash |
| 99 | +$ kubectl get nodes -o=jsonpath="{range .items[*]}{.metadata.name}{'\n'}{' accel: '}{.status.allocatable.npu\.intel\.com/accel}{'\n'}" |
| 100 | +master |
| 101 | + accel: 1 |
| 102 | +``` |
| 103 | + |
| 104 | +## Testing and Demos |
| 105 | + |
| 106 | +The NPU plugin functionality can be verified by deploying a [npu-plugin-demo](../../demo/intel-npu-demo/) image which runs tests with the Intel NPU. |
| 107 | + |
| 108 | +1. Make the image available to the cluster: |
| 109 | + |
| 110 | + Build image: |
| 111 | + |
| 112 | + ```bash |
| 113 | + $ make intel-npu-demo |
| 114 | + ``` |
| 115 | + |
| 116 | + Tag and push the `intel-npu-demo` image to a repository available in the cluster. Then modify the [intel-npu-workload.yaml's](../../demo/intel-npu-workload.yaml) image location accordingly: |
| 117 | +
|
| 118 | + ```bash |
| 119 | + $ docker tag intel/intel-npu-demo:devel <repository>/intel/intel-npu-demo:latest |
| 120 | + $ docker push <repository>/intel/intel-npu-demo:latest |
| 121 | + $ $EDITOR ${INTEL_DEVICE_PLUGINS_SRC}/demo/intel-npu-workload.yaml |
| 122 | + ``` |
| 123 | +
|
| 124 | + If you are running the demo on a single node cluster, and do not have your own registry, you can add image to node image cache instead. For example, to import docker image to containerd cache: |
| 125 | +
|
| 126 | + ```bash |
| 127 | + $ docker save intel/intel-npu-demo:devel | ctr -n k8s.io images import - |
| 128 | + ``` |
| 129 | + Running `ctr` may require the use of `sudo`. |
| 130 | +
|
| 131 | +1. Create a job: |
| 132 | +
|
| 133 | + ```bash |
| 134 | + $ kubectl apply -f ${INTEL_DEVICE_PLUGINS_SRC}/demo/intel-npu-workload.yaml |
| 135 | + job.batch/npu-workload created |
| 136 | + ``` |
| 137 | +
|
| 138 | +1. Review the job's logs: |
| 139 | + |
| 140 | + ```bash |
| 141 | + $ kubectl get pods | fgrep npu-workload |
| 142 | + # substitute the 'xxxxx' below for the pod name listed above |
| 143 | + $ kubectl logs npu-workload-xxxxx |
| 144 | + <log output> |
| 145 | + ``` |
0 commit comments