Skip to content

Commit

Permalink
updated openvino version to 2019.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrawins committed May 16, 2019
1 parent 3d8b379 commit 0e0ce34
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 42 deletions.
84 changes: 46 additions & 38 deletions wrappers/s2i/python_openvino/Dockerfile_openvino_base
Original file line number Diff line number Diff line change
@@ -1,52 +1,59 @@
FROM intelpython/intelpython3_core as DEV
RUN apt-get update && apt-get install -y \
curl \
ca-certificates \
libgfortran3 \
vim \
autoconf \
automake \
build-essential \
cmake \
curl \
wget \
libssl-dev \
ca-certificates \
curl \
git \
gstreamer1.0-plugins-base \
libavcodec-dev \
libavformat-dev \
libboost-regex-dev \
gcc-multilib \
g++-multilib \
libgtk2.0-dev \
pkg-config \
unzip \
automake \
libtool \
autoconf \
libpng-dev \
libcairo2-dev \
libpango1.0-dev \
libgfortran3 \
libglib2.0-dev \
libgstreamer1.0-0 \
libgtk2.0-dev \
libopenblas-dev \
libpango1.0-dev \
libpng-dev \
libssl-dev \
libswscale-dev \
libavcodec-dev \
libavformat-dev \
libgstreamer1.0-0 \
gstreamer1.0-plugins-base \
libtool \
libusb-1.0-0-dev \
libopenblas-dev
pkg-config \
unzip \
vim \
wget

ARG DLDT_DIR=/dldt-2018_R5
RUN git clone --depth=1 -b 2018_R5 https://github.com/opencv/dldt.git ${DLDT_DIR} && \
RUN wget https://cmake.org/files/v3.14/cmake-3.14.3.tar.gz && \
tar -xvzf cmake-3.14.3.tar.gz && \
cd cmake-3.14.3/ && \
./configure && \
make -j$(nproc) && \
make install

RUN echo "deb http://ftp.us.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \
echo "deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \
apt update && \
apt-get install -y g++-4.9
ENV CXX=/usr/bin/g++-4.9
RUN pip install cython numpy
ARG DLDT_DIR=/dldt-2019_R1.0.1
RUN git clone --depth=1 -b 2019_R1.0.1 https://github.com/opencv/dldt.git ${DLDT_DIR} && \
cd ${DLDT_DIR} && git submodule init && git submodule update --recursive && \
rm -Rf .git && rm -Rf model-optimizer

WORKDIR ${DLDT_DIR}
RUN curl -L -o ${DLDT_DIR}/mklml_lnx_2019.0.1.20180928.tgz https://github.com/intel/mkl-dnn/releases/download/v0.17.2/mklml_lnx_2019.0.1.20180928.tgz && \
tar -xzf ${DLDT_DIR}/mklml_lnx_2019.0.1.20180928.tgz && rm ${DLDT_DIR}/mklml_lnx_2019.0.1.20180928.tgz
WORKDIR ${DLDT_DIR}/inference-engine
RUN mkdir build && cd build && cmake -DGEMM=MKL -DMKLROOT=${DLDT_DIR}/mklml_lnx_2019.0.1.20180928 -DENABLE_MKL_DNN=ON -DCMAKE_BUILD_TYPE=Release ..
RUN cd build && make -j4
RUN pip install cython numpy && mkdir ie_bridges/python/build && cd ie_bridges/python/build && \
cmake -DInferenceEngine_DIR=${DLDT_DIR}/inference-engine/build -DPYTHON_EXECUTABLE=`which python` -DPYTHON_LIBRARY=/opt/conda/lib/libpython3.6m.so -DPYTHON_INCLUDE_DIR=/opt/conda/include/python3.6m .. && \
make -j4
RUN curl -L https://github.com/intel/mkl-dnn/releases/download/v0.18/mklml_lnx_2019.0.3.20190220.tgz | tar -xz
WORKDIR ${DLDT_DIR}/inference-engine/build
RUN cmake -DGEMM=MKL -DMKLROOT=${DLDT_DIR}/mklml_lnx_2019.0.3.20190220 -DENABLE_MKL_DNN=ON -DTHREADING=OMP -DCMAKE_BUILD_TYPE=Release ..
RUN make -j$(nproc)
WORKDIR ${DLDT_DIR}/inference-engine/ie_bridges/python/build
RUN cmake -DInferenceEngine_DIR=${DLDT_DIR}/inference-engine/build -DPYTHON_EXECUTABLE=$(which python) -DPYTHON_LIBRARY=/opt/conda/lib/libpython3.6m.so -DPYTHON_INCLUDE_DIR=/opt/conda/include/python3.6m ${DLDT_DIR}/inference-engine/ie_bridges/python && \
make -j$(nproc)


FROM intelpython/intelpython3_core as PROD

Expand All @@ -59,9 +66,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python3-setuptools \
vim

COPY --from=DEV /dldt-2018_R5/inference-engine/bin/intel64/Release/lib/*.so /usr/local/lib/
COPY --from=DEV /dldt-2018_R5/inference-engine/ie_bridges/python/bin/intel64/Release/python_api/python3.6/openvino/ /usr/local/lib/openvino/
COPY --from=DEV /dldt-2018_R5/mklml_lnx_2019.0.1.20180928/lib/lib*.so /usr/local/lib/
COPY --from=DEV /dldt-2019_R1.0.1/inference-engine/bin/intel64/Release/lib/*.so /usr/local/lib/
COPY --from=DEV /dldt-2019_R1.0.1/inference-engine/ie_bridges/python/bin/intel64/Release/python_api/python3.6/openvino/ /usr/local/lib/openvino/
COPY --from=DEV /dldt-2019_R1.0.1/mklml_lnx_2019.0.3.20190220/lib/lib*.so /usr/local/lib/
ENV LD_LIBRARY_PATH=/usr/local/lib
ENV PYTHONPATH=/usr/local/lib

Expand All @@ -70,10 +77,11 @@ ENV PATH /opt/conda/envs/myenv/bin:$PATH
RUN conda install -y tensorflow opencv && conda clean -a -y
WORKDIR /microservice

RUN pip install wheel
RUN pip install seldon-core
RUN pip install jaeger-client==3.13.0 seldon-core
RUN pip install --upgrade setuptools

RUN sed -i "s/max_workers=10/max_workers=1/g" /opt/conda/lib/python3.6/site-packages/seldon_core/wrapper.py
# set the workers to 1 - it avoids conflicts in reusing the IE model object in parallel calls
COPY ./s2i/bin/ /s2i/bin

EXPOSE 5000
10 changes: 6 additions & 4 deletions wrappers/s2i/python_openvino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Use s2i tool like documented [here](https://github.com/SeldonIO/seldon-core/blob
An example is presented below:

```bash
s2i build . seldonio/seldon-core-s2i-openvino:0.1 {target_component_image_name}
s2i build . seldonio/seldon-core-s2i-openvino:0.2 {target_component_image_name}
```

## Examples
Expand All @@ -57,11 +57,13 @@ This Seldon base image contains, beside OpenVINO inference execution engine pyth
- Intel optimized TensorFlow with MKL engine
- Configured conda package manager

In case you would use this compoment to run inference operations using TensorFlow with MKL, make sure you configure
also the following environment variables:
OpenVINO and TensorFlow in this docker image, employs [MKL-DNN](https://github.com/intel/mkl-dnn) library
with [OpenMP](https://www.openmp.org/) threading control.
Make sure you configure optimal values for MKL related environment variables in the containers.
Recommendations are listed below:

`KMP_AFFINITY`=granularity=fine,verbose,compact,1,0

`KMP_BLOCKTIME`=1

`OMP_NUM_THREADS`={number of CPU cores}
`OMP_NUM_THREADS`={number of physical CPU cores to allocate}

0 comments on commit 0e0ce34

Please sign in to comment.