Skip to content

Commit 7c8ea13

Browse files
committed
Set up cirun workflow for arm64 graviton
1 parent 7976def commit 7c8ea13

File tree

2 files changed

+142
-0
lines changed

2 files changed

+142
-0
lines changed

.cirun.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Self-Hosted Github Action Runners on AWS via Cirun.io
2+
# Reference: https://docs.cirun.io/Reference/yml.html
3+
runners:
4+
- name: "aws-runner-graviton"
5+
# Cloud Provider: AWS
6+
cloud: "aws"
7+
region: "us-east-1"
8+
# Cheapest VM on AWS
9+
instance_type: "c7g.large"
10+
# Ubuntu-22.04, ami image
11+
machine_image: "ami-0a0c8eebcdd6dcbd0"
12+
preemptible: false
13+
# Add this label in the "runs-on" param in .github/workflows/<workflow-name>.yml
14+
# So that this runner is created for running the workflow
15+
labels:
16+
- "cirun-aws-runner-graviton"

.github/workflows/arm64_graviton.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: arm64 graviton cirun
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read # to fetch code (actions/checkout)
7+
8+
jobs:
9+
build:
10+
runs-on: "cirun-aws-runner-graviton--${{ github.run_id }}"
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
fortran: [gfortran]
16+
build: [cmake, make]
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
22+
- name: Print system information
23+
run: |
24+
if [ "$RUNNER_OS" == "Linux" ]; then
25+
cat /proc/cpuinfo
26+
else
27+
echo "::error::$RUNNER_OS not supported"
28+
exit 1
29+
fi
30+
31+
- name: Install Dependencies
32+
run: |
33+
if [ "$RUNNER_OS" == "Linux" ]; then
34+
sudo apt update
35+
sudo apt-get install -y gfortran cmake ccache libtinfo5
36+
else
37+
echo "::error::$RUNNER_OS not supported"
38+
exit 1
39+
fi
40+
41+
- name: Compilation cache
42+
uses: actions/cache@v3
43+
with:
44+
path: ~/.ccache
45+
# We include the commit sha in the cache key, as new cache entries are
46+
# only created if there is no existing entry for the key yet.
47+
# GNU make and cmake call the compilers differently. It looks like
48+
# that causes the cache to mismatch. Keep the ccache for both build
49+
# tools separate to avoid polluting each other.
50+
key: ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }}-${{ github.sha }}
51+
# Restore a matching ccache cache entry. Prefer same branch and same Fortran compiler.
52+
restore-keys: |
53+
ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }}
54+
ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}
55+
ccache-${{ runner.os }}-${{ matrix.build }}
56+
57+
- name: Configure ccache
58+
run: |
59+
if [ "${{ matrix.build }}" = "make" ]; then
60+
# Add ccache to path
61+
if [ "$RUNNER_OS" = "Linux" ]; then
62+
echo "/usr/lib/ccache" >> $GITHUB_PATH
63+
else
64+
echo "::error::$RUNNER_OS not supported"
65+
exit 1
66+
fi
67+
fi
68+
# Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota (5 GB).
69+
test -d ~/.ccache || mkdir -p ~/.ccache
70+
echo "max_size = 300M" > ~/.ccache/ccache.conf
71+
echo "compression = true" >> ~/.ccache/ccache.conf
72+
ccache -s
73+
74+
- name: Build OpenBLAS
75+
run: |
76+
case "${{ matrix.build }}" in
77+
"make")
78+
make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0 FC="ccache ${{ matrix.fortran }}"
79+
;;
80+
"cmake")
81+
mkdir build && cd build
82+
cmake -DDYNAMIC_ARCH=1 \
83+
-DNOFORTRAN=0 \
84+
-DBUILD_WITHOUT_LAPACK=0 \
85+
-DCMAKE_VERBOSE_MAKEFILE=ON \
86+
-DCMAKE_BUILD_TYPE=Release \
87+
-DCMAKE_Fortran_COMPILER=${{ matrix.fortran }} \
88+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
89+
-DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \
90+
..
91+
cmake --build .
92+
;;
93+
*)
94+
echo "::error::Configuration not supported"
95+
exit 1
96+
;;
97+
esac
98+
99+
- name: Show ccache status
100+
continue-on-error: true
101+
run: ccache -s
102+
103+
- name: Run tests
104+
timeout-minutes: 60
105+
run: |
106+
case "${{ matrix.build }}" in
107+
"make")
108+
MAKE_FLAGS='DYNAMIC_ARCH=1 USE_OPENMP=0'
109+
echo "::group::Tests in 'test' directory"
110+
make -C test $MAKE_FLAGS FC="ccache ${{ matrix.fortran }}"
111+
echo "::endgroup::"
112+
echo "::group::Tests in 'ctest' directory"
113+
make -C ctest $MAKE_FLAGS FC="ccache ${{ matrix.fortran }}"
114+
echo "::endgroup::"
115+
echo "::group::Tests in 'utest' directory"
116+
make -C utest $MAKE_FLAGS FC="ccache ${{ matrix.fortran }}"
117+
echo "::endgroup::"
118+
;;
119+
"cmake")
120+
cd build && ctest
121+
;;
122+
*)
123+
echo "::error::Configuration not supported"
124+
exit 1
125+
;;
126+
esac

0 commit comments

Comments
 (0)