Skip to content

Commit

Permalink
Fix ROCm wheels CI pipeline break by installing latest protobuf from …
Browse files Browse the repository at this point in the history
…source (#9047)

* install protobuf from source

* fix rm command in Dockerfile

* fix options on rm command

* fix cd into protobuf source directory

* try again

* remove strip step

* debug list the files

* ls on /usr

* more debug

* more debug

* adjust LD_LIBRARY_PATH

* try remove protobuf before ORT build
  • Loading branch information
Suffian Khan authored and wangyems committed Sep 14, 2021
1 parent 3564cbf commit a68b4b3
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ stages:
--network=host --build-arg POLICY=manylinux2014 --build-arg PLATFORM=x86_64
--build-arg DEVTOOLSET_ROOTPATH=/opt/rh/devtoolset-10/root
--build-arg PREPEND_PATH=/opt/rh/devtoolset-10/root/usr/bin:
--build-arg LD_LIBRARY_PATH_ARG=/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib:/opt/rh/devtoolset-10/root/usr/lib64/dyninst:/opt/rh/devtoolset-10/root/usr/lib/dyninst:/usr/local/lib64
--build-arg LD_LIBRARY_PATH_ARG=/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib:/opt/rh/devtoolset-10/root/usr/lib64/dyninst:/opt/rh/devtoolset-10/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib
Repository: onnxruntimetrainingrocmbuild-torch1.8.1
- template: get-docker-image-steps.yml
parameters:
Expand All @@ -318,7 +318,7 @@ stages:
--network=host --build-arg POLICY=manylinux2014 --build-arg PLATFORM=x86_64
--build-arg DEVTOOLSET_ROOTPATH=/opt/rh/devtoolset-10/root
--build-arg PREPEND_PATH=/opt/rh/devtoolset-10/root/usr/bin:
--build-arg LD_LIBRARY_PATH_ARG=/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib:/opt/rh/devtoolset-10/root/usr/lib64/dyninst:/opt/rh/devtoolset-10/root/usr/lib/dyninst:/usr/local/lib64
--build-arg LD_LIBRARY_PATH_ARG=/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib:/opt/rh/devtoolset-10/root/usr/lib64/dyninst:/opt/rh/devtoolset-10/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib
Repository: onnxruntimetrainingrocmbuild-torch1.9.0

- job: ROCM_training_wheels
Expand Down
19 changes: 19 additions & 0 deletions tools/ci_build/github/linux/docker/Dockerfile.manylinux2014_rocm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ LABEL maintainer="The ManyLinux project"

RUN yum remove -y devtoolset\* git\* && conda remove -y cmake

# remove protobuf 2.6.1 from rocm/pytorch:rocm4.2_centos7_py3.6_pytorch
# it's too old to compile onnx 1.10
RUN rm -fr /usr/local/bin/protoc \
/usr/local/libproto* \
/usr/local/include/google \
/usr/local/lib/pkgconfig/protobuf*

ENV AUDITWHEEL_POLICY=${POLICY} AUDITWHEEL_ARCH=${PLATFORM} AUDITWHEEL_PLAT=${POLICY}_${PLATFORM}
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8
ENV DEVTOOLSET_ROOTPATH=${DEVTOOLSET_ROOTPATH}
Expand Down Expand Up @@ -70,6 +77,12 @@ RUN export LIBXCRYPT_VERSION=4.4.23 && \
export PERL_DOWNLOAD_URL=https://www.cpan.org/src/5.0 && \
manylinux-entrypoint /build_scripts/install-libxcrypt.sh

COPY build_scripts/install-protobuf.sh /build_scripts/
RUN export PROTOBUF_VERSION=3.17.3 && \
export PROTOBUF_ROOT=protobuf-all-${PROTOBUF_VERSION} && \
export PROTOBUF_HASH=77ad26d3f65222fd96ccc18b055632b0bfedf295cb748b712a98ba1ac0b704b2 && \
export PROTOBUF_DOWNLOAD_URL=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION} && \
manylinux-entrypoint /build_scripts/install-protobuf.sh

FROM runtime_base AS build_base
COPY build_scripts/install-build-packages.sh /build_scripts/
Expand Down Expand Up @@ -176,6 +189,12 @@ RUN cd /tmp/scripts && \
/tmp/scripts/install_python_deps.sh -d gpu -p 3.9 -h ${TORCH_VERSION} $INSTALL_DEPS_EXTRA_ARGS && \
rm -rf /tmp/scripts

# remove protobuf to prevent ambiguity which is used for onnxruntime build
RUN rm -fr /usr/local/bin/protoc \
/usr/local/libproto* \
/usr/local/include/google \
/usr/local/lib/pkgconfig/protobuf*

ARG BUILD_UID=1001
ARG BUILD_USER=onnxruntimedev
RUN adduser --uid $BUILD_UID $BUILD_USER
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# Top-level build script called from Dockerfile

# Stop at any error, show all commands
set -exuo pipefail

# Get script directory
MY_DIR=$(dirname "${BASH_SOURCE[0]}")

# Get build utilities
source $MY_DIR/build_utils.sh

# Install newest libtool
check_var ${PROTOBUF_ROOT}
check_var ${PROTOBUF_HASH}
check_var ${PROTOBUF_DOWNLOAD_URL}
fetch_source ${PROTOBUF_ROOT}.tar.gz ${PROTOBUF_DOWNLOAD_URL}
check_sha256sum ${PROTOBUF_ROOT}.tar.gz ${PROTOBUF_HASH}
tar -zxf ${PROTOBUF_ROOT}.tar.gz
pushd protobuf-${PROTOBUF_VERSION}
DESTDIR=/manylinux-rootfs do_standard_install
popd
rm -rf ${PROTOBUF_ROOT} ${PROTOBUF_ROOT}.tar.gz

# Strip what we can
strip_ /manylinux-rootfs

# Install
cp -rlf /manylinux-rootfs/* /

# Remove temporary rootfs
rm -rf /manylinux-rootfs

hash -r
protoc --version

0 comments on commit a68b4b3

Please sign in to comment.