1- # Use the manylinux_2_28 base image for ppc64le
21FROM quay.io/pypa/manylinux_2_28_ppc64le as base
32
43# Language variables
54ENV LC_ALL=C.UTF-8
65ENV LANG=C.UTF-8
76ENV LANGUAGE=C.UTF-8
87
8+ # there is a bugfix in gcc >= 14 for precompiled headers and s390x vectorization interaction.
9+ # with earlier gcc versions test/inductor/test_cpu_cpp_wrapper.py will fail.
910ARG DEVTOOLSET_VERSION=14
11+ # Installed needed OS packages. This is to support all
12+ # the binary builds (torch, vision, audio, text, data)
13+ RUN yum -y install epel-release
14+ RUN yum -y update
15+ RUN yum install -y \
16+ sudo \
17+ autoconf \
18+ automake \
19+ bison \
20+ bzip2 \
21+ curl \
22+ diffutils \
23+ file \
24+ git \
25+ make \
26+ patch \
27+ perl \
28+ unzip \
29+ util-linux \
30+ wget \
31+ which \
32+ xz \
33+ yasm \
34+ less \
35+ zstd \
36+ libgomp \
37+ gcc-toolset-${DEVTOOLSET_VERSION}-gcc \
38+ gcc-toolset-${DEVTOOLSET_VERSION}-gcc-c++ \
39+ gcc-toolset-${DEVTOOLSET_VERSION}-binutils \
40+ gcc-toolset-${DEVTOOLSET_VERSION}-gcc-gfortran \
41+ cmake \
42+ rust \
43+ cargo \
44+ llvm-devel \
45+ libzstd-devel \
46+ python3.12-devel \
47+ python3.12-test \
48+ python3.12-setuptools \
49+ python3.12-pip \
50+ python3-virtualenv \
51+ python3.12-pyyaml \
52+ python3.12-numpy \
53+ python3.12-wheel \
54+ python3.12-cryptography \
55+ blas-devel \
56+ openblas-devel \
57+ lapack-devel \
58+ atlas-devel \
59+ libjpeg-devel \
60+ libxslt-devel \
61+ libxml2-devel \
62+ openssl-devel \
63+ valgrind \
64+ ninja-build
1065
11- # Create symbolic links for Python 3.12
12- #RUN ln -sf /opt/python/cp312-cp312/bin/python3.12 /usr/bin/python3 && \
13- # ln -sf /opt/python/cp312-cp312/bin/python3.12 /usr/bin/python
14-
15- # Install required system dependencies
16- RUN yum -y install epel-release && \
17- yum -y update && \
18- yum install -y \
19- sudo \
20- autoconf \
21- automake \
22- bison \
23- bzip2 \
24- curl \
25- diffutils \
26- file \
27- git \
28- make \
29- patch \
30- perl \
31- unzip \
32- util-linux \
33- wget \
34- which \
35- xz \
36- yasm \
37- less \
38- zstd \
39- libgomp \
40- gcc-toolset-${DEVTOOLSET_VERSION}-gcc \
41- gcc-toolset-${DEVTOOLSET_VERSION}-gcc-c++ \
42- gcc-toolset-${DEVTOOLSET_VERSION}-binutils \
43- gcc-toolset-${DEVTOOLSET_VERSION}-gcc-gfortran \
44- cmake \
45- ninja-build \
46- rust \
47- cargo \
48- llvm-devel \
49- libzstd-devel \
50- python3.12-devel \
51- python3.12-setuptools \
52- python3.12-pip \
53- python3-virtualenv \
54- python3.12-numpy \
55- python3.12-wheel \
56- python3.12-cryptography \
57- blas-devel \
58- openblas-devel \
59- lapack-devel \
60- atlas-devel \
61- libjpeg-devel \
62- libxslt-devel \
63- libxml2-devel \
64- openssl-devel \
65- valgrind
66-
67-
68- # Ensure the correct Python version is used
69- #ENV PATH=/opt/python/cp312-cp312/bin:$PATH
70- # Add gcc-toolset to the path
7166ENV PATH=/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/bin:$PATH
7267ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/lib64:/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/lib:$LD_LIBRARY_PATH
7368
74- # Configure git to avoid safe directory issues
69+ # git236+ would refuse to run git commands in repos owned by other users
70+ # Which causes version check to fail, as pytorch repo is bind-mounted into the image
71+ # Override this behaviour by treating every folder as safe
72+ # For more details see https://github.com/pytorch/pytorch/issues/78659#issuecomment-1144107327
7573RUN git config --global --add safe.directory "*"
7674
7775# installed python doesn't have development parts. Rebuild it from scratch
7876RUN /bin/rm -rf /opt/_internal /opt/python /usr/local/*/*
7977
8078# EPEL for cmake
8179FROM base as patchelf
82-
83- # Instead of ADD ./common/install_cpython.sh ...
84- RUN git clone --depth 1 --branch temp-gha-runner-v2 https://github.com/sandeepgupta12/pytorch.git /tmp/pytorch && \
80+ RUN git clone --depth 1 --branch temp-gha-runner-v3 https://github.com/sandeepgupta12/pytorch.git /tmp/pytorch && \
8581 cp /tmp/pytorch/.ci/docker/common/install_patchelf.sh /build_scripts/install_patchelf.sh
8682# Install patchelf
87- # ADD ./common/install_patchelf.sh install_patchelf.sh
83+ #ADD ./common/install_patchelf.sh install_patchelf.sh
8884#RUN bash ./install_patchelf.sh && rm install_patchelf.sh
89- #ENV CPYTHON_VERSIONS="3.10.1"
90- #RUN echo "CPYTHON_VERSIONS=$CPYTHON_VERSIONS" && bash -x /build_scripts/install_cpython.sh
91- #ENV SSL_CERT_FILE=""
92- #RUN curl -fL https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
9385RUN bash /build_scripts/install_patchelf.sh && rm -r /build_scripts
9486RUN cp $(which patchelf) /patchelf
9587
9688FROM patchelf as python
97-
89+ # build python
9890# Clone only required scripts from the PyTorch repo
9991RUN mkdir -p /build_scripts && \
10092 cp -r /tmp/pytorch/.ci/docker/manywheel/build_scripts/* /build_scripts/ && \
10193 cp /tmp/pytorch/.ci/docker/common/install_cpython.sh /build_scripts/install_cpython.sh && \
10294 rm -rf /tmp/pytorch
103- # build python
10495#COPY manywheel/build_scripts /build_scripts
10596#ADD ./common/install_cpython.sh /build_scripts/install_cpython.sh
10697ENV SSL_CERT_FILE=
107- # # Run the build script
108- RUN bash /build_scripts/build.sh && rm -r /build_scripts
10998#RUN bash build_scripts/build.sh && rm -r build_scripts
110- #RUN bash build_scripts/build.sh || (echo "Checksum verification failed!" && exit 1)
111-
112-
99+ RUN bash /build_scripts/build.sh && rm -r /build_scripts
113100
114101FROM base as final
115102COPY --from=python /opt/python /opt/python
@@ -120,32 +107,20 @@ COPY --from=patchelf /usr/local/bin/patchelf /usr/local/
120107RUN alternatives --set python /usr/bin/python3.12
121108RUN alternatives --set python3 /usr/bin/python3.12
122109
123- RUN /opt/python/cp312-cp312/bin/python3.12 -m ensurepip && \
124- /opt/python/cp312-cp312/bin/python3.12 -m pip install --upgrade pip setuptools wheel
110+ RUN pip-3.12 install typing_extensions
125111
126- # Use pip-3.12 to install clean versions of needed packages (avoid yum-installed PyYAML)
127- RUN pip-3.12 install --no-cache-dir \
128- typing_extensions \
129- pyyaml==6.0.2 \
130- requests==2.27.1
131-
132- #RUN pip-3.12 install typing_extensions
112+ ENTRYPOINT []
113+ CMD ["/bin/bash"]
133114
134- # Install required Python packages
135- #RUN pip install --upgrade pip
136- # RUN pip-3.12 install typing_extensions pyyaml setuptools
137-
138- # Install test dependencies
115+ # install test dependencies:
116+ # - grpcio requires system openssl, bundled crypto fails to build
139117RUN dnf install -y \
140- protobuf-devel \
141- protobuf-c-devel \
142- protobuf-lite-devel \
143- wget \
144- patch
118+ hdf5-devel \
119+ python3-h5py \
120+ git
121+
145122
146- # Set default entrypoint
147- ENTRYPOINT []
148- CMD ["/bin/bash"]
123+ #RUN env GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=True pip3 install grpcio
149124
150125# cmake-3.28.0 from pip for onnxruntime
151- RUN python3 -m pip install cmake==3.28.0
126+ RUN python3 -mpip install cmake==3.28.0
0 commit comments