Skip to content

Commit 8a8bfeb

Browse files
ppc64le yml dockefile
1 parent 4e170a0 commit 8a8bfeb

File tree

3 files changed

+54
-54
lines changed

3 files changed

+54
-54
lines changed

.github/scripts/ppc64le-build.sh

Whitespace-only changes.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Dockerfile.ppc64le
2+
FROM registry.access.redhat.com/ubi9/ubi:9.3
3+
4+
LABEL maintainer="Md. Shafi Hussain <[email protected]>"
5+
6+
# Install necessary dependencies
7+
RUN dnf install -y \
8+
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
9+
dnf install -y git cmake ninja-build gcc-c++ rust cargo \
10+
python39 python39-devel python39-wheel python39-pip python39-setuptools && \
11+
dnf clean all
12+
13+
# Link Python and pip to expected paths if not available
14+
RUN if ! command -v python; then ln -s $(command -v python3.9) /usr/bin/python; fi && \
15+
if ! command -v pip; then ln -s $(command -v pip3.9) /usr/bin/pip; fi
16+
17+
# Environment variables
18+
ENV PACKAGE_NAME=pytorch \
19+
PACKAGE_VERSION=v2.4.0 \
20+
PACKAGE_URL=https://github.com/pytorch/pytorch.git \
21+
_GLIBCXX_USE_CXX11_ABI=1
22+
23+
# Clone PyTorch repository and apply patch if necessary
24+
RUN git clone $PACKAGE_URL /workspace/$PACKAGE_NAME && \
25+
cd /workspace/$PACKAGE_NAME && \
26+
git checkout tags/$PACKAGE_VERSION && \
27+
PPC64LE_PATCH="69cbf05" && \
28+
if ! git log --pretty=format:"%H" | grep -q "$PPC64LE_PATCH"; then \
29+
git config user.email "[email protected]" && \
30+
git config user.name "Md. Shafi Hussain" && \
31+
git cherry-pick "$PPC64LE_PATCH"; \
32+
else \
33+
echo "POWER patch not needed."; \
34+
fi
35+
36+
# Set up submodules and install dependencies
37+
RUN cd /workspace/$PACKAGE_NAME && \
38+
git submodule sync && \
39+
git submodule update --init --recursive && \
40+
pip install -r requirements.txt
41+
42+
# Copy the build script to the container
43+
COPY .github/scripts/ppc64le-build.sh /workspace/.github/scripts/ppc64le-build.sh
44+
RUN chmod +x /workspace/.github/scripts/ppc64le-build.sh
45+
46+
# Default command
47+
CMD ["/workspace/.github/scripts/ppc64le-build.sh"]

.github/workflows/ppc64le.yml

Lines changed: 7 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -17,61 +17,14 @@ jobs:
1717
- name: Checkout repository
1818
uses: actions/checkout@v3
1919

20-
- name: Set up Python
21-
uses: actions/setup-python@v4
22-
with:
23-
python-version: 3.9 # Adjust if a different Python version is needed
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v2
2422

25-
- name: Install dependencies
23+
- name: Build Docker image for ppc64le
2624
run: |
27-
# Install EPEL release
28-
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
29-
30-
# Install development tools and libraries
31-
sudo dnf install -y git cmake ninja-build g++ rust cargo \
32-
python3.9-devel python3.9-wheel python3.9-pip python3.9-setuptools
33-
34-
# Ensure Python and pip are accessible by symlinking
35-
if ! command -v python; then
36-
sudo ln -s $(command -v python3.9) /usr/bin/python
37-
fi
38-
if ! command -v pip; then
39-
sudo ln -s $(command -v pip3.9) /usr/bin/pip
40-
fi
25+
docker build -f .github/workflows/Dockerfile.ppc64le -t pytorch-ppc64le:ubi9.3 .
4126
42-
- name: Clone and Checkout
27+
- name: Run Docker container and execute build script
4328
run: |
44-
# Clone the repository and check out the specified version
45-
git clone https://github.com/pytorch/pytorch.git
46-
cd pytorch
47-
git checkout tags/v2.4.0
48-
49-
- name: Apply POWER Patch
50-
run: |
51-
cd pytorch
52-
PPC64LE_PATCH="69cbf05"
53-
if ! git log --pretty=format:"%H" | grep -q "$PPC64LE_PATCH"; then
54-
echo "Applying POWER patch."
55-
git config user.email "[email protected]"
56-
git config user.name "Md. Shafi Hussain"
57-
git cherry-pick "$PPC64LE_PATCH"
58-
else
59-
echo "POWER patch not needed."
60-
fi
61-
62-
- name: Update submodules
63-
run: |
64-
cd pytorch
65-
git submodule sync
66-
git submodule update --init --recursive
67-
68-
- name: Install Python dependencies
69-
run: |
70-
cd pytorch
71-
pip install -r requirements.txt
72-
73-
- name: Build PyTorch wheel
74-
run: |
75-
cd pytorch
76-
MAX_JOBS=$(nproc) python setup.py bdist_wheel
77-
pip install dist/*.whl
29+
docker run --rm pytorch-ppc64le:ubi9.3 /workspace/.github/scripts/ppc64le-build.sh
30+

0 commit comments

Comments
 (0)