Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atobisze embed no copy #2763

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ build --cxxopt=-fstack-clash-protection
build --cxxopt=-Wformat
build --cxxopt=-Wformat-security
build --cxxopt=-Werror=format-security

build --cxxopt=-DOVMS_DUMP_TO_FILE=0
# Adding "--cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0" creates parity with TF
# compilation options. It also addresses memory use due to
# copy-on-write semantics of std::strings of the older ABI.
Expand All @@ -97,3 +97,18 @@ build --cxxopt=-DOVMS_DUMP_TO_FILE=0
# very strict in sandboxing
test --test_env PYTHONPATH=/opt/intel/openvino/python:/ovms/bazel-bin/src/python/binding
test --test_env LD_LIBRARY_PATH=/opt/opencv/lib/:/opt/intel/openvino/runtime/lib/intel64/:/opt/intel/openvino/runtime/3rdparty/tbb/lib/
# genai hardcodes path during build time so without this so is not visible
test --test_env OPENVINO_TOKENIZERS_PATH_GENAI=/opt/intel/openvino/runtime/lib/intel64/libopenvino_tokenizers.so

build --remote_cache=http://10.123.246.16:9666
build --remote_upload_local_results=true
build:mp_on_py_on --define=MEDIAPIPE_DISABLE=0
build:mp_on_py_on --define=PYTHON_DISABLE=0
build:mp_on_py_on --disk_cache=/root/.cache/bazel_mp_on_py_on
build:mp_on_py_off --define=MEDIAPIPE_DISABLE=0
build:mp_on_py_off --define=PYTHON_DISABLE=1
build:mp_on_py_off --disk_cache=/root/.cache/bazel_mp_on_py_off
build:mp_off_py_off --define=MEDIAPIPE_DISABLE=1
build:mp_off_py_off --define=PYTHON_DISABLE=1
build:mp_off_py_off --disk_cache=/root/.cache/bazel_mp_off_py_off
#build --remote_header=x-build-event-log=DEBUG
20 changes: 10 additions & 10 deletions Dockerfile.redhat
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ ARG ov_use_binary=0
ARG DLDT_PACKAGE_URL
ARG TEMP_DIR=/tmp/openvino_installer
ARG CMAKE_BUILD_TYPE=Release
ARG debug_bazel_flags="--strip=always --define MEDIAPIPE_DISABLE=0 --define PYTHON_DISABLE=0 --//:distro=redhat"
ARG debug_bazel_flags="--strip=always --config=mp_on_py_on --//:distro=redhat"

# hadolint ignore=DL3003
RUN if [[ "$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
Expand All @@ -189,7 +189,7 @@ RUN dnf install -y http://vault.centos.org/centos/8-stream/PowerTools/x86_64/os/
dnf clean all
# 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
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; pip3 install --no-cache-dir -r /openvino/src/bindings/python/wheel/requirements-dev.txt
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; pip3 install --no-cache-dir -r /openvino/src/bindings/python/wheel/requirements-dev.txt
WORKDIR /openvino/build
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; cmake -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" -DENABLE_SAMPLES=0 -DENABLE_INTEL_NPU=OFF -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
Expand All @@ -201,8 +201,8 @@ RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; \
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_2024
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; mkdir -p /opt/intel/openvino && cp -r /openvino/bin/intel64/Release/python /opt/intel/openvino/
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; cp -r /openvino/tools/ovc/* /opt/intel/openvino/python
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; mkdir -p /opt/intel/openvino && cp -r /openvino/bin/intel64/Release/python /opt/intel/openvino/
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; cp -r /openvino/tools/ovc/* /opt/intel/openvino/python
################## END OF OPENVINO SOURCE BUILD ######################

################### TAKE OPENVINO FROM A BINARY RELEASE - buildarg ov_use_binary=1 (DEFAULT) ##########
Expand Down Expand Up @@ -285,7 +285,7 @@ COPY yarn.lock /ovms/
COPY package.json /ovms/

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

# hadolint ignore=DL3059
RUN cp -v /etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt
Expand All @@ -301,7 +301,7 @@ COPY src/ /ovms/src/
WORKDIR /ovms/src/example/SampleCpuExtension/
RUN make

RUN if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; \
RUN if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; \
mkdir -p /opt/intel/openvino/python/openvino-2024.5.dist-info && \
echo $'Metadata-Version: 1.0\nName: openvino\nVersion: 2024.5' > /opt/intel/openvino/python/openvino-2024.5.dist-info/METADATA
ENV PYTHONPATH=/opt/intel/openvino/python:/ovms/bazel-bin/src/python/binding
Expand Down Expand Up @@ -332,7 +332,7 @@ RUN bazel build --jobs=$JOBS ${debug_bazel_flags} //src:release_custom_nodes

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

# hadolint ignore=DL3059
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} //src:libsampleloader.so
Expand All @@ -354,7 +354,7 @@ RUN rm -Rf /etc/entitlement /etc/rhsm/ca

FROM $BUILD_IMAGE as capi-build
# C api shared library
ARG CAPI_FLAGS="--strip=always --define MEDIAPIPE_DISABLE=1 --define PYTHON_DISABLE=1 --//:distro=redhat"
ARG CAPI_FLAGS="--strip=always --config=mp_off_py_off --//:distro=redhat"
ARG JOBS=40
RUN bazel build --jobs $JOBS ${CAPI_FLAGS} //src:ovms_shared

Expand Down Expand Up @@ -384,7 +384,7 @@ WORKDIR /
ARG BASE_OS=redhat
ARG ov_use_binary=0
ARG FUZZER_BUILD=0
ARG debug_bazel_flags="--strip=always --define MEDIAPIPE_DISABLE=0 --define PYTHON_DISABLE=0 --//:distro=redhat"
ARG debug_bazel_flags="--strip=always --config=mp_on_py_on --//:distro=redhat"
COPY --from=capi-build /ovms_release/lib/libovms_shared.so /ovms_release/lib/
COPY create_package.sh /
RUN ./create_package.sh
Expand Down Expand Up @@ -426,7 +426,7 @@ RUN if [ -f /usr/bin/dnf ] ; then export DNF_TOOL=dnf ; echo -e "max_parallel_do
source install_gpu_drivers.sh && rm -rf ./install_gpu_drivers.sh; \
fi ; \
# For image with Python enabled install Python library
if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then \
if ! [[ $debug_bazel_flags == *"py_off"* ]]; then \
$DNF_TOOL install -y python39-libs --setopt=install_weak_deps=0 --nodocs; \
fi ; \
$DNF_TOOL install -y shadow-utils; \
Expand Down
24 changes: 12 additions & 12 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ARG BASE_IMAGE
ENV DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]

ARG debug_bazel_flags="--strip=always --define MEDIAPIPE_DISABLE=0 --define PYTHON_DISABLE=0 --//:distro=ubuntu"
ARG debug_bazel_flags="--strip=always --config=mp_on_py_on --//:distro=ubuntu"

RUN apt-get update && apt-get install --no-install-recommends -y \
libgflags-dev \
Expand Down Expand Up @@ -156,19 +156,19 @@ RUN if [[ "$NVIDIA" == "1" ]] ; then true ; else exit 0 ; fi ; git clone https:/
# 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
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; pip install --no-cache-dir -r /openvino/src/bindings/python/wheel/requirements-dev.txt
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; pip install --no-cache-dir -r /openvino/src/bindings/python/wheel/requirements-dev.txt
WORKDIR /openvino/build
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DENABLE_PYTHON=ON -DENABLE_SAMPLES=0 -DNGRAPH_USE_CXX_ABI=1 -DCMAKE_CXX_FLAGS=" -D_GLIBCXX_USE_CXX11_ABI=1 -Wno-error=parentheses " -DENABLE_CPPLINT=OFF -DENABLE_INTEL_NPU_PROTOPIPE=OFF ..
RUN if [ "$ov_use_binary" == "0" ] && [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; 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 " -DENABLE_CPPLINT=OFF -DENABLE_INTEL_NPU_PROTOPIPE=OFF ..
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DENABLE_PYTHON=ON -DENABLE_SAMPLES=0 -DNGRAPH_USE_CXX_ABI=1 -DCMAKE_CXX_FLAGS=" -D_GLIBCXX_USE_CXX11_ABI=1 -Wno-error=parentheses " -DENABLE_CPPLINT=OFF -DENABLE_INTEL_NPU_PROTOPIPE=OFF ..
RUN if [ "$ov_use_binary" == "0" ] && [[ $debug_bazel_flags == *"py_off=1"* ]]; 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 " -DENABLE_CPPLINT=OFF -DENABLE_INTEL_NPU_PROTOPIPE=OFF ..
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 && \
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_2024
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; mkdir -p /opt/intel/openvino && cp -r /openvino/bin/intel64/${CMAKE_BUILD_TYPE}/python /opt/intel/openvino/
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; cp -r /openvino/tools/ovc/* /opt/intel/openvino/python
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; mkdir -p /opt/intel/openvino && cp -r /openvino/bin/intel64/${CMAKE_BUILD_TYPE}/python /opt/intel/openvino/
RUN if [ "$ov_use_binary" == "0" ]; then true ; else exit 0 ; fi ; if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; cp -r /openvino/tools/ovc/* /opt/intel/openvino/python

################## END OF OPENVINO SOURCE BUILD ######################

Expand Down Expand Up @@ -286,8 +286,8 @@ COPY *\.bzl /ovms/
COPY yarn.lock /ovms/
COPY package.json /ovms/

# prebuild dependencies before copying sources
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} //:ovms_dependencies
# prebuild dependencies before copying sources & test dependencies for caching
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} //:ovms_dependencies @com_google_googletest//:gtest

COPY src/ /ovms/src/

Expand All @@ -303,7 +303,7 @@ COPY demos/benchmark/cpp/synthetic_client_async_benchmark.cpp demos/image_classi
WORKDIR /ovms/src/example/SampleCpuExtension/
RUN make

RUN if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; \
RUN if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; \
mkdir -p /opt/intel/openvino/python/openvino-2024.5.dist-info && \
echo $'Metadata-Version: 1.0\nName: openvino\nVersion: 2024.5' > /opt/intel/openvino/python/openvino-2024.5.dist-info/METADATA

Expand Down Expand Up @@ -337,7 +337,7 @@ RUN if [ "$FUZZER_BUILD" == "0" ]; then bazel build --jobs=$JOBS ${debug_bazel_f

# OVMS
# hadolint ignore=DL3059
RUN if [ "$FUZZER_BUILD" == "0" ]; then bazel build --jobs=$JOBS ${debug_bazel_flags} ${minitrace_flags} //src:ovms; fi;
RUN if [ "$FUZZER_BUILD" == "0" ]; then bazel build --jobs=$JOBS ${debug_bazel_flags} ${minitrace_flags} //src:ovms //src:ovms_test; fi;

# hadolint ignore=DL3059
RUN if [ "$FUZZER_BUILD" == "0" ]; then bazel build ${debug_bazel_flags} --jobs=$JOBS //src:libsampleloader.so; fi;
Expand All @@ -357,7 +357,7 @@ FROM $BUILD_IMAGE as capi-build
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
# C api shared library
# hadolint ignore=DL3059
ARG CAPI_FLAGS="--strip=always --define MEDIAPIPE_DISABLE=1 --define PYTHON_DISABLE=1 --//:distro=ubuntu"
ARG CAPI_FLAGS="--strip=always --config mp_off_py_off --//:distro=ubuntu"
ARG JOBS=40
ARG FUZZER_BUILD=0
RUN bazel build --jobs=$JOBS ${CAPI_FLAGS} //src:ovms_shared
Expand Down Expand Up @@ -458,7 +458,7 @@ COPY --from=build /usr/local/lib/python3.*/dist-packages/jinja2-3.1.4.dist-info
COPY --from=build /usr/local/lib/python3.*/dist-packages/markupsafe /ovms/python_deps/markupsafe

# For image with Python enabled install Python library
RUN if ! [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; then true ; else exit 0 ; fi ; \
RUN if ! [[ $debug_bazel_flags == *"py_off"* ]]; then true ; else exit 0 ; fi ; \
apt-get update -y ; \
if [[ "$BASE_IMAGE" == *"22.04"* ]] ; then python_version=3.10; else python_version=3.8; fi; \
apt-get install libpython$python_version --no-install-recommends -y && \
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,14 @@ else
DISABLE_MEDIAPIPE_PARAMS = " --define MEDIAPIPE_DISABLE=0"
endif

ifeq ($(PYTHON_DISABLE),1)
DISABLE_PYTHON_PARAMS = " --define PYTHON_DISABLE=1"
ifeq ($(MEDIAPIPE_DISABLE),1)
DISABLE_PARAMS = " --config=mp_off_py_off"
else
DISABLE_PYTHON_PARAMS = " --define PYTHON_DISABLE=0"
ifeq ($(PYTHON_DISABLE),1)
DISABLE_PARAMS = " --config=mp_on_py_off"
else
DISABLE_PARAMS = " --config=mp_on_py_on"
endif
endif

FUZZER_BUILD_PARAMS ?= ""
Expand Down Expand Up @@ -136,8 +140,8 @@ else ifeq ($(findstring redhat,$(BASE_OS)),redhat)
else
$(error BASE_OS must be either ubuntu or redhat)
endif
CAPI_FLAGS = "--strip=$(STRIP)"$(BAZEL_DEBUG_BUILD_FLAGS)" --define MEDIAPIPE_DISABLE=1 --define PYTHON_DISABLE=1"$(OV_TRACING_PARAMS)$(TARGET_DISTRO_PARAMS)
BAZEL_DEBUG_FLAGS="--strip=$(STRIP)"$(BAZEL_DEBUG_BUILD_FLAGS)$(DISABLE_MEDIAPIPE_PARAMS)$(DISABLE_PYTHON_PARAMS)$(FUZZER_BUILD_PARAMS)$(OV_TRACING_PARAMS)$(TARGET_DISTRO_PARAMS)
CAPI_FLAGS = "--strip=$(STRIP)"$(BAZEL_DEBUG_BUILD_FLAGS)" --config=mp_off_py_off"$(OV_TRACING_PARAMS)$(TARGET_DISTRO_PARAMS)
BAZEL_DEBUG_FLAGS="--strip=$(STRIP)"$(BAZEL_DEBUG_BUILD_FLAGS)$(DISABLE_PARAMS)$(FUZZER_BUILD_PARAMS)$(OV_TRACING_PARAMS)$(TARGET_DISTRO_PARAMS)

# Option to Override release image.
# Release image OS *must have* glibc version >= glibc version on BASE_OS:
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ http_archive(
git_repository(
name = "mediapipe",
remote = "https://github.com/openvinotoolkit/mediapipe",
commit = "9407697e8a18eebea664bab27d217a06bfa237fd", # Support ov::string in ovms model api adapter (#90)
commit = "5d060825975114cecfb04d53ed60c1d68b636a73", # Support getting output metadata in model api adapter
)

# DEV mediapipe 1 source - adjust local repository path for build
Expand Down Expand Up @@ -419,7 +419,7 @@ new_git_repository(
name = "model_api",
remote = "https:///github.com/openvinotoolkit/model_api/",
build_file = "@_model-api//:BUILD",
commit = "eb9fcfb1e1eebc047ff144707f76203b132e1aa6" # master Jun 24 15:02:17 2024 [cpp] Fix num classes check
commit = "28eed6279d5ebc20f41f76daea9be66681704968" # Support getting output metadata in model api adapter
)

new_local_repository(
Expand Down
Loading