Skip to content

Commit aa379d5

Browse files
committed
dGPU installation for openvino container (#176)
1 parent b29f324 commit aa379d5

File tree

5 files changed

+238
-1
lines changed

5 files changed

+238
-1
lines changed

gpu/arc/dg2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ During installation, it may ask you to reboot your system. Reboot the system and
3636
3737
## Next Steps
3838
Refer the to available use cases and examples below
39-
1. [Intel® Distribution of OpenVINO™ Toolkit](../../../usecases/openvino/README.md)
39+
1. [Intel® Distribution of OpenVINO™ Toolkit](usecases/openvino/README.md)
4040
2. [Intel® Edge Software Hub](https://www.intel.com/content/www/us/en/developer/topic-technology/edge-5g/edge-solutions/overview.html)
4141
3. [Ollama with Open WebUI on Intel® Discrete GPU](../../../usecases/ollama/README.md)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Intel® Distribution of OpenVINO™ toolkit
2+
3+
## Requirement
4+
### Validated Hardware
5+
- Asrock IEPF-9030S-EY4 + Intel® Arc™ A770 Graphics
6+
7+
## Pre-requisites
8+
- Platform or GPU reference setup script installed. Refer to [README.md](../../README.md)
9+
- Docker version 24 or later installed
10+
11+
## Quick Start
12+
### 1. Go to OpenVINO™ usecase directory
13+
```bash
14+
cd edge-developer-kit-reference-scripts/arc/dg2/usecases/openvino
15+
```
16+
17+
### 2. Run the setup script
18+
This script will create 2 docker images: OpenVINO™ docker image and OpenVINO™ Notebooks docker image.
19+
```bash
20+
./setup.sh
21+
```
22+
During installation, it may ask you to reboot your system. Reboot the system and run `./setup.sh` again. Installation is completed when you see this message:
23+
> ✓ OpenVINO™ use case Installed
24+
25+
When you run command `docker images`, you can see the following example:
26+
```
27+
REPOSITORY TAG IMAGE ID CREATED SIZE
28+
openvino_notebook/ubuntu22_dev latest b6b94b1682b3 22 minutes ago 5.09GB
29+
openvino_dgpu/ubuntu22_dev latest afa9ce506097 44 minutes ago 4.7GB
30+
```
31+
32+
## Run Docker Image
33+
### OpenVINO™ Toolkit
34+
1. Run this command to launch docker container with OpenVINO™ image and link to your working directory. For this instance, the working directory is in /home/user/workspace and it mount to container /data/workspace directory.
35+
```bash
36+
docker run -it -d -u openvino --name openvino_app -v /etc/group:/etc/group --device=/dev/dri --group-add=$(stat -c "%g" /dev/dri/render* | head -n 1) -v /usr/bin:/usr/bin -v /home/user/workspace:/data/workspace -w /data/workspace openvino_dgpu/ubuntu22_dev:latest
37+
```
38+
39+
- --name: container name
40+
- -v: mount from local source directory to container destination directory
41+
- --device: Add device to container
42+
- --group-add: Add additional groups
43+
- -w: The default working directory inside the container
44+
45+
2. Run following command to login into container:
46+
```bash
47+
docker exec -it openvino_app /bin/bash
48+
```
49+
50+
3. Now you can run your application with OpenVINO™
51+
52+
### OpenVINO™ Notebooks
53+
1. Run this command to launch OpenVINO™ Notebooks
54+
```bash
55+
./launch_notebooks.sh
56+
```
57+
2. Copy the URL printed in the terminal and open in a browser. Example output you will see in terminal:
58+
```
59+
To access the server, open this file in a browser:
60+
file:///opt/app-root/src/.local/share/jupyter/runtime/jpserver-20-open.html
61+
Or copy and paste one of these URLs:
62+
http://8adf267b0a6a:8888/lab?token=7d150b3a8d4157f1068c85d582eff346cce28e24cd2e9a85
63+
http://127.0.0.1:8888/lab?token=7d150b3a8d4157f1068c85d582eff346cce28e24cd2e9a85
64+
```
65+
3. Open your browser and paste the URL. You will see openvino_notebooks directory and it has a lot of sample to try out.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
# Copyright (C) 2024 Intel Corporation
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \
7+
sudo tee /etc/apt/sources.list.d/intel-gpu-jammy.list
8+
sudo apt update
9+
10+
sudo apt install -y \
11+
intel-opencl-icd intel-level-zero-gpu level-zero intel-level-zero-gpu-raytracing \
12+
intel-media-va-driver-non-free libmfx1 libmfxgen1 libvpl2 \
13+
libegl-mesa0 libegl1-mesa libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri \
14+
libglapi-mesa libgles2-mesa-dev libglx-mesa0 libigdgmm12 libxatracker2 mesa-va-drivers \
15+
mesa-vdpau-drivers mesa-vulkan-drivers va-driver-all vainfo hwinfo clinfo
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
# Copyright (C) 2024 Intel Corporation
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
CURRENT_DIRECTORY=$(pwd)
7+
echo "${CURRENT_DIRECTORY}"
8+
9+
if docker ps | grep notebooks; then
10+
echo -e "# Remove existing notebook container"
11+
docker stop notebooks
12+
sleep 5 # For removal in progress
13+
if docker ps -a | grep notebooks; then
14+
docker rm notebooks
15+
fi
16+
fi
17+
18+
docker run -t -d --rm --name notebooks \
19+
-v /etc/group:/etc/group --device=/dev/dri:/dev/dri \
20+
--group-add="$(stat -c "%g" /dev/dri/render* | head -n 1)" \
21+
-v "${CURRENT_DIRECTORY}":/mnt \
22+
-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY="$DISPLAY" \
23+
-p 127.0.0.1:8888:8888 \
24+
openvino_notebook/ubuntu22_dev:latest
25+
26+
docker exec notebooks bash -c "cd /mnt/openvino_notebooks/notebooks ; jupyter-lab --allow-root --ip=0.0.0.0 --no-browser --NotebookApp.iopub_data_rate_limit=10000000"
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/bin/bash
2+
3+
# Copyright (C) 2024 Intel Corporation
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
set -e
7+
8+
# symbol
9+
S_VALID=""
10+
11+
# verify current user
12+
if [ "$EUID" -eq 0 ]; then
13+
echo "Must not run with sudo or root user"
14+
exit 1
15+
fi
16+
17+
install_packages(){
18+
local PACKAGES=("$@")
19+
local INSTALL_REQUIRED=0
20+
for PACKAGE in "${PACKAGES[@]}"; do
21+
INSTALLED_VERSION=$(dpkg-query -W -f='${Version}' "$PACKAGE" 2>/dev/null || true)
22+
LATEST_VERSION=$(apt-cache policy "$PACKAGE" | grep Candidate | awk '{print $2}')
23+
24+
if [ -z "$INSTALLED_VERSION" ] || [ "$INSTALLED_VERSION" != "$LATEST_VERSION" ]; then
25+
echo "$PACKAGE is not installed or not the latest version."
26+
INSTALL_REQUIRED=1
27+
fi
28+
done
29+
if [ $INSTALL_REQUIRED -eq 1 ]; then
30+
sudo -E apt update
31+
sudo -E apt install -y "${PACKAGES[@]}"
32+
fi
33+
}
34+
35+
verify_dependencies(){
36+
echo -e "\n# Verifying dependencies"
37+
DEPENDENCIES_PACKAGES=(
38+
python3-pip
39+
python3-venv
40+
)
41+
install_packages "${DEPENDENCIES_PACKAGES[@]}"
42+
echo "$S_VALID Dependencies installed"
43+
}
44+
45+
setup_docker(){
46+
47+
if ! id -nG "$USER" | grep -q -w '\<docker\>'; then
48+
echo -e "\n# Add $USER into docker group"
49+
sudo groupadd docker
50+
sudo usermod -aG docker "$USER"
51+
echo "System reboot is required. Re-run the script after reboot"
52+
exit 0
53+
fi
54+
}
55+
56+
install_openvino_docker(){
57+
58+
echo -e "\n# Install OpenVINO™ Runtime docker image"
59+
if ! docker images | grep openvino/ubuntu22_dev; then
60+
if ! docker images | grep openvino_dgpu/ubuntu22_dev; then
61+
docker pull openvino/ubuntu22_dev:latest
62+
echo "Default OpenVINO™ Runtime docker image installed"
63+
fi
64+
fi
65+
66+
echo -e "\n# Install GPU driver in OpenVINO™ Runtime docker image"
67+
if ! docker images | grep openvino_dgpu/ubuntu22_dev; then
68+
if docker ps | grep openvino_install_gpu; then
69+
docker stop openvino_install_gpu
70+
sleep 5
71+
docker rm openvino_install_gpu
72+
fi
73+
74+
docker run -u root -t -d --rm --name openvino_install_gpu \
75+
-v /usr/share/keyrings/intel-graphics.gpg:/usr/share/keyrings/intel-graphics.gpg \
76+
-v /etc/environment:/etc/environment \
77+
-v /etc/group:/etc/group \
78+
--device=/dev/dri:/dev/dri \
79+
--group-add="$(stat -c "%g" /dev/dri/render* | head -n 1)" \
80+
-v /usr/bin:/usr/bin \
81+
-v "${PWD}":/data/workspace \
82+
-w /data/workspace openvino/ubuntu22_dev:latest
83+
84+
docker exec openvino_install_gpu bash -c "./install_gpu.sh"
85+
86+
echo -e "\n# Create OpenVINO™ Runtime docker image with dGPU drivers"
87+
docker commit openvino_install_gpu openvino_dgpu/ubuntu22_dev:latest
88+
docker stop openvino_install_gpu
89+
sleep 5
90+
docker rmi openvino/ubuntu22_dev
91+
92+
echo "$S_VALID OpenVINO™ Runtime docker image with dGPU driver installed"
93+
else
94+
echo "$S_VALID OpenVINO™ Runtime docker image with dGPU driver already installed"
95+
fi
96+
}
97+
98+
install_openvino_notebook_docker(){
99+
100+
echo -e "\n# Git clone OpenVINO™ notebooks"
101+
if [ ! -d "./openvino_notebooks" ]; then
102+
git clone https://github.com/openvinotoolkit/openvino_notebooks.git
103+
else
104+
echo "./openvino_notebooks already exists"
105+
fi
106+
107+
echo -e "\n# Build OpenVINO™ notebook docker image"
108+
if ! docker images | grep openvino_notebook; then
109+
docker run -u root -t -d --rm --name temp_notebooks \
110+
-v /usr/share/keyrings/intel-graphics.gpg:/usr/share/keyrings/intel-graphics.gpg \
111+
-v "${PWD}":/mnt openvino_dgpu/ubuntu22_dev:latest
112+
docker exec -u root temp_notebooks bash -c "apt update && apt install -y wget ffmpeg"
113+
docker exec -u root temp_notebooks bash -c "cd /mnt/openvino_notebooks; pip install wheel setuptools; pip install -r requirements.txt"
114+
docker commit temp_notebooks openvino_notebook/ubuntu22_dev:latest
115+
docker stop temp_notebooks
116+
else
117+
echo "$S_VALID OpenVINO™ notebook docker image already installed"
118+
fi
119+
}
120+
121+
setup() {
122+
verify_dependencies
123+
setup_docker
124+
install_openvino_docker
125+
install_openvino_notebook_docker
126+
127+
echo -e "\n# Status"
128+
echo "$S_VALID OpenVINO™ use case Installed"
129+
}
130+
131+
setup

0 commit comments

Comments
 (0)