Skip to content

Commit 6a70760

Browse files
committed
ci: add ARM64 support with native builds
Adds comprehensive ARM64 (AWS Graviton, Apple Silicon) testing and Docker support using GitHub's free ARM64 runners with native compilation. CI Testing (Native ARM64): - Add 2 ARM64 configs to pytest-core-nompi (gcc-13, gcc-14 with OpenMP) - Add ARM64 Docker test to pytest-core-mpi - Tests run natively on ubuntu-24.04-arm runners - Covers base and adjoint test sets on ARM64 Docker Base Images (Native Builds): - Separate jobs for native compilation on each platform: - deploy-gcc-amd64-bases: ubuntu-24.04 → linux/amd64 - deploy-gcc-arm64-bases: ubuntu-24.04-arm → linux/arm64 - Single Dockerfile.cpu builds both architectures (no duplication) - Tags: cpu-gcc (x86_64) and arm64-gcc (ARM64) for backwards compatibility - Builds OpenMPI 5.0.x from source for GCC 14 compatibility Tweak
1 parent 764b075 commit 6a70760

6 files changed

Lines changed: 126 additions & 15 deletions

File tree

.github/actionlint.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# actionlint configuration file
2+
# https://github.com/rhysd/actionlint/blob/main/docs/config.md
3+
4+
self-hosted-runner:
5+
# Custom labels for self-hosted runners
6+
labels:
7+
- nvidiagpu # Self-hosted runner for NVIDIA GPU builds
8+
- amdgpu # Self-hosted runner for AMD GPU builds

.github/workflows/docker-bases.yml

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616
cpu:
1717
type: boolean
1818
default: false
19+
arm64:
20+
type: boolean
21+
default: false
1922
nvidia:
2023
type: boolean
2124
default: false
@@ -34,12 +37,12 @@ on:
3437

3538
jobs:
3639
#######################################################
37-
############## Basic gcc CPU ##########################
40+
############## GCC x86_64 Base ########################
3841
#######################################################
39-
deploy-cpu-bases:
42+
deploy-gcc-amd64-bases:
4043
if: inputs.cpu
41-
name: "cpu-base"
42-
runs-on: ubuntu-latest
44+
name: "gcc-base-amd64"
45+
runs-on: ubuntu-24.04
4346
env:
4447
DOCKER_BUILDKIT: "1"
4548

@@ -54,9 +57,6 @@ jobs:
5457
- name: Check event name
5558
run: echo ${{ github.event_name }}
5659

57-
- name: Set up QEMU
58-
uses: docker/setup-qemu-action@v3
59-
6060
- name: Set up Docker Buildx
6161
uses: docker/setup-buildx-action@v3
6262

@@ -66,15 +66,56 @@ jobs:
6666
username: ${{ secrets.DOCKER_USERNAME }}
6767
password: ${{ secrets.DOCKER_PASSWORD }}
6868

69-
- name: GCC image
69+
- name: Build and push x86_64 GCC image
7070
uses: docker/build-push-action@v6
7171
with:
7272
context: .
7373
file: "./docker/Dockerfile.cpu"
7474
push: true
75+
platforms: linux/amd64
7576
build-args: "gcc=${{ matrix.gcc }}"
7677
tags: "devitocodes/bases:cpu-gcc${{ matrix.gcc }}"
7778

79+
#######################################################
80+
############## GCC ARM64 Base #########################
81+
#######################################################
82+
deploy-gcc-arm64-bases:
83+
if: inputs.arm64
84+
name: "gcc-base-arm64"
85+
runs-on: ubuntu-24.04-arm
86+
env:
87+
DOCKER_BUILDKIT: "1"
88+
89+
strategy:
90+
matrix:
91+
gcc: [""] # Only build default GCC (building from source too slow)
92+
93+
steps:
94+
- name: Checkout devito
95+
uses: actions/checkout@v5
96+
97+
- name: Check event name
98+
run: echo ${{ github.event_name }}
99+
100+
- name: Set up Docker Buildx
101+
uses: docker/setup-buildx-action@v3
102+
103+
- name: Login to DockerHub
104+
uses: docker/login-action@v3
105+
with:
106+
username: ${{ secrets.DOCKER_USERNAME }}
107+
password: ${{ secrets.DOCKER_PASSWORD }}
108+
109+
- name: Build and push ARM64 GCC image
110+
uses: docker/build-push-action@v6
111+
with:
112+
context: .
113+
file: "./docker/Dockerfile.cpu"
114+
push: true
115+
platforms: linux/arm64
116+
build-args: "gcc=${{ matrix.gcc }}"
117+
tags: "devitocodes/bases:arm64-gcc${{ matrix.gcc }}"
118+
78119
#######################################################
79120
############## Intel OneApi CPU #######################
80121
#######################################################

.github/workflows/docker-devito.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ jobs:
4646
test: 'tests/test_operator.py'
4747
runner: ubuntu-latest
4848

49+
- base: 'bases:arm64-gcc'
50+
tag: 'arm64-gcc'
51+
flag: '--init -t'
52+
test: 'tests/test_operator.py'
53+
runner: ubuntu-24.04-arm # GitHub's free ARM64 runner
54+
4955
steps:
5056
- name: Checkout devito
5157
uses: actions/checkout@v5

.github/workflows/pytest-core-mpi.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,32 @@ jobs:
6666
runs-on: ${{ matrix.os }}
6767
strategy:
6868
matrix:
69-
name: [gcc, icx]
69+
name: [gcc, icx, gcc-arm64]
7070
include:
7171
- name: gcc
7272
arch: gcc
73+
base_prefix: cpu
7374
os: ubuntu-latest
7475
mpiflag: ""
7576
- name: icx
7677
arch: icx
78+
base_prefix: cpu
7779
os: ubuntu-latest
7880
# Need safe math for icx due to inaccuracy with mpi+sinc interpolation
7981
mpiflag: "-e DEVITO_SAFE_MATH=1"
82+
- name: gcc-arm64
83+
arch: gcc
84+
base_prefix: arm64
85+
os: ubuntu-24.04-arm
86+
mpiflag: ""
8087

8188
steps:
8289
- name: Checkout devito
8390
uses: actions/checkout@v5
8491

8592
- name: Build docker image
8693
run: |
87-
docker build . --file docker/Dockerfile.devito --tag devito_img --build-arg base=devitocodes/bases:cpu-${{ matrix.arch }}
94+
docker build . --file docker/Dockerfile.devito --tag devito_img --build-arg base=devitocodes/bases:${{ matrix.base_prefix }}-${{ matrix.arch }}
8895
8996
- name: Test with pytest
9097
run: |

.github/workflows/pytest-core-nompi.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ jobs:
3939
pytest-osx-py312-clang-omp,
4040
pytest-docker-py310-gcc-omp,
4141
pytest-docker-py310-icx-omp,
42-
pytest-ubuntu-py313-gcc14-omp
42+
pytest-ubuntu-py313-gcc14-omp,
43+
pytest-ubuntu-py312-gcc14-omp-arm64,
44+
pytest-ubuntu-py311-gcc13-omp-arm64
4345
]
4446
set: [base, adjoint]
4547
include:
@@ -113,6 +115,20 @@ jobs:
113115
language: "openmp"
114116
sympy: "1.14"
115117

118+
- name: pytest-ubuntu-py312-gcc14-omp-arm64
119+
python-version: '3.12'
120+
os: ubuntu-24.04-arm
121+
arch: "gcc-14"
122+
language: "openmp"
123+
sympy: "1.14"
124+
125+
- name: pytest-ubuntu-py311-gcc13-omp-arm64
126+
python-version: '3.11'
127+
os: ubuntu-24.04-arm
128+
arch: "gcc-13"
129+
language: "openmp"
130+
sympy: "1.13"
131+
116132
- set: base
117133
test-set: 'not adjoint'
118134

docker/README.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ Devito provides several images that target different architectures and compilers
88

99
### [Devito] on CPU
1010

11-
We provide two CPU images:
12-
- `devito:gcc-*` with the standard GNU gcc compiler.
13-
- `devito:icx-*` with the Intel C compiler for Intel architectures.
11+
We provide CPU images for different architectures and compilers:
12+
- `devito:gcc-*` with the standard GNU gcc compiler (x86_64).
13+
- `devito:icx-*` with the Intel C compiler for Intel architectures (x86_64).
14+
- `devito:arm64-gcc-*` with the standard GNU gcc compiler for ARM64 architectures (AWS Graviton, Apple Silicon, etc.).
1415

15-
These images provide a working environment for any CPU architecture and come with [Devito], `gcc/icx` and `mpi` preinstalled, and utilities such as `jupyter` for usability and exploration of the package.
16+
These images provide a working environment for their respective CPU architectures and come with [Devito], `gcc/icx` and `mpi` preinstalled, and utilities such as `jupyter` for usability and exploration of the package.
1617

1718
To run this image locally, you will first need to install `docker`. Then, the following commands will get you started:
1819

@@ -38,6 +39,38 @@ In addition, the following legacy tags are available:
3839
- `devito:cpu-*` that corresponds to `devito:gcc-*`
3940

4041

42+
### [Devito] on ARM64
43+
44+
We provide ARM64-specific images optimized for ARM64 processors:
45+
- `devito:arm64-gcc-*` with the standard GNU gcc compiler for ARM64 architectures.
46+
47+
These images support various ARM64 platforms including:
48+
- AWS Graviton2/3/4 instances
49+
- Apple Silicon (M1/M2/M3) via Docker Desktop
50+
- ARM-based cloud instances
51+
52+
Devito automatically detects the specific ARM64 variant at runtime and applies appropriate optimizations through its JIT compiler.
53+
54+
To run on ARM64 systems:
55+
56+
```bash
57+
# Pull image and start a bash shell
58+
docker run --rm -it -p 8888:8888 devitocodes/devito:arm64-gcc-latest /bin/bash
59+
60+
# or start a Jupyter notebook server on port 8888
61+
docker run --rm -it -p 8888:8888 devitocodes/devito:arm64-gcc-latest
62+
63+
# Run an example
64+
docker run --rm -it devitocodes/devito:arm64-gcc-latest python examples/seismic/acoustic/acoustic_example.py
65+
```
66+
67+
On AWS Graviton instances with user context:
68+
69+
```bash
70+
docker run --rm -it -v `pwd`:`pwd` -w `pwd` -u $(id -u):$(id -g) devitocodes/devito:arm64-gcc-latest python examples/seismic/acoustic/acoustic_example.py
71+
```
72+
73+
4174
### [Devito] on GPU
4275

4376
Second, we provide three images to run [Devito] on GPUs, tagged `devito:nvidia-nvc-*`, and `devito:amd-*`.

0 commit comments

Comments
 (0)