Skip to content

Commit d13ca8e

Browse files
authored
CI: add GPU test pipeline
1 parent 6b85082 commit d13ca8e

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/cuda.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CUDA Test
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
start-runner:
8+
name: Start self-hosted EC2 runner
9+
runs-on: ubuntu-latest
10+
outputs:
11+
label: ${{ steps.start-ec2-runner.outputs.label }}
12+
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
13+
steps:
14+
- name: Configure AWS credentials
15+
uses: aws-actions/configure-aws-credentials@v1
16+
with:
17+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
18+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19+
aws-region: us-east-2
20+
- name: Start EC2 runner
21+
id: start-ec2-runner
22+
uses: machulav/ec2-github-runner@v2
23+
with:
24+
mode: start
25+
github-token: ${{ secrets.GITHUB_TOKEN }}
26+
ec2-image-id: ami-04cd9fec4a7a39019
27+
ec2-instance-type: g4dn.xlarge
28+
subnet-id: subnet-72d3e53e
29+
security-group-id: sg-06b0c93122c08aeab
30+
test:
31+
name: Do the job on the runner
32+
needs: start-runner # required to start the main job when the runner is ready
33+
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
34+
container: ghcr.io/deepmodeling/abacus-development-kit:cuda
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
38+
- name: Build and Test
39+
env:
40+
GTEST_COLOR: 'yes'
41+
run: |
42+
nvidia-smi
43+
cmake -B build -DBUILD_TESTING=ON -DUSE_CUDA=ON
44+
cmake --build build -j4
45+
cmake --install build
46+
47+
stop-runner:
48+
name: Stop self-hosted EC2 runner
49+
needs:
50+
- start-runner # required to get output from the start-runner job
51+
- test # required to wait when the main job is done
52+
runs-on: ubuntu-latest
53+
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
54+
steps:
55+
- name: Configure AWS credentials
56+
uses: aws-actions/configure-aws-credentials@v1
57+
with:
58+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
59+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
60+
aws-region: ${{ secrets.AWS_REGION }}
61+
- name: Stop EC2 runner
62+
uses: machulav/ec2-github-runner@v2
63+
with:
64+
mode: stop
65+
github-token: ${{ secrets.GITHUB_TOKEN }}
66+
label: ${{ needs.start-runner.outputs.label }}
67+
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}

0 commit comments

Comments
 (0)