Skip to content

Commit a8dfbe7

Browse files
committed
npu: add demo workload
Signed-off-by: Tuomas Katila <[email protected]>
1 parent 88df1c2 commit a8dfbe7

File tree

6 files changed

+102
-3
lines changed

6 files changed

+102
-3
lines changed

.github/workflows/lib-build.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- sgx-sdk-demo
3737
- sgx-aesmd-demo
3838
- dsa-dpdk-dmadevtest
39+
- intel-npu-demo
3940
builder: [buildah, docker]
4041
steps:
4142
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,13 @@ The summary of resources available via plugins in this repository is given in th
242242
* [intelgpu-job.yaml](demo/intelgpu-job.yaml)
243243
* `iaa.intel.com` : `wq-user-[shared or dedicated]`
244244
* [iaa-accel-config-demo-pod.yaml](demo/iaa-accel-config-demo-pod.yaml)
245+
* `npu.intel.com` : `accel`
246+
* [intel-npu-workload.yaml](demo/intel-npu-workload.yaml)
245247
* `qat.intel.com` : `generic` or `cy`/`dc`/`asym-dc`/`sym-dc`
246248
* [compress-perf-dpdk-pod-requesting-qat-dc.yaml](deployments/qat_dpdk_app/compress-perf/compress-perf-dpdk-pod-requesting-qat-dc.yaml)
247249
* [crypto-perf-dpdk-pod-requesting-qat-cy.yaml](deployments/qat_dpdk_app/crypto-perf/crypto-perf-dpdk-pod-requesting-qat-cy.yaml)
248250
* `sgx.intel.com` : `epc`
249251
* [intelsgx-job.yaml](deployments/sgx_enclave_apps/base/intelsgx-job.yaml)
250-
* `npu.intel.com` : `accel`
251-
* TODO
252252

253253
## Developers
254254

cmd/npu_plugin/README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,43 @@ master
103103

104104
## Testing and Demos
105105

106-
TODO
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.
107107

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+
```

demo/intel-npu-demo/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM ubuntu:24.04 AS build
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
RUN apt update && apt install -y build-essential git git-lfs cmake python3 && rm -rf /var/lib/apt/lists/\*
6+
7+
ENV NPU_RELEASE=v1.19.0
8+
ENV NPU_PROJECT=https://github.com/intel/linux-npu-driver/
9+
10+
RUN mkdir /install
11+
12+
RUN git clone -b ${NPU_RELEASE} --recurse-submodules --depth 1 ${NPU_PROJECT} && \
13+
cd linux-npu-driver && \
14+
cmake -DCMAKE_INSTALL_PREFIX=/install/usr -DCMAKE_INSTALL_LIBDIR=lib -B build -S . && \
15+
cmake --build build --parallel $(nproc) && \
16+
cmake --install build
17+
18+
FROM ubuntu:24.04 AS final
19+
20+
COPY --from=build /install /
21+
22+
COPY npu-tests.sh /
23+
24+
ENTRYPOINT [ "/npu-tests.sh" ]

demo/intel-npu-demo/npu-tests.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
echo "Run NPU tests"
4+
5+
npu-kmd-test *:-Device.GroupOwnership || exit 1
6+
7+
# use npu-umd-test -l to list all topics
8+
# note: some of the tests require the NPU compiler & openvino runtime
9+
# https://github.com/intel/linux-npu-driver/blob/main/docs/overview.md#building-a-driver-together-with-the-compiler
10+
topics="Device Driver Event EventSync MemoryAllocation MemoryExecution MemoryAllocationThreaded CommandCopyPerf MultiMemoryExecution MultiContext CommandMemoryFill"
11+
12+
for topic in $topics; do
13+
npu-umd-test -v ${topic}.* || exit 1
14+
done
15+
16+
echo "Tests done"
17+
18+
exit 0

demo/intel-npu-workload.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: npu-workload
5+
spec:
6+
template:
7+
metadata:
8+
labels:
9+
app: example-job
10+
spec:
11+
containers:
12+
- image: intel/intel-npu-demo:devel
13+
name: workload
14+
resources:
15+
limits:
16+
npu.intel.com/accel: 1
17+
restartPolicy: Never
18+
backoffLimit: 4

0 commit comments

Comments
 (0)