Skip to content

Commit

Permalink
Merge pull request #1889 from openvinotoolkit/develop
Browse files Browse the repository at this point in the history
Release OVMS 2023.0
  • Loading branch information
rasapala committed Jun 1, 2023
2 parents fa5fe4c + 305c2bf commit 301b794
Show file tree
Hide file tree
Showing 349 changed files with 16,400 additions and 3,039 deletions.
13 changes: 13 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ build --spawn_strategy=standalone
build --genrule_strategy=standalone

build --define=grpc_no_ares=true
build --define=MEDIAPIPE_DISABLE_GPU=1
coverage --define=MEDIAPIPE_DISABLE_GPU=1
test --define=MEDIAPIPE_DISABLE_GPU=1

build --define=MEDIAPIPE_DISABLE=0
coverage --define=MEDIAPIPE_DISABLE=0
test --define=MEDIAPIPE_DISABLE=0

# Sets the default Apple platform to macOS.
build --apple_platform_type=macos
Expand All @@ -65,6 +72,10 @@ build --cxxopt=-fno-strict-overflow
build --cxxopt=-fno-delete-null-pointer-checks
build --cxxopt=-fwrapv
build --cxxopt=-fstack-protector
build --cxxopt=-fstack-clash-protection
build --cxxopt=-Wformat
build --cxxopt=-Wformat-security
build --cxxopt=-Werror=format-security

# Adding "--cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0" creates parity with TF
# compilation options. It also addresses memory use due to
Expand All @@ -75,3 +86,5 @@ build --experimental_repo_remote_exec
build --force_pic
build --experimental_cc_shared_library

build --check_visibility=true

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ lib/
!client/python/ovmsclient/lib
cppclean_src
cppclean_test
tags
78 changes: 78 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#
# Copyright (c) 2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

licenses(["notice"])

exports_files([
"package.json",
"yarn.lock",
])

load("@bazel_skylib//lib:selects.bzl", "selects")
load("@mediapipe//mediapipe/framework:more_selects.bzl", "more_selects")

config_setting(
name = "disable_mediapipe",
define_values = {
"MEDIAPIPE_DISABLE": "1",
},
visibility = ["//visibility:public"],
)

more_selects.config_setting_negation(
name = "not_disable_mediapipe",
negate = ":disable_mediapipe",
)

cc_library(
name = "ovms_dependencies",
deps = [
"@tensorflow_serving//tensorflow_serving/apis:prediction_service_cc_proto",
"@tensorflow_serving//tensorflow_serving/apis:model_service_cc_proto",
"@minitrace//:trace",
"@com_github_grpc_grpc//:grpc++",
"@org_tensorflow//tensorflow/core:framework",
"@com_github_tencent_rapidjson//:rapidjson",
"@com_github_gabime_spdlog//:spdlog",
"@com_github_jarro2783_cxxopts//:cxxopts",
"@awssdk//:s3",
"@awssdk//:core",
"@awssdk//:deps",
"@azure//:storage",
"@cpprest//:sdk",
"@boost//:lib",
"@com_github_googleapis_google_cloud_cpp//google/cloud/storage:storage_client",
"@tensorflow_serving//tensorflow_serving/util/net_http/server/public:http_server",
"@tensorflow_serving//tensorflow_serving/util/net_http/server/public:http_server_api",
"@tensorflow_serving//tensorflow_serving/util:threadpool_executor",
"@tensorflow_serving//tensorflow_serving/util:json_tensor",
"@linux_openvino//:openvino",
"@linux_opencv//:opencv",
"@com_github_jupp0r_prometheus_cpp//core",
"@oneTBB//:tbb",
] + select({
"//conditions:default": [
"@mediapipe//mediapipe/framework:calculator_framework",
"@mediapipe//mediapipe/framework/port:logging",
"@mediapipe//mediapipe/framework/port:parse_text_proto",
"@mediapipe//mediapipe/framework/port:status",
"@mediapipe_calculators//:mediapipe_calculators",
"@model_api//:adapter_api",
],
"//:disable_mediapipe" : [],
}),
visibility = ["//visibility:public"],
)
145 changes: 125 additions & 20 deletions Dockerfile.redhat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020-2021 Intel Corporation
# Copyright (c) 2020-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -22,6 +22,9 @@ LABEL version="1.0.0"
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]

ARG JOBS
COPY entitlement /etc/pki/entitlement
COPY rhsm-ca /etc/rhsm/ca
RUN rm -f /etc/rhsm-host

RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && dnf clean all && yum update -d6 -y && yum install -d6 -y \
boost169-atomic \
Expand Down Expand Up @@ -127,19 +130,73 @@ RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.n
unzip \
vim \
xz \
https://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/tbb-2018.2-9.el8.x86_64.rpm && \
https://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/tbb-2018.2-9.el8.x86_64.rpm \
http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/libusb-devel-0.1.5-12.el8.x86_64.rpm \
http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/libusb-0.1.5-12.el8.x86_64.rpm \
http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/libusbx-devel-1.0.23-4.el8.x86_64.rpm && \
yum clean all

ARG NVIDIA=0
# Add Nvidia dev tool if needed
# hadolint ignore=DL3003
RUN if [ "$NVIDIA" == "1" ] ; then true ; else exit 0 ; fi ; \
yum config-manager --save --set-enabled codeready-builder-for-rhel-8-x86_64-rpms && \
yum -y module disable python36 && \
yum install -y \
libzstd-devel \
libcudnn8-8.6.0.163-1.cuda11.8 \
libcudnn8-devel-8.6.0.163-1.cuda11.8 \
libcutensor1-1.6.1.5-1 \
libcutensor-devel-1.6.1.5-1 \
cuda-cudart-devel-11-8 && \
# ignore errors on hosts with older nvidia drivers
yum install -y cuda-11-8 || true && \
yum install -y python38-Cython && \
curl -L https://github.com/Kitware/ninja/releases/download/v1.10.0.gfb670.kitware.jobserver-1/ninja-1.10.0.gfb670.kitware.jobserver-1_x86_64-linux-gnu.tar.gz | tar xzv --strip-components=1 -C /usr/local/bin && \
curl https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz -L | tar xvzC /usr/local/bin --strip-components=1 --wildcards '*/sccache' && \
chmod a+x /usr/local/bin/sccache && \
curl https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-x86_64.tar.gz -L | tar xzvC /usr/local --exclude={doc,man} --strip-components=1 && \
curl -L https://github.com/ccache/ccache/releases/download/v4.3/ccache-4.3.tar.xz | tar xJv && \
mkdir -p ccache-4.3/build && cd ccache-4.3/build && \
cmake -DCMAKE_BUILD_TYPE=Release -G Ninja .. && \
ninja -v install && \
rm -rf /var/cache/yum

# build_type=[ opt, dbg ]
ARG build_type=dbg
ARG debug_bazel_flags=--strip=never\ --copt="-g"\ -c\ dbg
ARG minitrace_flags
ENV TF_SYSTEM_LIBS="curl"
ENV TEST_LOG="/root/.cache/bazel/_bazel_root/bc57d4817a53cab8c785464da57d1983/execroot/ovms/bazel-out/test.log"

ARG ov_source_branch=master
ARG ov_contrib_branch=master
ARG sentencepiece=0
ARG ov_source_org=openvinotoolkit
ARG ov_contrib_org=openvinotoolkit
ARG ov_use_binary=1
ARG DLDT_PACKAGE_URL
ARG TEMP_DIR=/tmp/openvino_installer
ARG CMAKE_BUILD_TYPE=Release

# hadolint ignore=DL3003
RUN if [[ "$sentencepiece" == "1" || "$NVIDIA" == "1" ]] ; then true ; else exit 0 ; fi ; git clone https://github.com/$ov_contrib_org/openvino_contrib.git /openvino_contrib && cd /openvino_contrib && git checkout $ov_contrib_branch && git submodule update --init --recursive

################### BUILD OPENVINO FROM SOURCE - buildarg ov_use_binary=0 ############################
# Build OpenVINO and nGraph (OV dependency) with D_GLIBCXX_USE_CXX11_ABI=0 or 1
# hadolint ignore=DL3003
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; git clone https://github.com/$ov_source_org/openvino.git /openvino && cd /openvino && git checkout $ov_source_branch && git submodule update --init --recursive
WORKDIR /openvino/build
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; dnf install -y http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/opencl-headers-2.2-1.20180306gite986688.el8.noarch.rpm && dnf clean all
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; cmake -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" -DENABLE_SAMPLES=0 -DNGRAPH_USE_CXX_ABI=1 -DCMAKE_CXX_FLAGS=" -D_GLIBCXX_USE_CXX11_ABI=1 -Wno-error=parentheses " ..
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; make --jobs=$JOBS
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; make install
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; \
mkdir -p /opt/intel/openvino/extras && \
mkdir -p /opt/intel/openvino && \
ln -s /openvino/inference-engine/temp/opencv_*/opencv /opt/intel/openvino/extras && \
ln -s /usr/local/runtime /opt/intel/openvino && \
ln -s /openvino/scripts/setupvars/setupvars.sh /opt/intel/openvino/setupvars.sh && \
ln -s /opt/intel/openvino /opt/intel/openvino_2023
################## END OF OPENVINO SOURCE BUILD ######################

################### TAKE OPENVINO FROM A BINARY RELEASE - buildarg ov_use_binary=1 (DEFAULT) ##########
WORKDIR $TEMP_DIR
Expand All @@ -149,7 +206,40 @@ RUN if [ "$ov_use_binary" = "1" ] && [ "$DLDT_PACKAGE_URL" != "" ]; then true ;
mkdir /opt/intel && \
tar -zxf l_openvino_toolkit*.tgz -C /opt/intel && \
ln -s /opt/intel/l_openvino_toolkit* /opt/intel/openvino && \
ln -s /opt/intel/l_openvino_toolkit* /opt/intel/openvino_2022
ln -s /opt/intel/l_openvino_toolkit* /opt/intel/openvino_2023

# install sample apps including benchmark_app
RUN yum install -y http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/gflags-devel-2.2.2-1.el8.x86_64.rpm \
http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/gflags-2.2.2-1.el8.x86_64.rpm \
https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/j/json-devel-3.6.1-2.el8.x86_64.rpm && \
rm -rf /var/cache/yum
RUN if [ -f /opt/intel/openvino/samples/cpp/build_samples.sh ]; then /opt/intel/openvino/samples/cpp/build_samples.sh ; fi
#################### END OF OPENVINO BINARY INSTALL

# SENTENCEPIECE_EXTENSION
ENV OpenVINO_DIR=/opt/intel/openvino/runtime/cmake
WORKDIR /openvino_contrib/modules/custom_operations/user_ie_extensions
RUN if [ "$sentencepiece" == "1" ] ; then true ; else exit 0 ; fi ; cmake .. -DCMAKE_BUILD_TYPE=Release -DCUSTOM_OPERATIONS="sentence_piece" && cmake --build . --parallel $JOBS

# NVIDIA
ENV OPENVINO_BUILD_PATH=/cuda_plugin_build
ENV OPENVINO_HOME=/openvino
ENV OPENVINO_CONTRIB=/openvino_contrib

# hadolint ignore=DL3003
RUN if [ "$NVIDIA" == "1" ] ; then true ; else exit 0 ; fi ; \
mkdir "${OPENVINO_BUILD_PATH}" && \
cd "${OPENVINO_BUILD_PATH}" && \
cmake "${OPENVINO_HOME}" \
-DENABLE_NVIDIA=ON \
-DENABLE_TESTS=ON \
-DBUILD_arm_plugin=OFF \
-DBUILD_java_api=OFF \
-DOPENVINO_EXTRA_MODULES="${OPENVINO_CONTRIB}"/modules \
-DWHEEL_VERSION=2022.1.0 \
-DVERBOSE_BUILD=ON \
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" && \
cmake --build "${OPENVINO_BUILD_PATH}" --target openvino_nvidia_gpu_plugin -j "$JOBS"

# Build OpenVINO Model Server
WORKDIR /ovms
Expand All @@ -174,14 +264,28 @@ RUN curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHT
RUN yum install -y https://github.com/linux-test-project/lcov/releases/download/v1.16/lcov-1.16-1.noarch.rpm && yum clean all

WORKDIR /ovms

ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/intel/openvino/runtime/lib/intel64/:/opt/opencv/lib/:/opt/intel/openvino/runtime/3rdparty/tbb/lib/

ARG debug_bazel_flags=--strip=never\ --copt="-g"\ -c\ dbg
RUN if [[ $debug_bazel_flags == *"MEDIAPIPE_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; \
sed -i -e 's|3.19.1|3.9.2|g' WORKSPACE && \
sed -i -e 's|87407cd28e7a9c95d9f61a098a53cf031109d451a7763e7dd1253abf8b4df422|1fbf1c2962af287607232b2eddeaec9b4f4a7a6f5934e1a9276e9af76952f7e0|g' WORKSPACE

# hadolint ignore=DL3059
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} @org_tensorflow//tensorflow/core:framework

# Patch apple build scripts
# hadolint ignore=SC2046
RUN patch -d $(bazel info output_base)/external/build_bazel_rules_apple/ -p1 < /ovms/third_party/build_bazel_rules_apple/bazel_rules_apple.patch

RUN bazel build --jobs=$JOBS ${debug_bazel_flags} @tensorflow_serving//tensorflow_serving/apis:prediction_service_cc_proto
# Mediapipe
COPY BUILD.bazel /ovms/
COPY yarn.lock /ovms/
COPY package.json /ovms/

# prebuild dependencies before copying sources
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} //:ovms_dependencies

# hadolint ignore=DL3059
RUN cp -v /etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt
Expand All @@ -199,51 +303,52 @@ RUN make

WORKDIR /ovms

ARG PROJECT_VERSION="2022.3"
ARG PROJECT_VERSION="2023.0"
ARG PROJECT_NAME="OpenVINO Model Server"
LABEL description=${PROJECT_NAME}

# Set OVMS version strings
RUN bash -c "sed -i -e 's|REPLACE_PROJECT_NAME|${PROJECT_NAME}|g' /ovms/src/version.hpp"
RUN if [ "$build_type" = "dbg" ] ; then bash -c "sed -i -e 's|REPLACE_PROJECT_VERSION|${PROJECT_VERSION}-debug|g' /ovms/src/version.hpp" ; else bash -c "sed -i -e 's|REPLACE_PROJECT_VERSION|${PROJECT_VERSION}|g' /ovms/src/version.hpp" ; fi ;
RUN if [ "$ov_use_binary" = "1" ] ; then true ; else exit 0 ; fi ; sed -i -e "s#REPLACE_OPENVINO_NAME#$(find /opt/intel/ -maxdepth 1 -mindepth 1 -type d | grep openvino | grep -Eo '[0-9]{4}.[0-9].[0-9].[0-9]+.[^_]+')#g" /ovms/src/version.hpp

ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/intel/openvino/runtime/lib/intel64/:/opt/opencv/lib/:/opt/intel/openvino/runtime/3rdparty/tbb/lib/
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; sed -i -e "s#REPLACE_OPENVINO_NAME#$(git --git-dir /openvino/.git log -n 1 | head -n 1 | cut -d' ' -f2 | head -c 12)#g" /ovms/src/version.hpp

# Test Coverage
COPY check_coverage.bat /ovms/
COPY ci/check_coverage.bat /ovms/
ARG CHECK_COVERAGE=0

ARG RUN_TESTS=1
RUN if [ "$RUN_TESTS" == "1" ] ; then if [ "$CHECK_COVERAGE" = "1" ] ; then bazel coverage --combined_report=lcov --test_summary=detailed --test_output=streamed //src:ovms_test > ${TEST_LOG} 2>&1 || { cat ${TEST_LOG} && rm -rf ${TEST_LOG} && exit 1 ; } && genhtml --output genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" ; fi ; \
bazel test ${debug_bazel_flags} --jobs=$JOBS --test_summary=detailed --test_output=streamed //src:ovms_test > ${TEST_LOG} 2>&1 || (cat ${TEST_LOG} && rm -rf ${TEST_LOG} && exit 1 ; ) && tail -n 100 ${TEST_LOG} && rm -rf ${TEST_LOG} ; fi ;
RUN if [ "$RUN_TESTS" == "1" ] ; then if [ "$CHECK_COVERAGE" = "1" ] ; then bazel coverage --combined_report=lcov --jobs=$JOBS ${debug_bazel_flags} --test_timeout=1800 --test_summary=detailed --test_output=streamed --test_filter=-*Stress*Mediapipe* //src:ovms_test > ${TEST_LOG} 2>&1 || { cat ${TEST_LOG} && rm -rf ${TEST_LOG} && exit 1 ; } && genhtml --output genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat" ; fi ; \
bazel test --jobs=$JOBS ${debug_bazel_flags} --test_timeout=1800 --test_summary=detailed --test_output=streamed --test_filter=-*Stress*Mediapipe* //src:ovms_test > ${TEST_LOG} 2>&1 || (cat ${TEST_LOG} && rm -rf ${TEST_LOG} && exit 1 ; ) && tail -n 100 ${TEST_LOG} && rm -rf ${TEST_LOG} ; fi ;

# C api shared library
RUN bazel build ${debug_bazel_flags} --jobs $JOBS //src:ovms_shared
RUN bazel build --jobs $JOBS ${debug_bazel_flags} //src:ovms_shared

# C api app with bazel
# hadolint ignore=DL3059
RUN bazel build ${debug_bazel_flags} --jobs $JOBS //src:capi_cpp_example
RUN bazel build --jobs $JOBS ${debug_bazel_flags} //src:capi_cpp_example

# C-API benchmark app
RUN bazel build //src:capi_benchmark && ./bazel-bin/src/capi_benchmark --niter 2 --threads_per_ireq 2 --nireq 1 --servable_name "dummy" --inputs_names "b" --shape "b[1,10]"
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} //src:capi_benchmark && ./bazel-bin/src/capi_benchmark --niter 2 --threads_per_ireq 2 --nireq 1 --servable_name "dummy" --inputs_names "b" --shape "b[1,10]"

# OVMS
RUN bazel build ${debug_bazel_flags} ${minitrace_flags} --jobs=$JOBS //src:ovms
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} ${minitrace_flags} //src:ovms

# hadolint ignore=DL3059
RUN bazel build ${debug_bazel_flags} --jobs=$JOBS //src:libsampleloader.so
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} //src:libsampleloader.so

# C-api C/C++ app with gcc
COPY MakefileCapi .
RUN make -f MakefileCapi cpp && make -f MakefileCapi c
COPY MakefileCapi /ovms/
RUN make -f MakefileCapi cpp BAZEL_DEBUG_FLAGS="${debug_bazel_flags}" && \
make -f MakefileCapi c BAZEL_DEBUG_FLAGS="${debug_bazel_flags}"

ARG ovms_metadata_file
COPY ${ovms_metadata_file} metadata.json

RUN if [ "$build_type" == "dbg" ] ; then bash -c "cp /ovms/bazel-out/k8-dbg/bin/src/ovms /ovms/bazel-bin/src/ovms" ; else exit 0; fi ;
RUN /ovms/bazel-bin/src/ovms --version && /ovms/bazel-bin/src/ovms

COPY release_files/thirdparty-licenses/ /ovms/release_files/thirdparty-licenses/
COPY release_files/LICENSE /ovms/release_files/LICENSE
COPY client /client
COPY demos /demos
RUN rm -Rf /etc/entitlement /etc/rhsm/ca
Loading

0 comments on commit 301b794

Please sign in to comment.