Skip to content

Commit 915f7d3

Browse files
test5
1 parent 9c12479 commit 915f7d3

File tree

7 files changed

+38
-56
lines changed

7 files changed

+38
-56
lines changed

.ci/docker/manywheel/Dockerfile_ppc64le

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Use UBI 9.3 as base image
1+
# Use UBI 9 as base image
22
FROM registry.access.redhat.com/ubi9/ubi:9.5 AS base
33

44
# Install necessary dependencies
@@ -27,6 +27,6 @@ RUN pip install -r requirements.txt
2727
RUN mkdir -p /workspace/pytorch
2828

2929
ENTRYPOINT []
30-
CMD ["sleep", "infinity"]
30+
CMD ["/bin/bash"]
3131

3232

.github/scripts/ppc64le-build.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,12 @@ cd /workspace/$PACKAGE_NAME
88
# Clean up old artifacts
99
rm -rf build/ dist/ torch.egg-info/
1010

11-
# Set CPU-specific compilation flags
12-
export CMAKE_CXX_FLAGS="-mcpu=power9 -mtune=power9"
13-
export CMAKE_C_FLAGS="-mcpu=power9 -mtune=power9"
14-
export TORCH_CMAKE_ARGS="-DCMAKE_CXX_FLAGS='-mcpu=power9 -mtune=power9' -DCMAKE_C_FLAGS='-mcpu=power9 -mtune=power9'"
15-
16-
1711
# Build and install PyTorch wheel
1812
MAX_JOBS=$(nproc)
1913
python setup.py bdist_wheel 2>&1 | tee build_log.txt
2014

2115
if [ $? -ne 0 ]; then
22-
echo "Build failed! Check build_log.txt for details."
16+
echo "Build failed! Check build_log.txt for details."
2317
exit 1
2418
fi
2519

@@ -42,6 +36,6 @@ if ! pytest "$PACKAGE_NAME/test/test_utils.py"; then
4236

4337
else
4438
echo "------------------$PACKAGE_NAME:install_and_test_both_success-------------------------"
45-
echo "All tests passed successfully!"
39+
echo "All tests passed successfully!"
4640
exit 0
4741
fi

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

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

55
```
6-
Install Docker
6+
$ sudo dnf install podman podman-docker jq
77
```
8-
## Clone pytorch repository
9-
108
## Add services.
119

1210
```
1311
$ sudo cp self-hosted-builder/*.service /etc/systemd/system/
1412
$ sudo systemctl daemon-reload
1513
```
14+
15+
## Rebuild the image
16+
17+
First build s390x builder image `docker.io/pytorch/ubippc64le-builder`,
18+
using following commands:
19+
20+
```
21+
$ cd ~
22+
$ git clone https://github.com/pytorch/pytorch
23+
$ cd pytorch
24+
$ 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 ~/ubi-ppc64le.tar docker.io/pytorch/ubippc64le-builder:cpu-ppc64le
28+
```
29+
30+
1631
Next step is to build `actions-runner` image using:
1732

1833
```

.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 ubi-ppc64le.tar /opt/runner/ubi-ppc64le.tar
99+
COPY --chown=runner:runner pytorch-ubi-ppc64le.tar /opt/runner/pytorch-ubi-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 & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,21 @@
22

33
set -e -u
44

5-
trap cleanup EXIT
6-
75
# first import docker image
8-
if [ -f ./ubi-ppc64le.tar ] ; then
9-
docker image load --input ubi-ppc64le.tar
6+
if [ -f ./pytorch-ubi-ppc64le.tar ] ; then
7+
docker image load --input pytorch-ubi-ppc64le.tar
108
docker image tag docker.io/pytorch/ubippc64le-builder:cpu-ppc64le docker.io/pytorch/ubippc64le-builder:cpu-ppc64le-main
119
rm -f ubi-ppc64le.tar
1210
fi
1311

1412
token_file=registration-token.json
1513

16-
# Function to clean up and unregister the runner
17-
cleanup() {
18-
echo "Cleaning up temporary files..."
19-
[ -f "$token_file" ] && rm -f "$token_file"
20-
[ -f "runner-id.json" ] && rm -f "runner-id.json"
21-
22-
echo "Unregistering the runner from GitHub..."
23-
ACCESS_TOKEN="$(cat /run/runner_secret)"
24-
runner_id=$(curl -s \
25-
-H "Accept: application/vnd.github.v3+json" \
26-
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
27-
"https://api.github.com/repos/${OWNER}/${REPO}/actions/runners" | \
28-
jq --raw-output '.runners[] | select(.name=="'"${NAME}"'") | .id')
29-
30-
if [ -n "$runner_id" ]; then
31-
curl -s \
32-
-X DELETE \
33-
-H "Accept: application/vnd.github.v3+json" \
34-
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
35-
"https://api.github.com/repos/${OWNER}/${REPO}/actions/runners/$runner_id"
36-
echo "Runner unregistered successfully."
37-
else
38-
echo "Warning: Runner ID for ${NAME} not found. It may already be removed."
39-
fi
40-
41-
unset ACCESS_TOKEN runner_id
42-
}
43-
4414
# Fetch GitHub access token
4515
if [ ! -f /run/runner_secret ]; then
4616
echo "Error: Access token file not found at /run/runner_secret."
4717
exit 1
4818
fi
4919

50-
5120
ACCESS_TOKEN="$(cat /run/runner_secret)"
5221

5322
# Generate registration token
@@ -60,6 +29,8 @@ curl \
6029

6130
unset ACCESS_TOKEN
6231

32+
rm -f /run/runner_secret
33+
6334
# register runner as ephemeral runner
6435
# it does one job, stops and unregisters
6536
registration_token=$(jq --raw-output .token "$token_file")

.github/workflows/_linux-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,5 +363,5 @@ jobs:
363363
shell: bash
364364
run: |
365365
366-
docker ps -q | xargs -r docker stop
367-
docker ps -aq | xargs -r docker rm
366+
docker stop -a || true
367+
docker kill -a || true

.github/workflows/ppc64le.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,21 @@ concurrency:
1212

1313
jobs:
1414

15-
ppc64le-UBI-9-3-Build-and-Test:
16-
name: ppc64le-UBI-9-3-Build-and-Test
15+
ppc64le-UBI-9-Build-and-Test:
16+
name: ppc64le-UBI-9-Build-and-Test
1717
runs-on: linux.ppc64le
18+
env:
19+
IMAGE_NAME: docker.io/pytorch/ubippc64le-builder:cpu-ppc64le-main # Define the image variable
20+
1821
steps:
1922
- name: Checkout PyTorch
2023
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
21-
2224
with:
2325
no-sudo: true
2426

2527
- name: Execute Build and Tests inside ppc64le Docker Container
2628
run: |
27-
docker run --rm -v ${GITHUB_WORKSPACE}:/workspace/pytorch docker.io/pytorch/ubippc64le-builder:cpu-ppc64le-main /workspace/pytorch/.github/scripts/ppc64le-build.sh
29+
docker run --rm -v ${GITHUB_WORKSPACE}:/workspace/pytorch $IMAGE_NAME /workspace/pytorch/.github/scripts/ppc64le-build.sh
2830
2931
- name: Archive ppc64le artifacts into zip
3032
run: |
@@ -43,9 +45,9 @@ jobs:
4345
if: always()
4446
shell: bash
4547
run: |
46-
# on s390x stop the container for clean worker stop
47-
docker stop -a || true
48-
docker kill -a || true
48+
# Stop and remove all containers
49+
docker ps -q | xargs -r docker stop
50+
docker ps -aq | xargs -r docker rm
4951
5052

5153

0 commit comments

Comments
 (0)