Skip to content

Commit

Permalink
CVS-50623 GPU dependencies for RH8 OS (openvinotoolkit#589)
Browse files Browse the repository at this point in the history
- build GPU dependencies on UBI based image
- support two driver versions (19 and 20)
  • Loading branch information
mzegla authored Mar 19, 2021
1 parent 5158231 commit ba1a500
Show file tree
Hide file tree
Showing 9 changed files with 164 additions and 21 deletions.
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020 Intel Corporation
# Copyright (c) 2020-2021 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 Down Expand Up @@ -43,6 +43,7 @@ BASE_OS_TAG_CLEARLINUX ?= latest
BASE_OS_TAG_REDHAT ?= 8.2

INSTALL_RPMS_FROM_URL ?=
INSTALL_DRIVER_VERSION ?= "19.41.14441"

# NOTE: when changing any value below, you'll need to adjust WORKSPACE file by hand:
# - uncomment source build section, comment binary section
Expand Down Expand Up @@ -196,7 +197,9 @@ endif
--build-arg http_proxy=$(HTTP_PROXY) --build-arg https_proxy="$(HTTPS_PROXY)" \
--build-arg no_proxy=$(NO_PROXY) \
--build-arg INSTALL_RPMS_FROM_URL="$(INSTALL_RPMS_FROM_URL)" \
--build-arg INSTALL_DRIVER_VERSION="$(INSTALL_DRIVER_VERSION)" \
--build-arg GPU=1 \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
-t $(OVMS_CPP_DOCKER_IMAGE)-gpu:$(OVMS_CPP_IMAGE_TAG) && \
docker tag $(OVMS_CPP_DOCKER_IMAGE)-gpu:$(OVMS_CPP_IMAGE_TAG) $(OVMS_CPP_DOCKER_IMAGE):$(OVMS_CPP_IMAGE_TAG)-gpu
cd extras/nginx-mtls-auth && \
Expand Down Expand Up @@ -320,11 +323,11 @@ test_functional: venv


tools_get_deps:
cd tools/deps && docker build --build-arg http_proxy="$(http_proxy)" --build-arg https_proxy="$(https_proxy)" -t $(OVMS_CPP_DOCKER_IMAGE)-deps:$(OVMS_CPP_IMAGE_TAG) .
-docker rm -f $(OVMS_CPP_DOCKER_IMAGE)-deps__$(OVMS_CPP_IMAGE_TAG)
docker run -d --rm --name $(OVMS_CPP_DOCKER_IMAGE)-deps__$(OVMS_CPP_IMAGE_TAG) $(OVMS_CPP_DOCKER_IMAGE)-deps:$(OVMS_CPP_IMAGE_TAG)
cd tools/deps/$(BASE_OS) && docker build --build-arg http_proxy="$(http_proxy)" --build-arg https_proxy="$(https_proxy)" -t $(OVMS_CPP_DOCKER_IMAGE)-deps:$(OVMS_CPP_IMAGE_TAG) .
-docker rm -f ovms-$(BASE_OS)-deps
docker run -d --rm --name ovms-$(BASE_OS)-deps $(OVMS_CPP_DOCKER_IMAGE)-deps:$(OVMS_CPP_IMAGE_TAG)
sleep 5
docker cp $(OVMS_CPP_DOCKER_IMAGE)-deps__$(OVMS_CPP_IMAGE_TAG):/root/rpms.tar.xz ./
docker cp ovms-$(BASE_OS)-deps:/root/rpms.tar.xz ./
sleep 5
-docker rm -f $(OVMS_CPP_DOCKER_IMAGE)-deps__$(OVMS_CPP_IMAGE_TAG)
-docker rm -f ovms-$(BASE_OS)-deps
@echo "Success! Dependencies saved to rpms.tar.xz in this directory"
46 changes: 35 additions & 11 deletions release_files/Dockerfile.redhat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020 Intel Corporation
# Copyright (c) 2020-2021 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 Down Expand Up @@ -30,32 +30,56 @@ RUN groupadd --gid 5000 ovms && useradd --home-dir /home/ovms --create-home --ui
FROM registry.access.redhat.com/ubi8/ubi-minimal as release
ARG INSTALL_RPMS_FROM_URL=
ENV INSTALL_RPMS_FROM_URL=$INSTALL_RPMS_FROM_URL

ARG INSTALL_DRIVER_VERSION="19.41.14441"
ENV INSTALL_DRIVER_VERSION=$INSTALL_DRIVER_VERSION
ARG GPU=1
ENV GPU=$GPU
WORKDIR /

RUN set -e ; \
set -x ; \
if [ "$GPU" == "1" ] ; then \
mkdir /tmp/gpu_deps ; \
curl -L -o /tmp/gpu_deps/intel-igc-core-1.0.2597-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-igc-core-1.0.2597-1.el7.x86_64.rpm/download ; \
curl -L -o /tmp/gpu_deps/intel-opencl-19.41.14441-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-opencl-19.41.14441-1.el7.x86_64.rpm/download ; \
curl -L -o /tmp/gpu_deps/intel-igc-opencl-devel-1.0.2597-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-igc-opencl-devel-1.0.2597-1.el7.x86_64.rpm/download ; \
curl -L -o /tmp/gpu_deps/intel-igc-opencl-1.0.2597-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-igc-opencl-1.0.2597-1.el7.x86_64.rpm/download ; \
curl -L -o /tmp/gpu_deps/intel-gmmlib-19.3.2-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-gmmlib-19.3.2-1.el7.x86_64.rpm/download ; \
curl -L -o /tmp/gpu_deps/intel-gmmlib-devel-19.3.2-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-gmmlib-devel-19.3.2-1.el7.x86_64.rpm/download ; \
cd /tmp/gpu_deps && rpm -iv *.rpm && rm -Rf /tmp/gpu_deps ; \
microdnf install pkg-config; \
case $INSTALL_DRIVER_VERSION in \
"19.41.14441") \
mkdir /tmp/gpu_deps ; \
curl -L --output /tmp/gpu_deps/intel-igc-core-1.0.2597-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-igc-core-1.0.2597-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/intel-opencl-19.41.14441-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-opencl-19.41.14441-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/intel-igc-opencl-devel-1.0.2597-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-igc-opencl-devel-1.0.2597-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/intel-igc-opencl-1.0.2597-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-igc-opencl-1.0.2597-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/intel-gmmlib-19.3.2-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-gmmlib-19.3.2-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/intel-gmmlib-devel-19.3.2-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-gmmlib-devel-19.3.2-1.el7.x86_64.rpm/download ; \
cd /tmp/gpu_deps && rpm -iv *.rpm && rm -Rf /tmp/gpu_deps ; \
;; \
"20.35.17767") \
mkdir /tmp/gpu_deps ; \
curl -L --output /tmp/gpu_deps/intel-opencl-20.35.17767-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/20.35.17767/centos-7/intel-opencl-20.35.17767-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/level-zero-1.0.0-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/20.35.17767/centos-7/level-zero-1.0.0-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/level-zero-devel-1.0.0-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/20.35.17767/centos-7/level-zero-devel-1.0.0-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/intel-igc-opencl-1.0.4756-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/20.35.17767/centos-7/intel-igc-opencl-1.0.4756-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/intel-igc-opencl-devel-1.0.4756-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/20.35.17767/centos-7/intel-igc-opencl-devel-1.0.4756-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/intel-igc-core-1.0.4756-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/20.35.17767/centos-7/intel-igc-core-1.0.4756-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/intel-gmmlib-20.2.4-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/20.35.17767/centos-7/intel-gmmlib-20.2.4-1.el7.x86_64.rpm/download ; \
curl -L --output /tmp/gpu_deps/intel-gmmlib-devel-20.2.4-1.el7.x86_64.rpm https://sourceforge.net/projects/intel-compute-runtime/files/20.35.17767/centos-7/intel-gmmlib-devel-20.2.4-1.el7.x86_64.rpm/download ; \
cd /tmp/gpu_deps && rpm -iv *.rpm && rm -Rf /tmp/gpu_deps ; \
;; \
*) \
echo "ERROR: Unrecognized driver ${INSTALL_DRIVER_VERSION}." ; \
exit 1 ; \
esac ; \
fi ; \
if [ "$INSTALL_RPMS_FROM_URL" == "" ] ; then \
rpm -ivh http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/numactl-libs-2.0.12-11.el8.x86_64.rpm; \
rpm -ivh http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/numactl-2.0.12-11.el8.x86_64.rpm; \
rpm -ivh http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/ocl-icd-2.2.12-1.el8.x86_64.rpm; \
else \
microdnf install tar gzip; \
mkdir /tmp_ovms /src ; \
mkdir /tmp_ovms ; \
cd /tmp_ovms ; \
curl -L --fail -o deps.tar.xz "$INSTALL_RPMS_FROM_URL" ; \
tar -xf deps.tar.xz ; \
ls -Rahl . ; \
mv -v pkg/src/*.src.rpm /src/ ; \
rpm -vi pkg/bin/*.rpm ; \
cd / ; \
rm -rf /tmp_ovms ; \
Expand Down
11 changes: 7 additions & 4 deletions release_files/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020 Intel Corporation
# Copyright (c) 2020-2021 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 @@ -14,9 +14,12 @@
# limitations under the License.
#

.PHONY: centos
all: centos
.PHONY: centos redhat
all: centos redhat

centos:
docker build -f Dockerfile.centos -t ovms --build-arg http_proxy=$(http_proxy) --build-arg https_proxy="$(https_proxy)" .
docker build -f Dockerfile.centos -t ovms:centos --build-arg http_proxy=$(http_proxy) --build-arg https_proxy="$(https_proxy)" .

redhat:
docker build -f Dockerfile.redhat -t ovms:redhat --build-arg http_proxy=$(http_proxy) --build-arg https_proxy="$(https_proxy)" .

File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions tools/deps/redhat/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright (c) 2021 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.
#

FROM registry.access.redhat.com/ubi8/ubi:8.2 as rpmbuild

WORKDIR /root
COPY rpmbuild.sh /root/
RUN /root/rpmbuild.sh

FROM registry.access.redhat.com/ubi8/ubi:8.2

RUN mkdir /rpmbuild/
COPY --from=rpmbuild /ovms-rpmbuild-deps.tar.xz /rpmbuild/
COPY get.sh /
RUN /get.sh

ENTRYPOINT [ "sleep", "360" ]
39 changes: 39 additions & 0 deletions tools/deps/redhat/get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
#
# Copyright (c) 2021 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.
#

set -e
set -x

mkdir -vp /root/pkg/{src,bin,internal_src}

yum install -y xz pkg-config

cd /rpmbuild
tar -xf ovms-rpmbuild-deps.tar.xz
cp -v pkg/src/* /root/pkg/internal_src/
cp -v pkg/bin/* /root/pkg/bin/

cd /root/pkg/bin/
rpm -i *.rpm
cd ../

ls -lah ./src/
ls -lah ./internal_src/
ls -lah ./bin/

cd ..
tar cvzf rpms.tar.xz ./pkg
44 changes: 44 additions & 0 deletions tools/deps/redhat/rpmbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
#
# Copyright (c) 2021 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.
#

set -e
set -x

yum update -y
yum install -y ruby curl wget rpm-build autoconf automake gcc libtool make pkg-config

wget http://vault.centos.org/8.3.2011/PowerTools/Source/SPackages/opencl-headers-2.2-1.20180306gite986688.el8.src.rpm
wget http://vault.centos.org/8.3.2011/AppStream/Source/SPackages/ocl-icd-2.2.12-1.el8.src.rpm
wget http://vault.centos.org/8.3.2011/BaseOS/Source/SPackages/numactl-2.0.12-11.el8.src.rpm

mkdir -vp /pkg/{src,bin}
cp *.src.rpm /pkg/src

rpmbuild --rebuild opencl-headers*.src.rpm
rpm -i /root/rpmbuild/RPMS/noarch/opencl-headers-2.2-1*.rpm

rpmbuild --rebuild ocl-icd-*.src.rpm
rpm -i /root/rpmbuild/RPMS/x86_64/ocl-icd-*.rpm

rpmbuild --rebuild numactl-*.src.rpm
rpm -i /root/rpmbuild/RPMS/x86_64/numactl-*.rpm

cp -v /root/rpmbuild/RPMS/noarch/opencl-headers-2.2-1*.rpm /pkg/bin/
cp -v /root/rpmbuild/RPMS/x86_64/ocl-icd-2*.rpm /pkg/bin/
cp -v /root/rpmbuild/RPMS/x86_64/numactl*.rpm /pkg/bin/

tar cvJf /ovms-rpmbuild-deps.tar.xz /pkg

0 comments on commit ba1a500

Please sign in to comment.