Skip to content

Commit f0f819e

Browse files
added script to correct location
1 parent d7ebaf8 commit f0f819e

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
FROM --platform=linux/ppc64le docker.io/ubuntu:24.04 as base
2+
3+
# Language variables
4+
ENV LC_ALL=C.UTF-8
5+
ENV LANG=C.UTF-8
6+
ENV LANGUAGE=C.UTF-8
7+
8+
# Install needed OS packages (supports binary builds for torch, vision, audio, etc.)
9+
RUN apt update && apt upgrade -y && \
10+
apt install -y \
11+
build-essential \
12+
sudo \
13+
autoconf \
14+
automake \
15+
bzip2 \
16+
curl \
17+
diffutils \
18+
file \
19+
git \
20+
make \
21+
patch \
22+
perl \
23+
unzip \
24+
util-linux \
25+
wget \
26+
which \
27+
xz-utils \
28+
less \
29+
zstd \
30+
cmake \
31+
python3 \
32+
python3-dev \
33+
python3-setuptools \
34+
python3-yaml \
35+
python3-typing-extensions \
36+
libblas-dev \
37+
libopenblas-dev \
38+
liblapack-dev \
39+
libatlas-base-dev \
40+
linux-headers-generic \
41+
zlib1g-dev \
42+
libbz2-1.0 \
43+
libncurses5-dev \
44+
libsqlite3-dev \
45+
libdb-dev \
46+
libpcap-dev \
47+
liblzma-dev \
48+
libffi-dev || echo "Some packages could not be installed but are non-critical."
49+
50+
# Handle linux-headers installation gracefully
51+
RUN apt-get update && \
52+
(apt install -y linux-headers-$(uname -r) || apt install -y linux-headers-generic || \
53+
echo "Skipping linux-headers installation as it is not critical") && \
54+
apt-get clean && rm -rf /var/lib/apt/lists/*
55+
56+
RUN apt-get update && apt-get install -y software-properties-common && \
57+
add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get update
58+
59+
RUN apt-get install -y gcc-10 g++-10
60+
61+
# Confirm git installation and add safe.directory
62+
RUN git --version || (echo "Git installation failed!" && exit 1)
63+
RUN git config --global --add safe.directory "*"
64+
65+
# OpenSSL setup to ensure Python has SSL support
66+
FROM base as openssl
67+
# Set ulimit to avoid segmentation faults due to resource limits
68+
RUN ulimit -s unlimited
69+
70+
ADD ./common/install_openssl-ppc64le.sh install_openssl.sh
71+
RUN export CFLAGS="-O0" && \
72+
bash ./install_openssl.sh && rm install_openssl.sh
73+
ENV SSL_CERT_FILE=/opt/_internal/certs.pem
74+
75+
# EPEL for cmake
76+
FROM base as patchelf
77+
# Install patchelf
78+
ADD ./common/install_patchelf.sh install_patchelf.sh
79+
RUN bash ./install_patchelf.sh && rm install_patchelf.sh
80+
RUN cp $(which patchelf) /patchelf
81+
82+
# Python build stage
83+
FROM patchelf as python
84+
# Copy build scripts and install Python
85+
COPY manywheel/build_scripts /build_scripts
86+
ADD ./common/install_cpython.sh /build_scripts/install_cpython.sh
87+
RUN bash build_scripts/build.sh && rm -r build_scripts
88+
89+
# Final stage to copy over Python, OpenSSL, and patchelf
90+
FROM openssl as final
91+
COPY --from=python /opt/python /opt/python
92+
COPY --from=python /opt/_internal /opt/_internal
93+
COPY --from=python /opt/python/cp39-cp39/bin/auditwheel /usr/local/bin/auditwheel
94+
COPY --from=patchelf /usr/local/bin/patchelf /usr/local/bin/patchelf
95+
96+
# Optional: Clean up to reduce image size
97+
RUN rm -rf /var/lib/apt/lists/*
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
3+
# Environment variables
4+
PACKAGE_NAME=pytorch
5+
PACKAGE_VERSION=${PACKAGE_VERSION:-v2.4.0}
6+
7+
cd /workspace/$PACKAGE_NAME
8+
9+
# Build and install PyTorch wheel
10+
if ! (MAX_JOBS=4 python setup.py bdist_wheel && pip install dist/*.whl); then
11+
echo "------------------$PACKAGE_NAME:install_fails-------------------------------------"
12+
exit 1
13+
fi
14+
15+
# Basic test to ensure installation success
16+
17+
18+
19+
# register PrivateUse1HooksInterface
20+
python test/test_utils.py TestDeviceUtilsCPU.test_device_mode_ops_sparse_mm_reduce_cpu_bfloat16
21+
python test/test_utils.py TestDeviceUtilsCPU.test_device_mode_ops_sparse_mm_reduce_cpu_float16
22+
python test/test_utils.py TestDeviceUtilsCPU.test_device_mode_ops_sparse_mm_reduce_cpu_float32
23+
python test/test_utils.py TestDeviceUtilsCPU.test_device_mode_ops_sparse_mm_reduce_cpu_float64
24+
25+
cd ..
26+
pip install pytest pytest-xdist
27+
#if ! pytest -n $(nproc) -vvvv $PACKAGE_NAME/test/common_extended_utils.py $PACKAGE_NAME/test/common_utils.py $PACKAGE_NAME/test/smoke_test.py $PACKAGE_NAME/test/test_architecture_ops.py $PACKAGE_NAME/test/test_datasets_video_utils_opt.py $PACKAGE_NAME/test/test_tv_tensors.py; then
28+
# echo "------------------$PACKAGE_NAME:install_success_but_test_fails ###---------------------"
29+
# exit 0
30+
#fi
31+
echo "-----start test
32+
if ! pytest "$PACKAGE_NAME/test/test_utils.py"; then
33+
echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------"
34+
exit 2
35+
else
36+
echo "------------------$PACKAGE_NAME:install_and_test_both_success-------------------------"
37+
exit 0
38+
fi

0 commit comments

Comments
 (0)