Skip to content

Commit 2a16ed3

Browse files
Add builder for s390x (#1737)
It's based on aarch64, but bison and yasm are missing
1 parent e2bc5c2 commit 2a16ed3

8 files changed

+98
-0
lines changed

.github/workflows/build-manywheel-images.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,18 @@ jobs:
116116
- name: Build Docker Image
117117
run: |
118118
manywheel/build_docker.sh
119+
build-docker-cpu-s390x:
120+
runs-on: linux.s390x
121+
env:
122+
GPU_ARCH_TYPE: cpu-s390x
123+
steps:
124+
- name: Checkout PyTorch
125+
uses: actions/checkout@v3
126+
- name: Authenticate if WITH_PUSH
127+
run: |
128+
if [[ "${WITH_PUSH}" == true ]]; then
129+
echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_ID}" --password-stdin
130+
fi
131+
- name: Build Docker Image
132+
run: |
133+
manywheel/build_docker.sh

manywheel/Dockerfile_s390x

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
FROM --platform=linux/s390x docker.io/redhat/ubi9 as base
2+
3+
# earliest available version in ubi9
4+
ARG DEVTOOLSET_VERSION=12
5+
6+
# Language variabes
7+
ENV LC_ALL=en_US.UTF-8
8+
ENV LANG=en_US.UTF-8
9+
ENV LANGUAGE=en_US.UTF-8
10+
11+
# Installed needed OS packages. This is to support all
12+
# the binary builds (torch, vision, audio, text, data)
13+
RUN dnf -y install redhat-release
14+
RUN dnf -y update
15+
RUN dnf install -y --allowerasing \
16+
autoconf \
17+
automake \
18+
bzip2 \
19+
curl \
20+
diffutils \
21+
file \
22+
git \
23+
make \
24+
patch \
25+
perl \
26+
unzip \
27+
util-linux \
28+
wget \
29+
which \
30+
xz \
31+
less \
32+
zstd \
33+
libgomp \
34+
cmake \
35+
gcc-toolset-${DEVTOOLSET_VERSION}-gcc \
36+
gcc-toolset-${DEVTOOLSET_VERSION}-gcc-c++ \
37+
gcc-toolset-${DEVTOOLSET_VERSION}-gcc-gfortran \
38+
gcc-toolset-${DEVTOOLSET_VERSION}-binutils
39+
40+
# Ensure the expected gcc-toolset is used
41+
ENV PATH=/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/bin:$PATH
42+
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
43+
44+
45+
# git236+ would refuse to run git commands in repos owned by other users
46+
# Which causes version check to fail, as pytorch repo is bind-mounted into the image
47+
# Override this behaviour by treating every folder as safe
48+
# For more details see https://github.com/pytorch/pytorch/issues/78659#issuecomment-1144107327
49+
RUN git config --global --add safe.directory "*"
50+
51+
FROM base as openssl
52+
# Install openssl (this must precede `build python` step)
53+
# (In order to have a proper SSL module, Python is compiled
54+
# against a recent openssl [see env vars above], which is linked
55+
# statically. We delete openssl afterwards.)
56+
ADD ./common/install_openssl.sh install_openssl.sh
57+
RUN bash ./install_openssl.sh && rm install_openssl.sh
58+
ENV SSL_CERT_FILE=/opt/_internal/certs.pem
59+
60+
FROM openssl as final
61+
# remove unncessary python versions
62+
RUN rm -rf /opt/python/cp26-cp26m /opt/_internal/cpython-2.6.9-ucs2
63+
RUN rm -rf /opt/python/cp26-cp26mu /opt/_internal/cpython-2.6.9-ucs4
64+
RUN rm -rf /opt/python/cp33-cp33m /opt/_internal/cpython-3.3.6
65+
RUN rm -rf /opt/python/cp34-cp34m /opt/_internal/cpython-3.4.6

manywheel/build_all_docker.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ MANYLINUX_VERSION=2014 GPU_ARCH_TYPE=cpu "${TOPDIR}/manywheel/build_docker.sh"
99

1010
GPU_ARCH_TYPE=cpu-aarch64 "${TOPDIR}/manywheel/build_docker.sh"
1111

12+
GPU_ARCH_TYPE=cpu-s390x "${TOPDIR}/manywheel/build_docker.sh"
13+
1214
GPU_ARCH_TYPE=cpu-cxx11-abi "${TOPDIR}/manywheel/build_docker.sh"
1315

1416
for cuda_version in 12.1 11.8; do

manywheel/build_common.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ retry () {
2525
OS_NAME=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
2626
if [[ "$OS_NAME" == *"CentOS Linux"* ]]; then
2727
retry yum install -q -y zip openssl
28+
elif [[ "$OS_NAME" == *"Red Hat Enterprise Linux"* ]]; then
29+
retry dnf install -q -y zip openssl
2830
elif [[ "$OS_NAME" == *"Ubuntu"* ]]; then
2931
# TODO: Remove this once nvidia package repos are back online
3032
# Comment out nvidia repositories to prevent them from getting apt-get updated, see https://github.com/pytorch/pytorch/issues/74968

manywheel/build_cpu.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ mkdir -p "$PYTORCH_FINAL_PACKAGE_DIR" || true
2929
OS_NAME=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
3030
if [[ "$OS_NAME" == *"CentOS Linux"* ]]; then
3131
LIBGOMP_PATH="/usr/lib64/libgomp.so.1"
32+
elif [[ "$OS_NAME" == *"Red Hat Enterprise Linux"* ]]; then
33+
LIBGOMP_PATH="/usr/lib64/libgomp.so.1"
3234
elif [[ "$OS_NAME" == *"Ubuntu"* ]]; then
3335
LIBGOMP_PATH="/usr/lib/x86_64-linux-gnu/libgomp.so.1"
3436
fi

manywheel/build_cuda.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ mkdir -p "$PYTORCH_FINAL_PACKAGE_DIR" || true
109109
OS_NAME=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
110110
if [[ "$OS_NAME" == *"CentOS Linux"* ]]; then
111111
LIBGOMP_PATH="/usr/lib64/libgomp.so.1"
112+
elif [[ "$OS_NAME" == *"Red Hat Enterprise Linux"* ]]; then
113+
LIBGOMP_PATH="/usr/lib64/libgomp.so.1"
112114
elif [[ "$OS_NAME" == *"Ubuntu"* ]]; then
113115
LIBGOMP_PATH="/usr/lib/x86_64-linux-gnu/libgomp.so.1"
114116
fi

manywheel/build_docker.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ case ${GPU_ARCH_TYPE} in
3636
DOCKER_GPU_BUILD_ARG=" --build-arg DEVTOOLSET_VERSION=9"
3737
MANY_LINUX_VERSION="cxx11-abi"
3838
;;
39+
cpu-s390x)
40+
TARGET=final
41+
DOCKER_TAG=cpu-s390x
42+
LEGACY_DOCKER_IMAGE=${DOCKER_REGISTRY}/pytorch/manylinux-cpu-s390x
43+
GPU_IMAGE=redhat/ubi9
44+
DOCKER_GPU_BUILD_ARG=""
45+
MANY_LINUX_VERSION="s390x"
46+
;;
3947
cuda)
4048
TARGET=cuda_final
4149
DOCKER_TAG=cuda${GPU_ARCH_VERSION}

manywheel/build_libtorch.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ retry () {
2424
OS_NAME=`awk -F= '/^NAME/{print $2}' /etc/os-release`
2525
if [[ "$OS_NAME" == *"CentOS Linux"* ]]; then
2626
retry yum install -q -y zip openssl
27+
elif [[ "$OS_NAME" == *"Red Hat Enterprise Linux"* ]]; then
28+
retry dnf install -q -y zip openssl
2729
elif [[ "$OS_NAME" == *"Ubuntu"* ]]; then
2830
# TODO: Remove this once nvidia package repos are back online
2931
# Comment out nvidia repositories to prevent them from getting apt-get updated, see https://github.com/pytorch/pytorch/issues/74968

0 commit comments

Comments
 (0)