Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update openvino example #234

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions Examples/openvino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ For additional information on supported models, how to install, run and optimize
OpenVINO, please see
https://github.com/gramineproject/examples/blob/master/openvino/README.md.

Currently tested distro is Ubuntu 20.04.
Currently tested distro is Ubuntu 24.04.

## Building graminized Docker image

1. Build Docker image:
```bash
docker build --tag ubuntu20.04-openvino --file ubuntu20.04-openvino.dockerfile .
docker build --tag ubuntu24.04-openvino --file ubuntu24.04-openvino.dockerfile .
```

2. Graminize the Docker image using `gsc build`:
```bash
cd ../..
./gsc build --insecure-args ubuntu20.04-openvino \
Examples/openvino/ubuntu20.04-openvino.manifest
./gsc build --insecure-args ubuntu24.04-openvino \
Examples/openvino/ubuntu24.04-openvino.manifest
```

3. Sign the graminized Docker image using `gsc sign-image`:
```bash
./gsc sign-image ubuntu20.04-openvino enclave-key.pem
./gsc sign-image ubuntu24.04-openvino enclave-key.pem
```

## Running the benchmark in GSC
Expand All @@ -31,44 +31,43 @@ cd ../..

- For benchmarking:
```bash
$ docker run --cpuset-cpus="0-35,72-107" --cpuset-mems=0 \
docker run --cpuset-cpus="0-35,72-107" --cpuset-mems=0 \
--device /dev/sgx_enclave \
gsc-ubuntu20.04-openvino -i <image files> \
-m model/<public | intel>/<model_dir>/<INT8 | FP16 | FP32>/<model_xml_file> \
-d CPU -b 1 -t 20 -nstreams 72 -nthreads 72 -nireq 72
gsc-ubuntu24.04-openvino -i <image files> \
-m /model/<public | intel>/<model_dir>/<INT8 | FP16 | FP32>/<model_xml_file> \
-d CPU -b 1 -t 20 -nstreams 72 -nthreads 72 -nireq 72 -hint none
```

- For a quick test:
```bash
$ docker run --rm --device /dev/sgx_enclave gsc-ubuntu20.04-openvino \
-m model/public/resnet-50-tf/FP16/resnet-50-tf.xml \
-d CPU -b 1 -t 20 -nstreams 2 -nthreads 2 -nireq 2
docker run --rm --device /dev/sgx_enclave gsc-ubuntu24.04-openvino \
-m /model/public/resnet-50-tf/FP16/resnet-50-tf.xml \
-d CPU -b 1 -t 20 -nstreams 2 -nthreads 2 -nireq 2 -hint none
```

### Latency runs

- For benchmarking:
```bash
$ docker run --cpuset-cpus="0-35,72-107" --cpuset-mems="0" \
docker run --cpuset-cpus="0-35,72-107" --cpuset-mems="0" \
--device /dev/sgx_enclave \
gsc-ubuntu20.04-openvino -i <image files> \
-m model/<public | intel>/<model_dir>/<INT8 | FP16 | FP32>/<model_xml_file> \
-d CPU -b 1 -t 20 -api sync
gsc-ubuntu24.04-openvino -i <image files> \
-m /model/<public | intel>/<model_dir>/<INT8 | FP16 | FP32>/<model_xml_file> \
-d CPU -b 1 -t 20 -api sync -hint none
```

- For a quick test:
```bash
$ docker run --rm --device /dev/sgx_enclave gsc-ubuntu20.04-openvino \
-m model/public/resnet-50-tf/FP16/resnet-50-tf.xml \
-d CPU -b 1 -t 20 -api sync
docker run --rm --device /dev/sgx_enclave gsc-ubuntu24.04-openvino \
-m /model/public/resnet-50-tf/FP16/resnet-50-tf.xml \
-d CPU -b 1 -t 20 -api sync -hint none
```

## Running the benchmark natively

To run the benchmark in a native Docker container (outside Gramine), run the
above commands with the following modifications:
To run the benchmark in a native Docker container (outside Gramine), run the above commands with the following modifications:
- remove `--device=/dev/sgx_enclave`,
- replace `gsc-ubuntu20.04-openvino` with `ubuntu20.04-openvino`.
- replace `gsc-ubuntu24.04-openvino` with `ubuntu24.04-openvino`.

## Notes

Expand Down
54 changes: 0 additions & 54 deletions Examples/openvino/ubuntu20.04-openvino.dockerfile

This file was deleted.

12 changes: 12 additions & 0 deletions Examples/openvino/ubuntu24.04-openvino.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM openvino/ubuntu24_dev:2024.6.0

USER root

ENV MODELS="resnet-50-tf bert-large-uncased-whole-word-masking-squad-0001 ssd_mobilenet_v1_coco"

RUN for model_name in $MODELS; do \
omz_downloader --name $model_name -o /model && \
omz_converter --name $model_name -d /model -o /model; \
done

ENTRYPOINT ["/opt/intel/openvino/samples/cpp/samples_bin/samples_bin/benchmark_app"]