mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-14 20:48:00 +00:00
### Description We fix iGPU Unit and Python tests with this PR We add packaging pip pkg to build Many Linux DockerFile ### Motivation and Context This change is required to make sure iGPU Unit Test/Python Tests with OV are fixed - If it fixes an open issue, please link to the issue here. --> Co-authored-by: shamaksx <shamax.kshirsagar@intel.com> Co-authored-by: mayavijx <mayax.vijayan@intel.com> Co-authored-by: pratiksha <pratikshax.bapusaheb.vanse@intel.com> Co-authored-by: pratiksha <mohsinx.mohammad@intel.com> Co-authored-by: Sahar Fatima <sfatima.3001@gmail.com> Co-authored-by: Preetha Veeramalai <preetha.veeramalai@intel.com> Co-authored-by: nmaajidk <n.maajid.khan@intel.com> Co-authored-by: Mateusz Tabaka <mateusz.tabaka@intel.com>
84 lines
4.2 KiB
Text
84 lines
4.2 KiB
Text
# Build stage
|
|
FROM registry.access.redhat.com/ubi8/ubi:8.4
|
|
|
|
WORKDIR /code
|
|
|
|
ARG MY_ROOT=/code
|
|
ARG DEVICE=CPU_FP32
|
|
ARG ONNXRUNTIME_REPO=https://github.com/microsoft/onnxruntime
|
|
ARG ONNXRUNTIME_BRANCH=main
|
|
|
|
ENV INTEL_OPENVINO_DIR=/opt/intel/openvino_2022.2.0.7713
|
|
|
|
ENV InferenceEngine_DIR=${INTEL_OPENVINO_DIR}/runtime/cmake
|
|
ENV IE_PLUGINS_PATH=${INTEL_OPENVINO_DIR}/runtime/lib/intel64/
|
|
ENV ngraph_DIR=${INTEL_OPENVINO_DIR}/runtime/cmake
|
|
ENV LD_LIBRARY_PATH=${INTEL_OPENVINO_DIR}/runtime/3rdparty/tbb/lib/:${IE_PLUGINS_PATH}:${LD_LIBRARY_PATH}
|
|
ENV OpenCV_DIR=${INTEL_OPENVINO_DIR}/extras/opencv/cmake
|
|
ENV LD_LIBRARY_PATH=${INTEL_OPENVINO_DIR}/extras/opencv/lib:${LD_LIBRARY_PATH}
|
|
ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/lib64:/usr/lib64:/lib64:${LD_LIBRARY_PATH}
|
|
|
|
# Install packages
|
|
RUN yum install -y yum-utils autoconf automake libtool unzip udev wget zlib-devel libffi-devel openssl-devel git make gcc && \
|
|
yum clean packages && yum clean all && rm -rf /var/cache/yum && \
|
|
# Install python 3.8
|
|
cd $MY_ROOT && \
|
|
wget https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tgz && tar xvf Python-3.8.9.tgz && rm -rf Python-3.8.9.tgz && \
|
|
cd Python-3.8*/ && ./configure && make && make install && \
|
|
cd ../ && mkdir -p /usr/bin/Python38 && ln -s Python-3.8.9/ /usr/bin/Python38 && \
|
|
# libusb1.0.22
|
|
cd /opt/ && wget https://github.com/libusb/libusb/archive/v1.0.22.zip && \
|
|
unzip v1.0.22.zip && rm -rf v1.0.22.zip && cd /opt/libusb-1.0.22 && \
|
|
# bootstrap steps
|
|
./bootstrap.sh && \
|
|
./configure --disable-udev --enable-shared && \
|
|
make -j4 && \
|
|
# configure libusb1.0.22
|
|
cd /opt/libusb-1.0.22/libusb && \
|
|
/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 /opt/ && mkdir intel/ && cd intel && \
|
|
wget https://storage.openvinotoolkit.org/repositories/openvino/packages/2022.2/linux/l_openvino_toolkit_rhel8_2022.2.0.7713.af16ea1d79a_x86_64.tgz && \
|
|
tar xvf l_openvino_toolkit_rhel8_2022.2.0.7713.af16ea1d79a_x86_64.tgz && \
|
|
rm -rf l_openvino_toolkit_rhel8_2022.2.0.7713.af16ea1d79a_x86_64.tgz && \
|
|
mv l_openvino_toolkit_rhel8_2022.2.0.7713.af16ea1d79a_x86_64 openvino_2022.2.0.7713 && \
|
|
cd ${INTEL_OPENVINO_DIR}/install_dependencies/ && ./install_openvino_dependencies.sh -y && ./install_NEO_OCL_driver.sh -y && \
|
|
printf "\nexport LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/usr/local/lib\n" >> /opt/intel/openvino_2022.2.0.7713/setupvars.sh && \
|
|
cd /opt/libusb-1.0.22 && \
|
|
/usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \
|
|
cp /opt/intel/openvino_2022.2.0.7713/install_dependencies/97-myriad-usbboot.rules /etc/udev/rules.d/ && \
|
|
ldconfig && \
|
|
#Install protobuf
|
|
cd $MY_ROOT && \
|
|
git clone https://github.com/protocolbuffers/protobuf.git && \
|
|
cd protobuf && \
|
|
git checkout v3.16.0 && \
|
|
git submodule update --init --recursive && \
|
|
mkdir build_source && cd build_source && \
|
|
cmake ../cmake -DCMAKE_INSTALL_LIBDIR=lib64 -Dprotobuf_BUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release && \
|
|
make -j$(nproc) && \
|
|
make install && \
|
|
# Build onnxruntime
|
|
cd $MY_ROOT && \
|
|
pip3 install numpy wheel setuptools cython && \
|
|
git clone --recursive -b ${ONNXRUNTIME_BRANCH} ${ONNXRUNTIME_REPO} && \
|
|
pip3 install onnx && \
|
|
source /opt/intel/openvino_2022.2.0.7713/setupvars.sh && \
|
|
cd /code/onnxruntime && ./build.sh --config Release --update --build --parallel --use_openvino ${DEVICE} --build_shared_lib --build_wheel && \
|
|
pip3 install /code/onnxruntime/build/Linux/Release/dist/*-linux_x86_64.whl && \
|
|
# Clean up
|
|
cd ${MY_ROOT} && rm -rf onnxruntime && rm -rf Python-3.8.9 && rm -rf protobuf
|
|
|
|
# Deploy stage
|
|
ARG BUILD_UID=1001
|
|
ARG BUILD_USER=onnxruntimedev
|
|
RUN adduser --uid $BUILD_UID $BUILD_USER
|
|
RUN usermod -a -G video,users,render ${BUILD_USER}
|
|
ENV WORKDIR_PATH /home/${BUILD_USER}
|
|
|
|
WORKDIR ${WORKDIR_PATH}
|
|
USER ${BUILD_USER}
|