Skip to content

Commit 5929e1f

Browse files
Reuse _linux-build.yml for ppc64le build and updated other files accordingly
1 parent f93aae3 commit 5929e1f

File tree

9 files changed

+150
-129
lines changed

9 files changed

+150
-129
lines changed
Lines changed: 84 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,92 @@
1-
# Use UBI 9 as base image
2-
FROM registry.access.redhat.com/ubi9/ubi:9.5 AS base
1+
# Use the manylinux_2_28 base image for ppc64le
2+
FROM quay.io/pypa/manylinux_2_28_ppc64le as base
33

4-
# Install necessary dependencies
5-
RUN dnf install -y \
6-
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
7-
dnf install -y git cmake ninja-build gcc-toolset-13 rust cargo zip \
8-
python3 python3-devel && \
9-
dnf clean all
4+
# Language variables
5+
ENV LC_ALL=C.UTF-8
6+
ENV LANG=C.UTF-8
7+
ENV LANGUAGE=C.UTF-8
108

11-
ENV PATH="/opt/rh/gcc-toolset-13/root/usr/bin:$PATH"
12-
ENV MANPATH="/opt/rh/gcc-toolset-13/root/usr/share/man"
13-
ENV INFOPATH="/opt/rh/gcc-toolset-13/root/usr/share/info"
14-
ENV PCP_DIR="/opt/rh/gcc-toolset-13/root"
15-
ENV LD_LIBRARY_PATH="/opt/rh/gcc-toolset-13/root/usr/lib64:/opt/rh/gcc-toolset-13/root/usr/lib"
9+
ARG DEVTOOLSET_VERSION=13
1610

17-
# Set Python and pip aliases to use Python 3.9
18-
RUN ln -sf /usr/bin/python3 /usr/bin/python && \
19-
ln -sf /usr/bin/pip3 /usr/bin/pip
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
2014

21-
COPY requirements.txt .
22-
# Install Python packages via pip
23-
RUN pip install wheel
24-
RUN pip install -r requirements.txt
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-pyyaml \
55+
python3.12-numpy \
56+
python3.12-wheel \
57+
python3.12-cryptography \
58+
blas-devel \
59+
openblas-devel \
60+
lapack-devel \
61+
atlas-devel \
62+
libjpeg-devel \
63+
libxslt-devel \
64+
libxml2-devel \
65+
openssl-devel \
66+
valgrind
67+
2568

26-
RUN mkdir -p /workspace/pytorch
69+
# Ensure the correct Python version is used
70+
ENV PATH=/opt/python/cp312-cp312/bin:$PATH
71+
# Add gcc-toolset to the path
72+
ENV PATH=/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/bin:$PATH
73+
ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/lib64:/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/lib:$LD_LIBRARY_PATH
2774

28-
ENTRYPOINT []
29-
CMD ["/bin/bash"]
75+
# Configure git to avoid safe directory issues
76+
RUN git config --global --add safe.directory "*"
3077

78+
# Install required Python packages
79+
RUN pip install --upgrade pip
80+
RUN pip install typing_extensions pyyaml setuptools
81+
82+
# Install test dependencies
83+
RUN dnf install -y \
84+
protobuf-devel \
85+
protobuf-c-devel \
86+
protobuf-lite-devel \
87+
wget \
88+
patch
3189

90+
# Set default entrypoint
91+
ENTRYPOINT []
92+
CMD ["/bin/bash"]

.ci/docker/manywheel/build_scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ AUTOCONF_HASH=954bd69b391edc12d6a4a51a2dd1476543da5c6bbf05a95b59dc0dd6fd4c2969
2020
# the final image after compiling Python
2121
PYTHON_COMPILE_DEPS="zlib-devel bzip2-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel libpcap-devel xz-devel libffi-devel"
2222

23-
if [ "$(uname -m)" != "s390x" ] ; then
23+
if [ "$(uname -m)" != "s390x" && "$(uname -m)" != "ppc64le" ] ; then
2424
PYTHON_COMPILE_DEPS="${PYTHON_COMPILE_DEPS} db4-devel"
2525
else
2626
PYTHON_COMPILE_DEPS="${PYTHON_COMPILE_DEPS} libdb-devel"

.ci/pytorch/build.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ fi
230230

231231
# Do not change workspace permissions for ROCm and s390x CI jobs
232232
# as it can leave workspace with bad permissions for cancelled jobs
233-
if [[ "$BUILD_ENVIRONMENT" != *rocm* && "$BUILD_ENVIRONMENT" != *s390x* && -d /var/lib/jenkins/workspace ]]; then
233+
if [[ "$BUILD_ENVIRONMENT" != *rocm* && "$BUILD_ENVIRONMENT" != *s390x* && "$BUILD_ENVIRONMENT" != *ppc64le* && -d /var/lib/jenkins/workspace ]]; then
234234
# Workaround for dind-rootless userid mapping (https://github.com/pytorch/ci-infra/issues/96)
235235
WORKSPACE_ORIGINAL_OWNER_ID=$(stat -c '%u' "/var/lib/jenkins/workspace")
236236
cleanup_workspace() {
@@ -274,8 +274,10 @@ else
274274
# XLA test build fails when WERROR=1
275275
# set only when building other architectures
276276
# or building non-XLA tests.
277+
# ppc64le builds fail when WERROR=1
277278
if [[ "$BUILD_ENVIRONMENT" != *rocm* &&
278-
"$BUILD_ENVIRONMENT" != *xla* ]]; then
279+
"$BUILD_ENVIRONMENT" != *xla* &&
280+
"$BUILD_ENVIRONMENT" != *ppc64le* ]]; then
279281
if [[ "$BUILD_ENVIRONMENT" != *py3.8* ]]; then
280282
# Install numpy-2.0.2 for builds which are backward compatible with 1.X
281283
python -mpip install numpy==2.0.2
@@ -396,6 +398,6 @@ if [[ "$BUILD_ENVIRONMENT" != *libtorch* && "$BUILD_ENVIRONMENT" != *bazel* ]];
396398
python tools/stats/export_test_times.py
397399
fi
398400
# don't do this for bazel or s390x as they don't use sccache
399-
if [[ "$BUILD_ENVIRONMENT" != *s390x* && "$BUILD_ENVIRONMENT" != *-bazel-* ]]; then
401+
if [[ "$BUILD_ENVIRONMENT" != *s390x* && "$BUILD_ENVIRONMENT" != *ppc64le* && "$BUILD_ENVIRONMENT" != *-bazel-* ]]; then
400402
print_sccache_stats
401403
fi

.github/scripts/ppc64le-build.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/scripts/ppc64le-ci/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Install prerequisites.
44

55
```
6-
$ sudo dnf install podman podman-docker jq
6+
$ sudo apt install podman podman-docker jq
77
```
88
## Add services.
99

@@ -14,17 +14,17 @@ $ sudo systemctl daemon-reload
1414

1515
## Rebuild the image
1616

17-
First build ppc64le builder image `docker.io/pytorch/ubippc64le-builder`,
17+
First build ppc64le builder image `docker.io/pytorch/manylinuxppc64le-builder`,
1818
using following commands:
1919

2020
```
2121
$ cd ~
2222
$ git clone https://github.com/pytorch/pytorch
2323
$ cd pytorch
2424
$ git submodule update --init --recursive
25-
$ GPU_ARCH_TYPE=cpu-ppc64le "$(pwd)/.ci/docker/manywheel/build.sh" ubippc64le-builder
26-
$ docker image tag localhost/pytorch/ubippc64le-builder docker.io/pytorch/ubippc64le-builder:cpu-ppc64le
27-
$ docker image save -o ~/pytorch-ubi-ppc64le.tar docker.io/pytorch/ubippc64le-builder:cpu-ppc64le
25+
$ GPU_ARCH_TYPE=cpu-ppc64le "$(pwd)/.ci/docker/manywheel/build.sh" manylinuxppc64le-builder
26+
$ docker image tag localhost/pytorch/manylinuxppc64le-builder docker.io/pytorch/manylinuxppc64le-builder:cpu-ppc64le
27+
$ docker image save -o ~/manywheel-ppc64le.tar docker.io/pytorch/manylinuxppc64le-builder:cpu-ppc64le
2828
```
2929

3030
Next step is to build `actions-runner` image using:
@@ -60,4 +60,4 @@ $ sudo chmod 755 /usr/local/bin/app_token.sh /usr/local/bin/gh_token_generator.s
6060

6161
```
6262
$ sudo systemctl enable --now actions-runner@$NAME
63-
```
63+
```

.github/scripts/ppc64le-ci/self-hosted-builder/actions-runner.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ USER runner
9696
# Set working directory
9797
WORKDIR /opt/runner
9898

99-
COPY --chown=runner:runner pytorch-ubi-ppc64le.tar /opt/runner/pytorch-ubi-ppc64le.tar
99+
COPY --chown=runner:runner manywheel-ppc64le.tar /opt/runner/manywheel-ppc64le.tar
100100

101101
# Define entry point and command
102102
ENTRYPOINT ["/usr/bin/entrypoint"]

.github/scripts/ppc64le-ci/self-hosted-builder/fs/usr/bin/actions-runner

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
set -e -u
44

55
# first import docker image
6-
if [ -f ./pytorch-ubi-ppc64le.tar ] ; then
7-
docker image load --input pytorch-ubi-ppc64le.tar
8-
docker image tag docker.io/pytorch/ubippc64le-builder:cpu-ppc64le docker.io/pytorch/ubippc64le-builder:cpu-ppc64le-main
9-
rm -f ubi-ppc64le.tar
6+
if [ -f ./manywheel-ppc64le.tar ] ; then
7+
docker image load --input manywheel-ppc64le.tar
8+
docker image tag docker.io/pytorch/manylinuxppc64le-builder:cpu-ppc64le docker.io/pytorch/manylinuxppc64le-builder:cpu-ppc64le-main
9+
rm -f manywheel-ppc64le.tar
1010
fi
1111

1212
token_file=registration-token.json

0 commit comments

Comments
 (0)