Using Docker with MIVisionX#
Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. Refer to Rocm Docker Wiki for additional information.
Docker workflow on Ubuntu 22.04/24.04#
Prerequisites#
- Ubuntu 22.04/24.04 
- Install ROCm with - --usecase=rocm
Workflow#
- Get the latest docker image. Use the following command to bring in the latest changes from upstream. 
sudo docker pull mivisionx/ubuntu-22.04:latest
- Run docker image 
Run docker image: Local Machine#
sudo docker run -it --privileged --device=/dev/kfd --device=/dev/dri --device=/dev/mem --cap-add=SYS_RAWIO  --group-add video --shm-size=4g --ipc="host" --network=host mivisionx/ubuntu-20.04:latest
- Computer Vision Test 
python3 /workspace/MIVisionX/tests/vision_tests/runVisionTests.py --num_frames 1
- Neural Network Test 
python3 /workspace/MIVisionX/tests/neural_network_tests/runNeuralNetworkTests.py --profiler_level 1
- Khronos OpenVX 1.3.0 Conformance Test 
python3 /workspace/MIVisionX/tests/conformance_tests/runConformanceTests.py --backend_type HOST
Option 1: Map localhost directory on the docker image#
- Option to map the localhost directory with data to be accessed on the docker image: - -v {LOCAL_HOST_DIRECTORY_PATH}:{DOCKER_DIRECTORY_PATH}
sudo docker run -it -v /home/:/root/hostDrive/ --privileged --device=/dev/kfd --device=/dev/dri --device=/dev/mem --cap-add=SYS_RAWIO  --group-add video --shm-size=4g --ipc="host" --network=host mivisionx/ubuntu-20.04:latest
Option 2: Display with docker#
- Using host display for docker 
xhost +local:root
sudo docker run -it --privileged --device=/dev/kfd --device=/dev/dri --cap-add=SYS_RAWIO --device=/dev/mem --group-add video --network host --env DISPLAY=$DISPLAY --volume="$HOME/.Xauthority:/root/.Xauthority:rw" --volume /tmp/.X11-unix/:/tmp/.X11-unix mivisionx/ubuntu-22.04:latest
- Test display with MIVisionX sample 
runvx -v /opt/rocm/share/mivisionx/samples/gdf/canny.gdf
Run docker image with display: Remote Server Machine#
sudo docker run -it --privileged --device=/dev/kfd --device=/dev/dri --cap-add=SYS_RAWIO --device=/dev/mem --group-add video --network host --env DISPLAY=$DISPLAY --volume="$HOME/.Xauthority:/root/.Xauthority:rw" --volume /tmp/.X11-unix/:/tmp/.X11-unix mivisionx/ubuntu-22.04:latest
- Display with MIVisionX sample 
runvx -v /opt/rocm/share/mivisionx/samples/gdf/canny.gdf
Build - dockerfiles#
sudo docker build --build-arg {ARG_1_NAME}={ARG_1_VALUE} [--build-arg {ARG_2_NAME}={ARG_2_VALUE}] -f {DOCKER_FILE_NAME}.dockerfile -t {DOCKER_IMAGE_NAME} .
Run - docker#
sudo docker run -it --privileged --device=/dev/kfd --device=/dev/dri --cap-add=SYS_RAWIO --device=/dev/mem --group-add video --network host --env DISPLAY=$DISPLAY --volume="$HOME/.Xauthority:/root/.Xauthority:rw" --volume /tmp/.X11-unix/:/tmp/.X11-unix {DOCKER_IMAGE_NAME}
Ubuntu 20/22 DockerFiles#
 New component added to the level New component added to the level
 Existing component from the previous level Existing component from the previous level
| Build Level | MIVisionX Dependencies | Modules | Libraries and Executables | Docker File | 
| Level_1 | cmake  | amd_openvx   | 
 | 
 | 
| Level_2 | ROCm OpenCL  | amd_openvx  | 
 | 
 | 
| Level_3 | OpenCV  | amd_openvx  | 
 | 
 | 
| Level_4 | MIOpenGEMM  | amd_openvx  | 
 | 
 | 
| Level_5 | AMD_RPP  | amd_openvx  | 
 | 
 |