Skip to content

Commit 3ccfc11

Browse files
committed
[CI] Add CI for pytorch2.8
1 parent f6ada1f commit 3ccfc11

5 files changed

Lines changed: 143 additions & 5 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Docker Base Image CI (PyTorch 2.8)
2+
3+
on:
4+
push:
5+
branches: [ "base" ]
6+
workflow_dispatch:
7+
repository_dispatch:
8+
types: [ build_base ]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- name: Checkout Code
20+
uses: actions/checkout@v4
21+
22+
- name: Log in to GitHub Container Registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Set environment
30+
env:
31+
GIT_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
if [ -n "${{ github.event.pull_request.head.sha }}" ]; then
34+
echo "GITHUB_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
35+
echo "GITHUB_SHA=${{ github.event.pull_request.head.sha }}"
36+
else
37+
echo "GITHUB_SHA=${{ github.sha }}" >> $GITHUB_ENV
38+
echo "GITHUB_SHA=${{ github.sha }}"
39+
fi
40+
41+
gem5_response_file=/tmp/releases-gem5-latest.json
42+
curl -s https://api.github.com/repos/PSAL-POSTECH/GEM5/releases/latest > ${gem5_response_file}
43+
GEM5_ASSET_ID=$(jq ".assets[0].id" ${gem5_response_file})
44+
echo "GEM5_ASSET_ID=$GEM5_ASSET_ID"
45+
echo "GEM5_ASSET_ID=$GEM5_ASSET_ID" >> $GITHUB_ENV
46+
47+
llvm_response_file=/tmp/releases-gem5-latest.json
48+
curl -s https://api.github.com/repos/PSAL-POSTECH/llvm-project/releases/latest > ${llvm_response_file}
49+
LLVM_ASSET_ID=$(jq ".assets[0].id" ${llvm_response_file})
50+
echo "LLVM_ASSET_ID=$LLVM_ASSET_ID"
51+
echo "LLVM_ASSET_ID=$LLVM_ASSET_ID" >> $GITHUB_ENV
52+
53+
spike_response_file=/tmp/releases-spike-latest.json
54+
curl -s https://api.github.com/repos/PSAL-POSTECH/riscv-isa-sim/releases/latest > ${spike_response_file}
55+
SPIKE_ASSET_ID=$(jq ".assets[0].id" ${spike_response_file})
56+
echo "SPIKE_ASSET_ID=$SPIKE_ASSET_ID"
57+
echo "SPIKE_ASSET_ID=$SPIKE_ASSET_ID" >> $GITHUB_ENV
58+
59+
- name: Build and Push Docker Image (PyTorch 2.8)
60+
uses: docker/build-push-action@v4
61+
with:
62+
context: .
63+
file: ./Dockerfile.base
64+
push: true
65+
build-args: |
66+
PYTORCH_IMAGE=pytorch/pytorch:2.8.0-cuda12.6-cudnn9-runtime
67+
GEM5_ASSET_ID=${{ env.GEM5_ASSET_ID }}
68+
LLVM_ASSET_ID=${{ env.LLVM_ASSET_ID }}
69+
SPIKE_ASSET_ID=${{ env.SPIKE_ASSET_ID }}
70+
tags: |
71+
ghcr.io/psal-postech/torchsim_base_2_8:latest

.github/workflows/docker-base-image.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ jobs:
3232
env:
3333
GIT_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3434
run: |
35-
echo "IMAGE_TAG=torchsim-ci:${GITHUB_SHA}" >> $GITHUB_ENV
36-
echo "GITHUB_SHA=${{github.event.pull_request.head.sha}}" >> $GITHUB_ENV
37-
echo "GITHUB_SHA=${{github.event.pull_request.head.sha}}"
35+
if [ -n "${{ github.event.pull_request.head.sha }}" ]; then
36+
echo "GITHUB_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
37+
echo "GITHUB_SHA=${{ github.event.pull_request.head.sha }}"
38+
else
39+
echo "GITHUB_SHA=${{ github.sha }}" >> $GITHUB_ENV
40+
echo "GITHUB_SHA=${{ github.sha }}"
41+
fi
3842
3943
gem5_response_file=/tmp/releases-gem5-latest.json
4044
curl -s https://api.github.com/repos/PSAL-POSTECH/GEM5/releases/latest > ${gem5_response_file}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Docker image CI (PyTorch 2.8)
2+
3+
on:
4+
pull_request:
5+
branches: [ "torch_v2.8" ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-test:
10+
runs-on: self-hosted
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
steps:
17+
- name: Checkout Code
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.event.pull_request.head.sha }}
21+
submodules: recursive
22+
23+
- name: Login to GHCR
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Build and Push Docker Image (PyTorch 2.8)
31+
uses: docker/build-push-action@v6
32+
with:
33+
context: .
34+
file: ./Dockerfile
35+
push: true
36+
no-cache: true
37+
build-args: |
38+
BASE_IMAGE=ghcr.io/psal-postech/torchsim_base_2_8:latest
39+
tags: ghcr.io/psal-postech/torchsim-test-2-8:${{ github.sha }}
40+
41+
- name: Wait for GHCR propagation
42+
run: |
43+
for i in {1..30}; do
44+
echo "Checking if image exists in GHCR (attempt $i)..."
45+
if docker manifest inspect ghcr.io/psal-postech/torchsim-test-2-8:${GITHUB_SHA} > /dev/null 2>&1; then
46+
echo "Image is now available in GHCR."
47+
exit 0
48+
fi
49+
echo "Image not yet available, retrying in 30 seconds..."
50+
sleep 20
51+
done
52+
echo "Image did not become available in GHCR within expected time."
53+
exit 1
54+
55+
test-pytorchsim-wrapper:
56+
needs: build-and-test
57+
uses: ./.github/workflows/pytorchsim_test.yml
58+
with:
59+
image_name: ghcr.io/psal-postech/torchsim-test-2-8:${{ github.sha }}
60+
vector_lane: 128
61+
spad_size: 128

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# syntax=docker/dockerfile:1.4
2-
FROM ghcr.io/psal-postech/torchsim_base:latest
2+
ARG BASE_IMAGE=ghcr.io/psal-postech/torchsim_base:latest
3+
FROM ${BASE_IMAGE}
34

45
# Prepare PyTorchSim project
56
COPY . /workspace/PyTorchSim

Dockerfile.base

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2424
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2525
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26-
FROM pytorch/pytorch:2.2.0-cuda12.1-cudnn8-runtime
26+
ARG PYTORCH_IMAGE=pytorch/pytorch:2.2.0-cuda12.1-cudnn8-runtime
27+
FROM ${PYTORCH_IMAGE}
2728

2829
# Copied from Gem5 Docker file
2930
ENV DEBIAN_FRONTEND=noninteractive

0 commit comments

Comments
 (0)