|
1 | | -name: Demo – 2 GPU instances with different architectures |
| 1 | +name: Demo – x86 and ARM instances |
2 | 2 | on: |
3 | 3 | workflow_dispatch: |
4 | 4 | workflow_call: # Tested by `demos.yml` |
5 | 5 | permissions: |
6 | 6 | id-token: write # Required for AWS OIDC authentication |
7 | 7 | contents: read # Required for actions/checkout |
8 | 8 | jobs: |
9 | | - # Launch EC2 runners for each instance type |
10 | | - g4dn: |
11 | | - name: Launch g4dn |
| 9 | + # Launch EC2 runners for each architecture |
| 10 | + x86: |
| 11 | + name: Launch x86 |
12 | 12 | uses: ./.github/workflows/runner.yml |
13 | 13 | with: |
14 | | - ec2_instance_type: g4dn.xlarge |
| 14 | + ec2_instance_type: t3.medium |
| 15 | + # Ubuntu 24.04 LTS x86_64 (default AMI) |
15 | 16 | secrets: inherit |
16 | | - g4ad: |
17 | | - name: Launch g4ad |
| 17 | + arm: |
| 18 | + name: Launch ARM |
18 | 19 | uses: ./.github/workflows/runner.yml |
19 | 20 | with: |
20 | | - ec2_instance_type: g4ad.xlarge |
| 21 | + ec2_instance_type: t4g.medium |
| 22 | + ec2_image_id: ami-0a07e880fa53d77f2 # Ubuntu 24.04 LTS arm64 |
21 | 23 | secrets: inherit |
22 | 24 |
|
23 | 25 | # Run jobs directly on launched instances |
24 | | - test-g4dn: |
25 | | - needs: g4dn |
26 | | - if: needs.g4dn.outputs.id != '' |
27 | | - name: Test g4dn |
28 | | - runs-on: ${{ needs.g4dn.outputs.id }} |
| 26 | + test-x86: |
| 27 | + needs: x86 |
| 28 | + if: needs.x86.outputs.id != '' |
| 29 | + name: Test x86 |
| 30 | + runs-on: ${{ needs.x86.outputs.id }} |
29 | 31 | steps: |
30 | | - - name: GPU test on g4dn.xlarge |
31 | | - run: nvidia-smi # Verify GPU is available |
32 | | - test-g4ad: |
33 | | - needs: g4ad |
34 | | - if: needs.g4ad.outputs.id != '' |
35 | | - name: Test g4ad |
36 | | - runs-on: ${{ needs.g4ad.outputs.id }} |
| 32 | + - name: Architecture test on t3.medium |
| 33 | + run: | |
| 34 | + echo "Architecture: $(uname -m)" |
| 35 | + echo "Processor: $(lscpu | grep 'Architecture:' | awk '{print $2}')" |
| 36 | + echo "Instance type: $(curl -s http://169.254.169.254/latest/meta-data/instance-type)" |
| 37 | + test-arm: |
| 38 | + needs: arm |
| 39 | + if: needs.arm.outputs.id != '' |
| 40 | + name: Test ARM |
| 41 | + runs-on: ${{ needs.arm.outputs.id }} |
37 | 42 | steps: |
38 | | - - name: GPU test on g4ad.xlarge |
| 43 | + - name: Architecture test on t4g.medium |
39 | 44 | run: | |
40 | | - lspci | grep -i "vga\|display\|3d\|amd" |
| 45 | + echo "Architecture: $(uname -m)" |
| 46 | + echo "Processor: $(lscpu | grep 'Architecture:' | awk '{print $2}')" |
| 47 | + echo "Instance type: $(curl -s http://169.254.169.254/latest/meta-data/instance-type)" |
41 | 48 |
|
42 | 49 | # Use a `matrix` to run jobs on multiple instances |
43 | 50 | test-matrix: |
44 | | - needs: [g4dn, g4ad] |
45 | | - if: always() && (needs.g4dn.outputs.id != '' || needs.g4ad.outputs.id != '') |
46 | | - name: Test ${{ matrix.instance }} (matrix) |
| 51 | + needs: [x86, arm] |
| 52 | + if: always() && (needs.x86.outputs.id != '' || needs.arm.outputs.id != '') |
| 53 | + name: Test ${{ matrix.arch }} (matrix) |
47 | 54 | continue-on-error: true |
48 | 55 | strategy: |
49 | 56 | matrix: |
50 | 57 | include: |
51 | | - - instance: g4dn |
52 | | - runner: ${{ needs.g4dn.outputs.id }} |
53 | | - - instance: g4ad |
54 | | - runner: ${{ needs.g4ad.outputs.id }} |
| 58 | + - arch: x86 |
| 59 | + runner: ${{ needs.x86.outputs.id }} |
| 60 | + - arch: arm |
| 61 | + runner: ${{ needs.arm.outputs.id }} |
55 | 62 | fail-fast: false |
56 | 63 | runs-on: ${{ matrix.runner }} |
57 | 64 | steps: |
58 | | - - name: Matrix GPU test on ${{ matrix.instance }}.xlarge |
| 65 | + - name: Matrix architecture test |
59 | 66 | run: | |
60 | | - echo "Running on ${{ matrix.instance }}.xlarge" |
| 67 | + echo "Running on ${{ matrix.arch }}" |
| 68 | + echo "Architecture: $(uname -m)" |
61 | 69 | echo "Instance type: $(curl -s http://169.254.169.254/latest/meta-data/instance-type)" |
62 | 70 |
|
63 | | - # Check GPU based on instance type |
64 | | - if [[ "${{ matrix.instance }}" == "g4dn" ]]; then |
65 | | - echo "Testing NVIDIA GPU..." |
66 | | - nvidia-smi |
67 | | - elif [[ "${{ matrix.instance }}" == "g4ad" ]]; then |
68 | | - echo "Testing AMD GPU..." |
69 | | - lspci | grep -i "vga\|display\|3d\|amd" |
| 71 | + # Verify expected architecture |
| 72 | + if [[ "${{ matrix.arch }}" == "x86" ]]; then |
| 73 | + echo "Verifying x86_64 architecture..." |
| 74 | + [[ "$(uname -m)" == "x86_64" ]] && echo "✓ Confirmed x86_64" || exit 1 |
| 75 | + elif [[ "${{ matrix.arch }}" == "arm" ]]; then |
| 76 | + echo "Verifying ARM architecture..." |
| 77 | + [[ "$(uname -m)" == "aarch64" ]] && echo "✓ Confirmed aarch64" || exit 1 |
70 | 78 | fi |
0 commit comments