openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
7.22k stars 2.25k forks source link

Run with Movidius Support in non-privileged Docker Container #286

Closed r0l1 closed 2 years ago

r0l1 commented 5 years ago

How do I run a non-privileged docker container with one or multiple movidius VPUs? There is only an old article covering the NCSDK.

There are a few concepts to be aware of when using NCS devices in a non-privileged docker container. In this mode the NCAPI libraries within the docker container must be rebuilt with NO_BOOT=yes NO_RESET=yes flags to prevent the API from rebooting/resetting the NCS devices. The provide docker_cmd.sh script takes care of this for you. Also, since the API isn’t booting the devices and loading the firmware this must be done prior to running an application that uses the devices and prior to starting the docker container. There is a seperate program provided that does this called ncs_boot_devices. When starting the docker container the USB device name must be passed to the container with the –device flag. The device name is not static, it changes over time so the docker_cmd.sh script also handles this.

The latest dldt release contains an ENABLE_MYRIAD_NO_BOOT option.

Does anybody have some hints? Thanks!

Kind Regards Roland

brmarkus commented 5 years ago

We use this mechanism (udev and Python script, dynamically maintain the device nodes): https://github.com/th3mis/docker-usb-sync With that we can start non-privileged Docker containers. In the meantime OpenVINO supports multiple instances of VPUs like multiple Myriad-X NeuralComputeSticks.

This might help you as well: https://software.intel.com/en-us/articles/transitioning-from-intel-movidius-neural-compute-sdk-to-openvino-toolkit

r0l1 commented 5 years ago

Thanks @brmarkus ! I'll try this soon and give you feedback.

Edit: works as expected. However I would recommend the no_boot option, because this does not require any modifications of the host system. Does anybody know how to load the firmware of the Myriad manually?