diff --git a/dockerfiles/Dockerfile.openvino b/dockerfiles/Dockerfile.openvino index 207140d746..01ac9baab2 100644 --- a/dockerfiles/Dockerfile.openvino +++ b/dockerfiles/Dockerfile.openvino @@ -26,10 +26,27 @@ ENV LD_LIBRARY_PATH=${INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/exte ENV LANG en_US.UTF-8 ENV DEBIAN_FRONTEND=noninteractive -RUN apt update && \ - apt -y install apt-transport-https ca-certificates python3 python3-pip zip x11-apps lsb-core wget cpio sudo libboost-python-dev libpng-dev zlib1g-dev git libnuma1 ocl-icd-libopencl1 clinfo libboost-filesystem1.65-dev libboost-thread1.65-dev protobuf-compiler libprotoc-dev autoconf automake libtool libjson-c-dev unattended-upgrades && \ + + +RUN apt update && apt -y install --no-install-recommends apt-transport-https ca-certificates gnupg python3 python3-pip udev unzip zip x11-apps lsb-core wget curl cpio sudo libboost-python-dev libpng-dev zlib1g-dev git libnuma1 ocl-icd-libopencl1 clinfo libboost-filesystem1.65-dev libboost-thread1.65-dev protobuf-compiler libprotoc-dev autoconf automake libtool libjson-c-dev unattended-upgrades && \ unattended-upgrade && \ - rm -rf /var/lib/apt/lists/* && \ + rm -rf /var/lib/apt/lists/* && \ + cd /opt && \ +# libusb1.0.22 + curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \ + unzip v1.0.22.zip && \ + cd /opt/libusb-1.0.22 && \ +# bootstrap steps + ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j4 && \ + cd /opt/libusb-1.0.22/libusb && \ +# configure libusb1.0.22 + /bin/mkdir -p '/usr/local/lib' && \ + /bin/bash ../libtool --mode=install /usr/bin/install -c libusb-1.0.la '/usr/local/lib' && \ + /bin/mkdir -p '/usr/local/include/libusb-1.0' && \ + /usr/bin/install -c -m 644 libusb.h '/usr/local/include/libusb-1.0' && \ + /bin/mkdir -p '/usr/local/lib/pkgconfig' && \ # Install OpenVINO cd ${MY_ROOT} && \ wget https://apt.repos.intel.com/openvino/2021/GPG-PUB-KEY-INTEL-OPENVINO-2021 && \ @@ -39,7 +56,11 @@ RUN apt update && \ apt update && \ apt -y install intel-openvino-dev-ubuntu18-2021.2.200 && \ cd ${INTEL_OPENVINO_DIR}/install_dependencies && ./install_openvino_dependencies.sh && \ - cd ${INTEL_OPENVINO_DIR} && rm -rf documentation data_processing && cd deployment_tools/ && rm -rf model_optimizer tools open_model_zoo demo && cd inference_engine && rm -rf samples && \ + cd ${INTEL_OPENVINO_DIR} && rm -rf documentation data_processing && cd deployment_tools/ && rm -rf model_optimizer tools open_model_zoo demo && cd inference_engine && rm -rf samples && \ + cd /opt/libusb-1.0.22/ && \ + /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + cp /opt/intel/openvino_2021/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ + ldconfig && \ # Install GPU runtime and drivers cd ${MY_ROOT} && \ mkdir /tmp/opencl && \ @@ -65,4 +86,6 @@ RUN apt update && \ cd onnxruntime/cmake/external/onnx && python3 setup.py install && \ cd ${MY_ROOT}/onnxruntime && ./build.sh --config Release --update --build --parallel --use_openvino ${DEVICE} --build_wheel && \ pip install build/Linux/Release/dist/*-linux_x86_64.whl && \ - cd ${MY_ROOT}/ && rm -rf onnxruntime \ No newline at end of file + cd ${MY_ROOT}/ && rm -rf onnxruntime && cd /opt && rm -rf v1.0.22.zip && cd ${MY_ROOT} &&\ + apt remove -y cmake && cd /usr/share/python-wheels/ && rm -rf *.whl &&\ + cd /usr/lib/ && rm -rf python2.7 python3.6 python3.8 && cd && rm -rf .cache diff --git a/dockerfiles/Dockerfile.openvino-csharp b/dockerfiles/Dockerfile.openvino-csharp index 8a3a67fd63..deb8be1b7c 100644 --- a/dockerfiles/Dockerfile.openvino-csharp +++ b/dockerfiles/Dockerfile.openvino-csharp @@ -27,9 +27,25 @@ ENV LANG en_US.UTF-8 ENV DEBIAN_FRONTEND=noninteractive RUN apt update && \ - apt -y install apt-transport-https ca-certificates python3 python3-pip curl zip x11-apps lsb-core wget cpio sudo libboost-python-dev libpng-dev zlib1g-dev git libnuma1 ocl-icd-libopencl1 clinfo libboost-filesystem1.65-dev libboost-thread1.65-dev protobuf-compiler libprotoc-dev autoconf automake libtool libjson-c-dev unattended-upgrades && \ + apt -y install --no-install-recommends apt-transport-https ca-certificates python3 python3-pip gnupg udev zip unzip x11-apps lsb-core wget curl cpio sudo libboost-python-dev libpng-dev zlib1g-dev git libnuma1 ocl-icd-libopencl1 clinfo libboost-filesystem1.65-dev libboost-thread1.65-dev protobuf-compiler libprotoc-dev autoconf automake libtool libjson-c-dev unattended-upgrades && \ unattended-upgrade && \ - rm -rf /var/lib/apt/lists/* && \ + rm -rf /var/lib/apt/lists/* && \ +# libusb from source + cd /opt && \ + curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip && \ + unzip v1.0.22.zip && \ + cd /opt/libusb-1.0.22 && \ +# bootstrap steps + ./bootstrap.sh && \ + ./configure --disable-udev --enable-shared && \ + make -j4 && \ + cd /opt/libusb-1.0.22/libusb && \ +# configure libusb1.0.22 + /bin/mkdir -p '/usr/local/lib' && \ + /bin/bash ../libtool --mode=install /usr/bin/install -c libusb-1.0.la '/usr/local/lib' && \ + /bin/mkdir -p '/usr/local/include/libusb-1.0' && \ + /usr/bin/install -c -m 644 libusb.h '/usr/local/include/libusb-1.0' && \ + /bin/mkdir -p '/usr/local/lib/pkgconfig' && \ # Install OpenVINO cd ${MY_ROOT} && \ wget https://apt.repos.intel.com/openvino/2021/GPG-PUB-KEY-INTEL-OPENVINO-2021 && \ @@ -39,7 +55,13 @@ RUN apt update && \ apt update && \ apt -y install intel-openvino-dev-ubuntu18-2021.2.200 && \ cd ${INTEL_OPENVINO_DIR}/install_dependencies && ./install_openvino_dependencies.sh && \ - cd ${INTEL_OPENVINO_DIR} && rm -rf documentation data_processing && cd deployment_tools/ && rm -rf model_optimizer tools open_model_zoo demo && cd inference_engine && rm -rf samples && \ + cd ${INTEL_OPENVINO_DIR} && rm -rf documentation data_processing && \ + cd deployment_tools/ && rm -rf model_optimizer open_model_zoo demo tools && \ + cd inference_engine && rm -rf samples && \ + cd /opt/libusb-1.0.22/ && \ + /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \ + cp /opt/intel/openvino_2021/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ && \ + ldconfig && \ # Install GPU runtime and drivers cd ${MY_ROOT} && \ mkdir /tmp/opencl && \ @@ -85,6 +107,8 @@ RUN apt update && \ # Clean-up unnecessary files rm -rf ${MY_ROOT}/cmake* /opt/cmake ${MY_ROOT}/onnxruntime && \ rm -rf /opt/miniconda && \ - rm -rf /opt/intel/openvino/data_processing && \ - rm -rf /opt/intel/openvino/deployment_tools/tools && \ - apt remove -y git && apt autoremove -y + rm -rf /opt/v1.0.22.zip && \ + apt remove -y git && apt autoremove -y && apt remove -y cmake && \ + cd /usr/lib/ && rm -rf python2.7 python3.6 python3.8 && cd && rm -rf .cache && \ + cd /usr/share/python-wheels/ && rm -rf *.whl + \ No newline at end of file diff --git a/dockerfiles/README.md b/dockerfiles/README.md index c2e76ec1f6..b74a210129 100644 --- a/dockerfiles/README.md +++ b/dockerfiles/README.md @@ -133,34 +133,34 @@ If the *device_type* runtime config option is not explicitly specified, CPU will 1. Build the docker image from the DockerFile in this repository. ``` - docker build --rm -t onnxruntime-cpu --build-arg DEVICE=CPU_FP32 --network host -f . + docker build --rm -t onnxruntime-cpu --build-arg DEVICE=CPU_FP32 -f . ``` 2. Run the docker image ``` - docker run -it onnxruntime-cpu + docker run -it --rm --device-cgroup-rule='c 189:* rmw' -v /dev/bus/usb:/dev/bus/usb onnxruntime-cpu:latest ``` ### OpenVINO on GPU 1. Build the docker image from the DockerFile in this repository. ``` - docker build --rm -t onnxruntime-gpu --build-arg DEVICE=GPU_FP32 --network host -f . + docker build --rm -t onnxruntime-gpu --build-arg DEVICE=GPU_FP32 -f . ``` 2. Run the docker image ``` - docker run -it --device /dev/dri:/dev/dri onnxruntime-gpu:latest + docker run -it --rm --device-cgroup-rule='c 189:* rmw' -v /dev/bus/usb:/dev/bus/usb onnxruntime-gpu:latest ``` ### OpenVINO on Myriad VPU Accelerator 1. Build the docker image from the DockerFile in this repository. ``` - docker build --rm -t onnxruntime-myriad --build-arg DEVICE=MYRIAD_FP16 --network host -f . + docker build --rm -t onnxruntime-myriad --build-arg DEVICE=MYRIAD_FP16 -f . ``` 2. Install the Myriad rules drivers on the host machine according to the reference in [here](https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_linux.html#additional-NCS-steps) 3. Run the docker image by mounting the device drivers ``` - docker run -it --network host --privileged -v /dev:/dev onnxruntime-myriad:latest + docker run -it --rm --device-cgroup-rule='c 189:* rmw' -v /dev/bus/usb:/dev/bus/usb onnxruntime-myriad:latest ```