Add support for OpenVINO 2021.3
1.Replace the original TBB with OneTBB v2020.3 2.Replace the 2019_R3 with DLDT 2021.3 3.Add some dependent lib to the occlum image
This commit is contained in:
parent
04c3f485dc
commit
a889dc9c38
@ -28,36 +28,29 @@ build_opencv() {
|
|||||||
-DBUILD_opencv_python=OFF -DBUILD_PYTHON_SUPPORT=OFF \
|
-DBUILD_opencv_python=OFF -DBUILD_PYTHON_SUPPORT=OFF \
|
||||||
-DBUILD_EXAMPLES=OFF -DWITH_FFMPEG=OFF \
|
-DBUILD_EXAMPLES=OFF -DWITH_FFMPEG=OFF \
|
||||||
-DWITH_QT=OFF -DWITH_CUDA=OFF
|
-DWITH_QT=OFF -DWITH_CUDA=OFF
|
||||||
make -j4
|
make -j
|
||||||
sudo make install
|
sudo make install
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Build oneTBB, OpenVINO_2021 need version 2020.3
|
||||||
build_tbb() {
|
build_tbb() {
|
||||||
rm -rf deps/tbb_cmake && mkdir -p deps/tbb_cmake
|
rm -rf deps/tbb_cmake && mkdir -p deps/tbb_cmake
|
||||||
pushd deps/tbb_cmake
|
pushd deps/tbb_cmake
|
||||||
git clone https://github.com/wjakob/tbb .
|
git clone https://github.com/oneapi-src/oneTBB.git .
|
||||||
git checkout 344fa84f34089681732a54f5def93a30a3056ab9
|
git checkout v2020.3
|
||||||
mkdir cmake_build && cd cmake_build
|
CXX=occlum-g++ CC=occlum-gcc make tbb -j4
|
||||||
cmake ../ \
|
find build/ -name libtbb* -exec cp {} $PREFIX/lib/ \;
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DCMAKE_CXX_COMPILER=occlum-g++ -DCMAKE_C_COMPILER=occlum-gcc \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
|
||||||
-DTBB_BUILD_TESTS=OFF \
|
|
||||||
-DTBB_BUILD_TBBMALLOC_PROXY=OFF
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Build OpenVINO
|
# Build OpenVINO
|
||||||
build_openvino() {
|
build_openvino() {
|
||||||
rm -rf openvino_src && mkdir openvino_src
|
rm -rf openvino_src && mkdir openvino_src
|
||||||
pushd openvino_src
|
pushd openvino_src
|
||||||
git clone https://github.com/opencv/dldt .
|
git clone https://github.com/opencv/dldt .
|
||||||
git checkout tags/2019_R3 -b 2019_R3
|
git checkout 2021.3
|
||||||
git apply ../0001-Fix-passing-pre-increment-parameter-cpu-to-CPU_ISSET.patch
|
|
||||||
cd inference-engine
|
|
||||||
git submodule init
|
git submodule init
|
||||||
git submodule update --recursive
|
git submodule update --recursive
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
@ -68,8 +61,8 @@ build_openvino() {
|
|||||||
-DENABLE_CLDNN=OFF \
|
-DENABLE_CLDNN=OFF \
|
||||||
-DENABLE_MYRIAD=OFF \
|
-DENABLE_MYRIAD=OFF \
|
||||||
-DENABLE_GNA=OFF
|
-DENABLE_GNA=OFF
|
||||||
[ "$THREADING" == "OMP" ] && rm -rf ../temp/omp/lib/* && cp $PREFIX/lib/libgomp.so ../temp/omp/lib/libiomp5.so
|
[ "$THREADING" == "OMP" ] && rm -rf ../inference-engine/temp/omp/lib/* && cp $PREFIX/lib/libgomp.so ../inference-engine/temp/omp/lib/libiomp5.so
|
||||||
[ "$THREADING" == "TBB" ] && rm -rf ../temp/tbb/lib/* && cp $PREFIX/lib/libtbb.so ../temp/tbb/lib && cp $PREFIX/lib/libtbbmalloc.so ../temp/tbb/lib
|
[ "$THREADING" == "TBB" ] && rm -rf ../inference-engine/temp/tbb/lib/* && cp $PREFIX/lib/libtbb.so.2 ../inference-engine/temp/tbb/lib
|
||||||
cd ../
|
cd ../
|
||||||
rm -rf build && mkdir build && cd build
|
rm -rf build && mkdir build && cd build
|
||||||
# Substitute OpenCV
|
# Substitute OpenCV
|
||||||
@ -84,7 +77,8 @@ build_openvino() {
|
|||||||
-DENABLE_CLDNN=OFF \
|
-DENABLE_CLDNN=OFF \
|
||||||
-DENABLE_OPENCV=OFF \
|
-DENABLE_OPENCV=OFF \
|
||||||
-DENABLE_MYRIAD=OFF \
|
-DENABLE_MYRIAD=OFF \
|
||||||
-DENABLE_GNA=OFF
|
-DENABLE_GNA=OFF \
|
||||||
|
-DENABLE_VPU=OFF
|
||||||
make -j4
|
make -j4
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
benchmark=benchmark_app
|
benchmark=benchmark_app
|
||||||
inference_bin=openvino_src/inference-engine/bin/intel64/Release
|
inference_bin=openvino_src/bin/intel64/Release
|
||||||
occlum_lib=/usr/local/occlum/x86_64-linux-musl/lib
|
occlum_lib=/usr/local/occlum/x86_64-linux-musl/lib
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@ -9,6 +9,15 @@ rm -rf occlum_instance
|
|||||||
mkdir occlum_instance
|
mkdir occlum_instance
|
||||||
cd occlum_instance
|
cd occlum_instance
|
||||||
occlum init
|
occlum init
|
||||||
|
cpu_cc=`cat /proc/cpuinfo | grep processor | wc -l`
|
||||||
|
#new_json="$(jq '.resource_limits.user_space_size = "4GB" |
|
||||||
|
# .resource_limits.kernel_space_heap_size = "128MB" |
|
||||||
|
# .resource_limits.kernel_space_stack_size = "16MB" |
|
||||||
|
# .resource_limits.max_num_of_threads = 128 |
|
||||||
|
# .process.default_mmap_size = "1024MB" |
|
||||||
|
# .process.default_stack_size = "8MB" |
|
||||||
|
# .process.default_heap_size = "32MB" |
|
||||||
|
# .metadata.debuggable = false ' Occlum.json)" && \
|
||||||
new_json="$(jq '.resource_limits.user_space_size = "320MB" |
|
new_json="$(jq '.resource_limits.user_space_size = "320MB" |
|
||||||
.process.default_mmap_size = "256MB"' Occlum.json)" && \
|
.process.default_mmap_size = "256MB"' Occlum.json)" && \
|
||||||
echo "${new_json}" > Occlum.json
|
echo "${new_json}" > Occlum.json
|
||||||
@ -16,18 +25,23 @@ echo "${new_json}" > Occlum.json
|
|||||||
# 2. Copy files into Occlum Workspace and Build
|
# 2. Copy files into Occlum Workspace and Build
|
||||||
cp ../$inference_bin/$benchmark image/bin
|
cp ../$inference_bin/$benchmark image/bin
|
||||||
cp ../$inference_bin/lib/libinference_engine.so image/lib
|
cp ../$inference_bin/lib/libinference_engine.so image/lib
|
||||||
|
cp ../$inference_bin/lib/libinference_engine_c_api.so image/lib
|
||||||
cp ../$inference_bin/lib/libformat_reader.so image/lib
|
cp ../$inference_bin/lib/libformat_reader.so image/lib
|
||||||
cp ../$inference_bin/lib/libcpu_extension.so image/lib
|
cp ../$inference_bin/lib/libinference_engine_transformations.so image/lib
|
||||||
cp ../$inference_bin/lib/libHeteroPlugin.so image/lib
|
cp ../$inference_bin/lib/libngraph.so image/lib
|
||||||
|
cp ../$inference_bin/lib/libinference_engine_ir_v7_reader.so image/lib
|
||||||
|
cp ../$inference_bin/lib/libinference_engine_ir_reader.so image/lib
|
||||||
cp ../$inference_bin/lib/libMKLDNNPlugin.so image/lib
|
cp ../$inference_bin/lib/libMKLDNNPlugin.so image/lib
|
||||||
|
cp ../$inference_bin/lib/libinference_engine_legacy.so image/lib
|
||||||
|
cp ../$inference_bin/lib/libinference_engine_lp_transformations.so image/lib
|
||||||
cp ../$inference_bin/lib/plugins.xml image/lib
|
cp ../$inference_bin/lib/plugins.xml image/lib
|
||||||
cp $occlum_lib/libopencv_imgcodecs.so.4.1 image/lib
|
cp $occlum_lib/libopencv_imgcodecs.so.4.1 image/lib
|
||||||
cp $occlum_lib/libopencv_imgproc.so.4.1 image/lib
|
cp $occlum_lib/libopencv_imgproc.so.4.1 image/lib
|
||||||
cp $occlum_lib/libopencv_core.so.4.1 image/lib
|
cp $occlum_lib/libopencv_core.so.4.1 image/lib
|
||||||
cp $occlum_lib/libopencv_videoio.so.4.1 image/lib
|
cp $occlum_lib/libopencv_videoio.so.4.1 image/lib
|
||||||
cp $occlum_lib/libz.so.1 image/lib
|
cp $occlum_lib/libz.so.1 image/lib
|
||||||
[ -e $occlum_lib/libtbb.so ] && cp $occlum_lib/libtbb.so image/lib
|
[ -e $occlum_lib/libtbb.so.2 ] && cp $occlum_lib/libtbb.so.2 image/lib
|
||||||
[ -e $occlum_lib/libtbbmalloc.so ] && cp $occlum_lib/libtbbmalloc.so image/lib
|
[ -e $occlum_lib/libtbbmalloc.so.2 ] && cp $occlum_lib/libtbbmalloc.so.2 image/lib
|
||||||
mkdir image/model
|
mkdir image/model
|
||||||
cp -r ../model/* image/model
|
cp -r ../model/* image/model
|
||||||
occlum build
|
occlum build
|
||||||
|
Loading…
Reference in New Issue
Block a user