Skip to content

Commit

Permalink
working build
Browse files Browse the repository at this point in the history
  • Loading branch information
bstrzele committed Jun 11, 2024
1 parent b991f9b commit 89c380d
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 543 deletions.
8 changes: 4 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ cc_library(
"@com_github_jarro2783_cxxopts//:cxxopts",
] + select({
"//:ubuntu_build": [
"@aws-sdk-cpp//:aws-sdk-cpp_ubuntu",
"@aws-sdk-cpp//:aws-sdk-cpp_cmake_ubuntu",
# "@aws-sdk-cpp//:aws-sdk-cpp_ubuntu",
# "@aws-sdk-cpp//:aws-sdk-cpp_cmake_ubuntu",
],
"//:redhat_build": [
"@aws-sdk-cpp//:aws-sdk-cpp_redhat",
"@aws-sdk-cpp//:aws-sdk-cpp_cmake_redhat",
# "@aws-sdk-cpp//:aws-sdk-cpp_redhat",
# "@aws-sdk-cpp//:aws-sdk-cpp_cmake_redhat",
],
}) + [
"@azure//:storage",
Expand Down
57 changes: 9 additions & 48 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -207,56 +207,14 @@ ENV OPENVINO_BUILD_PATH=/cuda_plugin_build
ENV OPENVINO_HOME=/openvino
ENV OPENVINO_CONTRIB=/openvino_contrib

# Add Nvidia dev tool if needed
# hadolint ignore=DL3003
RUN if [ "$NVIDIA" == "1" ] ; then true ; else exit 0 ; fi ; \
set -exuo pipefail ; \
rm -f /etc/apt/apt.conf.d/docker-clean ; \
if [[ ${enable_tensorrt-} == "1" ]] ; then dpkg -i /nv-tensorrt-repo-*.deb ; fi; \
if [[ "$BASE_IMAGE" == *"22.04"* ]] ; then libcutensor_version=1.7.0.1-1; else libcutensor_version=1.6.1.5-1; fi;\
apt-get update && apt-get install --no-install-recommends -y \
libzstd-dev \
libcudnn8=8.8.0.121-1+cuda11.8 \
libcudnn8-dev=8.8.0.121-1+cuda11.8 \
libcutensor1="$libcutensor_version" \
libcutensor-dev="$libcutensor_version" && \
apt-get install --no-install-recommends -y cuda-11-8 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
pip3 install --no-cache-dir 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 ;

# 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 \
-DBUILD_custom_operations=OFF \
-DBUILD_mo_pytorch=OFF \
-DBUILD_optimum=OFF \
-DBUILD_ovms_ai_extension=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 && \
cp /openvino/bin/intel64/Release/libopenvino_nvidia_gpu_plugin.so /opt/intel/openvino/runtime/lib/intel64 && \
echo '<ie><plugins><plugin location="libopenvino_nvidia_gpu_plugin.so" name="NVIDIA"></plugin></plugins></ie>' > /opt/intel/openvino/runtime/lib/intel64/plugins.xml

# Set up Bazel
ENV BAZEL_VERSION 6.0.0
WORKDIR /bazel
RUN curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
RUN curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-linux-arm64 && \
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \
chmod +x bazel-*.sh && \
./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh
chmod +x bazel-* && \
./bazel-$BAZEL_VERSION-linux-arm64

# Build OpenVINO Model Server
WORKDIR /ovms
Expand All @@ -267,7 +225,7 @@ COPY src/BUILD /ovms/src/BUILD
COPY src/python/binding/BUILD /ovms/src/python/binding/BUILD
COPY src/python/binding/tests/requirements.txt /ovms/src/python/binding/tests/requirements.txt

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

# FROM BASE BUILD
COPY --from=base_build /opt/opencv /opt/opencv/
Expand All @@ -279,14 +237,17 @@ COPY *\.bzl /ovms/
COPY yarn.lock /ovms/
COPY package.json /ovms/

RUN apt install python3

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

COPY src/ /ovms/src/

RUN ln -s /bazel/bazel-$BAZEL_VERSION-linux-arm64 /usr/bin/bazel
# run python testes on a version from os not TFS
ARG RUN_TESTS=1
RUN if [ "$RUN_TESTS" == "1" ] ; then bazel test --jobs=$JOBS ${debug_bazel_flags} --test_timeout=1800 --test_summary=detailed --test_output=streamed --test_filter=* //src/python/binding:test_python_binding; fi ;
#RUN if [ "$RUN_TESTS" == "1" ] ; then bazel test --jobs=$JOBS ${debug_bazel_flags} --test_timeout=1800 --test_summary=detailed --test_output=streamed --test_filter=* //src/python/binding:test_python_binding; fi ;

# hadolint ignore=DL3059
RUN bazel build --jobs=$JOBS ${debug_bazel_flags} @org_tensorflow//tensorflow/core:framework
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ else
@touch .workspace/metadata.json
endif
@cat .workspace/metadata.json
docker $(BUILDX) build $(NO_CACHE_OPTION) -f Dockerfile.$(DIST_OS) . \
docker $(BUILDX) build $(NO_CACHE_OPTION) -f Dockerfile.$(DIST_OS) --platform linux/arm64 . \
$(BUILD_ARGS) \
-t $(OVMS_CPP_DOCKER_IMAGE)-build:$(OVMS_CPP_IMAGE_TAG)$(IMAGE_TAG_SUFFIX) \
--target=build
Expand Down
10 changes: 5 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ new_local_repository(
cc_library(
name = "ssl",
hdrs = glob(["include/openssl/*"]),
srcs = glob(["lib/x86_64-linux-gnu/libssl.so"]),
srcs = glob(["lib/aarch64-linux-gnu/libssl.so"]),
copts = ["-lcrypto", "-lssl"],
visibility = ["//visibility:public"],
)
cc_library(
name = "crypto",
hdrs = glob(["include/openssl/*"]),
srcs = glob(["lib/x86_64-linux-gnu/libssl.so"]),
srcs = glob(["lib/aarch64-linux-gnu/libssl.so"]),
copts = ["-lcrypto", "-lssl"],
visibility = ["//visibility:public"],
)
Expand All @@ -64,7 +64,7 @@ new_local_repository(
cc_library(
name = "curl",
hdrs = glob(["include/x86_64/curl/*"]),
srcs = glob(["lib/x86_64-linux-gnu/libcurl.so"]),
srcs = glob(["lib/aarch64-linux-gnu/libcurl.so"]),
copts = ["-lcrypto", "-lssl"],
visibility = ["//visibility:public"],
)
Expand Down Expand Up @@ -295,8 +295,8 @@ workspace()
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()

load("@//third_party/aws-sdk-cpp:aws-sdk-cpp.bzl", "aws_sdk_cpp")
aws_sdk_cpp()
#load("@//third_party/aws-sdk-cpp:aws-sdk-cpp.bzl", "aws_sdk_cpp")
#aws_sdk_cpp()

load("@//third_party/llm_engine:llm_engine.bzl", "llm_engine")
llm_engine()
Expand Down
6 changes: 3 additions & 3 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ cc_shared_library(
"@com_github_gabime_spdlog//:__subpackages__",
"@fmtlib//:__subpackages__",
"@com_github_jarro2783_cxxopts//:__subpackages__",
"@aws-sdk-cpp//:__subpackages__",
#"@aws-sdk-cpp//:__subpackages__",
"@boost//:__subpackages__",
"@com_github_googleapis_google_cloud_cpp//:__subpackages__",
"@curl//:__subpackages__",
Expand Down Expand Up @@ -871,10 +871,10 @@ cc_library( # make ovms_lib dependent, use share doptions
],
deps = select({
"//:ubuntu_build": [
"@aws-sdk-cpp//:aws-sdk-cpp_ubuntu",
#"@aws-sdk-cpp//:aws-sdk-cpp_ubuntu",
],
"//:redhat_build": [
"@aws-sdk-cpp//:aws-sdk-cpp_redhat",
#"@aws-sdk-cpp//:aws-sdk-cpp_redhat",
],
}) + [
"libovmsfilesystem",
Expand Down
4 changes: 1 addition & 3 deletions src/filesystemfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
namespace ovms {
std::shared_ptr<FileSystem> getFilesystem(const std::string& basePath) {
if (basePath.rfind(FileSystem::S3_URL_PREFIX, 0) == 0) {
Aws::SDKOptions options;
Aws::InitAPI(options);
return std::make_shared<S3FileSystem>(options, basePath);
return std::make_shared<S3FileSystem>(basePath);
}
if (basePath.rfind(FileSystem::GCS_URL_PREFIX, 0) == 0) {
return std::make_shared<ovms::GCSFileSystem>();
Expand Down
Loading

0 comments on commit 89c380d

Please sign in to comment.