Skip to content

Commit 4b19340

Browse files
Merge pull request #81 from RH-steve-grubb/2025.2-updates
2025.2 updates
2 parents 747cbb1 + 56806f8 commit 4b19340

File tree

4 files changed

+113
-9
lines changed

4 files changed

+113
-9
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# Optimizations used for TF Serving release builds.
1818
build:release --copt=-mavx
1919
build:release --copt=-msse4.2
20+
build:linux --copt="-march=haswell"
2021

2122
# Options used to build with CUDA.
2223
build:cuda --crosstool_top=@local_config_cuda//crosstool:toolchain

Dockerfile.redhat

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
2626

2727
ARG JOBS=8
2828
ARG VERBOSE_LOGS=OFF
29+
ARG LTO_ENABLE=OFF
30+
ARG LTO_CXX_FLAGS=""
31+
ARG LTO_LD_FLAGS="-Wl,-z,relro"
2932

3033
# hadolint ignore=DL3041
3134
RUN echo -e "max_parallel_downloads=8\nretries=50" >> /etc/dnf/dnf.conf && \
@@ -51,7 +54,10 @@ WORKDIR /boost
5154
RUN wget -nv https://sourceforge.net/projects/boost/files/boost/1.68.0/boost_1_68_0.tar.gz && \
5255
if [ "$VERBOSE_LOGS" == "ON" ] ; then export BVERBOSE="-d+2" ; else export BVERBOSE="" ; fi && \
5356
tar xf boost_1_68_0.tar.gz && cd boost_1_68_0 && ./bootstrap.sh && \
54-
./b2 -j ${JOBS} cxxstd=17 link=static cxxflags='-fPIC' cflags='-fPIC' \
57+
./b2 -j ${JOBS} cxxstd=17 link=static variant=release \
58+
cxxflags="-fPIC $LTO_CXX_FLAGS" \
59+
cflags="-fPIC $LTO_CXX_FLAGS" \
60+
linkflags="$LTO_LD_FLAGS" \
5561
--with-chrono --with-date_time --with-filesystem \
5662
--with-program_options --with-system \
5763
--with-random --with-thread --with-atomic --with-regex \
@@ -65,7 +71,9 @@ COPY third_party/pugixml /ovms/third_party/pugixml
6571
RUN git clone -b v1.13 https://github.com/zeux/pugixml && \
6672
cd pugixml && \
6773
patch -p1 < /ovms/third_party/pugixml/pugixml_v1.13_flags.patch && \
68-
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} && \
74+
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} \
75+
-DCMAKE_CXX_FLAGS="${LTO_CXX_FLAGS}" \
76+
-DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" && \
6977
make all -j ${JOBS} && \
7078
cp -P libpugixml.so* /usr/lib64/
7179

@@ -79,10 +87,10 @@ RUN git clone --recurse-submodules --depth 1 --branch v2.10.16 https://github.co
7987
patch -d /azure/azure-storage-cpp/ -p1 </ovms/third_party/azure/azure_sdk.patch
8088

8189
WORKDIR /azure/cpprestsdk/Release/build.release
82-
RUN cmake .. -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBoost_USE_STATIC_LIBS=ON -DWERROR=OFF -DBUILD_SAMPLES=OFF -DBUILD_TESTS=OFF && make --jobs=$JOBS install
90+
RUN cmake .. -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} -DCMAKE_CXX_FLAGS="-fPIC ${LTO_CXX_FLAGS}" -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBoost_USE_STATIC_LIBS=ON -DWERROR=OFF -DBUILD_SAMPLES=OFF -DBUILD_TESTS=OFF && make --jobs=$JOBS install
8391

8492
WORKDIR /azure/azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release
85-
RUN CASABLANCA_DIR=/azure/cpprestsdk cmake .. -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBoost_USE_STATIC_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} && make --jobs=$JOBS && make --jobs=$JOBS install
93+
RUN CASABLANCA_DIR=/azure/cpprestsdk cmake .. -DCMAKE_CXX_FLAGS="-fPIC ${LTO_CXX_FLAGS}" -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBoost_USE_STATIC_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} && make --jobs=$JOBS && make --jobs=$JOBS install
8694
####### End of Azure SDK
8795

8896
####### Build OpenCV
@@ -99,6 +107,7 @@ SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
99107

100108
ARG JOBS=40
101109
ARG VERBOSE_LOGS=OFF
110+
ARG LTO_ENABLE=OFF
102111

103112
# hadolint ignore=DL3041
104113
RUN dnf install -y https://rpmfind.net/linux/almalinux/8.10/PowerTools/x86_64/os/Packages/opencl-headers-2.2-1.20180306gite986688.el8.noarch.rpm && \
@@ -175,9 +184,12 @@ RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.n
175184
# hadolint ignore=DL3003
176185
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
177186
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
187+
WORKDIR /openvino
188+
COPY openvino-lto.patch .
189+
RUN if [ "$ov_use_binary" == "0" ]; then patch -p1 < openvino-lto.patch ; rm -f openvino-lto.patch ; fi
178190
WORKDIR /openvino/build
179-
RUN if [ "$ov_use_binary" == "0" ] && [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; 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 -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" -DENABLE_PYTHON=ON -DENABLE_INTEL_NPU=OFF -DENABLE_SAMPLES=0 -DCMAKE_CXX_FLAGS=" -Wno-error=parentheses " ..
180-
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 -DCMAKE_CXX_FLAGS=" -Wno-error=parentheses " ..
191+
RUN if [ "$ov_use_binary" == "0" ] && [[ $debug_bazel_flags == *"PYTHON_DISABLE=1"* ]]; 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 -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" -DENABLE_LTO=${LTO_ENABLE} -DENABLE_PYTHON=ON -DENABLE_INTEL_NPU=OFF -DENABLE_SAMPLES=0 -DCMAKE_CXX_FLAGS=" -Wno-error=parentheses ${LTO_CXX_FLAGS} " -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" ..
192+
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_LTO=${LTO_ENABLE} -DENABLE_SAMPLES=0 -DENABLE_INTEL_NPU=OFF -DCMAKE_CXX_FLAGS=" -Wno-error=parentheses ${LTO_CXX_FLAGS} " -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" ..
181193
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; make --jobs=$JOBS
182194
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; make install
183195
RUN if [ "$ov_use_binary" == "0" ] ; then true ; else exit 0 ; fi ; \
@@ -225,7 +237,17 @@ ARG ov_tokenizers_branch=85be884a69f10270703f81f970a5ee596a4c8df7
225237
# hadolint ignore=DL3003
226238
RUN git clone https://github.com/openvinotoolkit/openvino_tokenizers.git /openvino_tokenizers && cd /openvino_tokenizers && git checkout $ov_tokenizers_branch && git submodule update --init --recursive
227239
WORKDIR /openvino_tokenizers/build
228-
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" && cmake --build . --parallel $JOBS ; cp /openvino_tokenizers/build/src/lib*.so /opt/intel/openvino/runtime/lib/intel64/
240+
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE="${VERBOSE_LOGS}" -DCMAKE_CXX_FLAGS=" ${LTO_CXX_FLAGS} " -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" && cmake --build . --parallel $JOBS ; cp /openvino_tokenizers/build/src/lib*.so /opt/intel/openvino/runtime/lib/intel64/
241+
WORKDIR /openvino_tokenizers/
242+
# Install the openvino_tokenizers python bindings and use a symlink to point
243+
# to the shared object in it's final location.
244+
RUN if ! [[ $debug_bazel_flags == *"_py_off"* ]]; then \
245+
mkdir -p /opt/intel/openvino/python/openvino_tokenizers/lib ; \
246+
cp -r python/* /opt/intel/openvino/python/ ; \
247+
cp build/python/* /opt/intel/openvino/python/openvino_tokenizers/ ; \
248+
mkdir -p /opt/intel/openvino/python/openvino_tokenizers-2025.1.dist-info ; \
249+
echo $'Metadata-Version: 1.0\nName: openvino-tokenizers\nVersion: 2025.1\nRequires-Python: >=3.9\nRequires-Dist: openvino~=2025.1.0' > /opt/intel/openvino/python/openvino_tokenizers-2025.1.dist-info/METADATA ; \
250+
ln -s /ovms/lib/libopenvino_tokenizers.so /opt/intel/openvino/python/openvino_tokenizers/lib/libopenvino_tokenizers.so ; fi
229251

230252
# Build OpenVINO Model Server
231253
WORKDIR /ovms
@@ -345,7 +367,9 @@ ARG FUZZER_BUILD=0
345367
ARG debug_bazel_flags="--strip=always --config=mp_on_py_on --//:distro=redhat"
346368
COPY --from=capi-build /ovms_release/lib/libovms_shared.so /ovms_release/lib/
347369
COPY create_package.sh /
348-
RUN ./create_package.sh
370+
RUN ./create_package.sh ; if ! [[ $debug_bazel_flags == *"_py_off"* ]]; then \
371+
echo $'#!/bin/bash\npython3 -m openvino_tokenizers.cli "$@"' > /ovms_release/bin/convert_tokenizer ; \
372+
chmod +x /ovms_release/bin/convert_tokenizer ; fi
349373

350374
# hadolint ignore=DL3059
351375
RUN chown -R ovms:ovms /ovms_release
@@ -394,6 +418,7 @@ RUN if [ -f /usr/bin/dnf ] ; then export DNF_TOOL=dnf ; echo -e "max_parallel_do
394418
useradd --home-dir /home/ovms --create-home --uid 5000 --gid 5000 --groups 39,44 --shell /bin/bash --skel /dev/null ovms
395419

396420
ENV LD_LIBRARY_PATH=/ovms/lib
421+
ENV PATH="$PATH:/ovms/bin"
397422

398423
COPY --from=pkg /ovms_release /ovms
399424
# hadolint ignore=SC2114
@@ -404,5 +429,14 @@ COPY --from=pkg /usr/local/lib64/python3.*/site-packages/MarkupSafe-3.0.2.dist-i
404429
COPY --from=pkg /usr/local/lib64/python3.*/site-packages/markupsafe /ovms/python_deps/markupsafe
405430

406431
COPY --from=pkg /licenses /licenses
432+
433+
# Setup Python Demos Environment
434+
COPY demos/python_demos/requirements.txt .
435+
RUN if [ -f /usr/bin/dnf ] ; then export DNF_TOOL=dnf ; \
436+
else export DNF_TOOL=microdnf ; fi ; \
437+
$DNF_TOOL install -y python3-pip git iproute net-tools ; $DNF_TOOL clean all ; \
438+
pip3 install --no-cache-dir -r requirements.txt ; \
439+
rm -f requirements.txt
440+
407441
USER ovms
408442
ENTRYPOINT ["/ovms/bin/ovms"]

openvino-lto.patch

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 2187deb8e8..ad15a73395 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -65,6 +65,7 @@ if(ENABLE_COVERAGE)
6+
include(cmake/coverage.cmake)
7+
endif()
8+
9+
+set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
10+
if(APPLE AND CMAKE_OSX_DEPLOYMENT_TARGET AND
11+
CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.15)
12+
message(FATAL_ERROR "OpenVINO requires MACOSX_DEPLOYMENT_TARGET at least 10.15, specified ${CMAKE_OSX_DEPLOYMENT_TARGET}")
13+
diff --git a/src/frontends/common/CMakeLists.txt b/src/frontends/common/CMakeLists.txt
14+
index e4d2fe63e1..eace2a5593 100644
15+
--- a/src/frontends/common/CMakeLists.txt
16+
+++ b/src/frontends/common/CMakeLists.txt
17+
@@ -52,7 +52,8 @@ target_link_libraries(${TARGET_NAME}_obj PRIVATE openvino::util openvino::core::
18+
19+
# TODO: fix lto
20+
set_target_properties(${TARGET_NAME}_obj PROPERTIES
21+
- INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF)
22+
+ INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
23+
+ov_add_compiler_flags(-march=haswell)
24+
25+
set(FRONTEND_LIB_SUFFIX "${FRONTEND_NAME_SUFFIX}${OV_BUILD_POSTFIX}")
26+
if(APPLE)
27+
--- a/thirdparty/onnx/CMakeLists.txt
28+
+++ b/thirdparty/onnx/CMakeLists.txt
29+
@@ -21,7 +21,10 @@ endif()
30+
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
31+
# 4244 conversion from 'XXX' to 'YYY', possible loss of data
32+
ov_add_compiler_flags(/wd4244)
33+
+else()
34+
+ ov_add_compiler_flags(-march=haswell)
35+
endif()
36+
+set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
37+
38+
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
39+
set(ONNX_USE_PROTOBUF_SHARED_LIBS OFF CACHE BOOL "Use dynamic protobuf by ONNX library" FORCE)
40+
diff --git a/thirdparty/protobuf/CMakeLists.txt b/thirdparty/protobuf/CMakeLists.txt
41+
index a16bd56d11..2829926e68 100644
42+
--- a/thirdparty/protobuf/CMakeLists.txt
43+
+++ b/thirdparty/protobuf/CMakeLists.txt
44+
@@ -10,6 +10,7 @@ set(BUILD_SHARED_LIBS OFF)
45+
46+
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR (OV_COMPILER_IS_INTEL_LLVM AND UNIX))
47+
ov_add_compiler_flags(-Wno-all)
48+
+ ov_add_compiler_flags(-march=haswell)
49+
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11 AND CMAKE_COMPILER_IS_GNUCXX)
50+
ov_add_compiler_flags(-Wno-stringop-overflow)
51+
endif()
52+
@@ -48,6 +49,7 @@ else()
53+
set(protobuf_dir protobuf/cmake)
54+
endif()
55+
56+
+set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
57+
add_subdirectory(${protobuf_dir} EXCLUDE_FROM_ALL)
58+
get_directory_property(protobuf_VERSION DIRECTORY ${protobuf_dir} DEFINITION protobuf_VERSION)
59+
60+
@@ -63,7 +65,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR OV_COMPILER_IS_INTEL_LLVM
61+
CXX_VISIBILITY_PRESET default
62+
C_VISIBILITY_PRESET default
63+
VISIBILITY_INLINES_HIDDEN OFF
64+
- INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF)
65+
+ INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
66+
endif()
67+
ov_disable_all_warnings(${_protoc_libs} libprotobuf-lite)
68+
set_target_properties(libprotobuf-lite PROPERTIES

third_party/opencv/opencv_cmake_flags.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-D BUILD_LIST=core,improc,imgcodecs,calib3d,features2d,highgui,imgproc,video,videoio,optflow \
22
-D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib_repo/modules \
33
-D CMAKE_BUILD_TYPE=Release \
4+
-D ENABLE_LTO=${LTO_ENABLE} \
45
-D CMAKE_INSTALL_PREFIX=/opt/opencv \
56
-D OPENCV_LIB_INSTALL_PATH=lib \
67
-D BUILD_TESTS=OFF \
@@ -39,4 +40,4 @@
3940
-D WITH_JPEG=ON \
4041
-D WITH_PNG=ON \
4142
-D WITH_TIFF=OFF \
42-
-D WITH_OPENEXR=OFF
43+
-D WITH_OPENEXR=OFF

0 commit comments

Comments
 (0)