From 7c8ea130a35400ee15320b4747d52ff1c8349773 Mon Sep 17 00:00:00 2001 From: steppi Date: Tue, 18 Jul 2023 14:36:03 -0400 Subject: [PATCH 1/4] Set up cirun workflow for arm64 graviton --- .cirun.yml | 16 ++++ .github/workflows/arm64_graviton.yml | 126 +++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 .cirun.yml create mode 100644 .github/workflows/arm64_graviton.yml diff --git a/.cirun.yml b/.cirun.yml new file mode 100644 index 000000000..f0e0149d3 --- /dev/null +++ b/.cirun.yml @@ -0,0 +1,16 @@ +# Self-Hosted Github Action Runners on AWS via Cirun.io +# Reference: https://docs.cirun.io/Reference/yml.html +runners: + - name: "aws-runner-graviton" + # Cloud Provider: AWS + cloud: "aws" + region: "us-east-1" + # Cheapest VM on AWS + instance_type: "c7g.large" + # Ubuntu-22.04, ami image + machine_image: "ami-0a0c8eebcdd6dcbd0" + preemptible: false + # Add this label in the "runs-on" param in .github/workflows/.yml + # So that this runner is created for running the workflow + labels: + - "cirun-aws-runner-graviton" diff --git a/.github/workflows/arm64_graviton.yml b/.github/workflows/arm64_graviton.yml new file mode 100644 index 000000000..bcb05047c --- /dev/null +++ b/.github/workflows/arm64_graviton.yml @@ -0,0 +1,126 @@ +name: arm64 graviton cirun + +on: [push, pull_request] + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + build: + runs-on: "cirun-aws-runner-graviton--${{ github.run_id }}" + + strategy: + fail-fast: false + matrix: + fortran: [gfortran] + build: [cmake, make] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Print system information + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + cat /proc/cpuinfo + else + echo "::error::$RUNNER_OS not supported" + exit 1 + fi + + - name: Install Dependencies + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt update + sudo apt-get install -y gfortran cmake ccache libtinfo5 + else + echo "::error::$RUNNER_OS not supported" + exit 1 + fi + + - name: Compilation cache + uses: actions/cache@v3 + with: + path: ~/.ccache + # We include the commit sha in the cache key, as new cache entries are + # only created if there is no existing entry for the key yet. + # GNU make and cmake call the compilers differently. It looks like + # that causes the cache to mismatch. Keep the ccache for both build + # tools separate to avoid polluting each other. + key: ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }}-${{ github.sha }} + # Restore a matching ccache cache entry. Prefer same branch and same Fortran compiler. + restore-keys: | + ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }}-${{ github.ref }} + ccache-${{ runner.os }}-${{ matrix.build }}-${{ matrix.fortran }} + ccache-${{ runner.os }}-${{ matrix.build }} + + - name: Configure ccache + run: | + if [ "${{ matrix.build }}" = "make" ]; then + # Add ccache to path + if [ "$RUNNER_OS" = "Linux" ]; then + echo "/usr/lib/ccache" >> $GITHUB_PATH + else + echo "::error::$RUNNER_OS not supported" + exit 1 + fi + fi + # Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota (5 GB). + test -d ~/.ccache || mkdir -p ~/.ccache + echo "max_size = 300M" > ~/.ccache/ccache.conf + echo "compression = true" >> ~/.ccache/ccache.conf + ccache -s + + - name: Build OpenBLAS + run: | + case "${{ matrix.build }}" in + "make") + make -j$(nproc) DYNAMIC_ARCH=1 USE_OPENMP=0 FC="ccache ${{ matrix.fortran }}" + ;; + "cmake") + mkdir build && cd build + cmake -DDYNAMIC_ARCH=1 \ + -DNOFORTRAN=0 \ + -DBUILD_WITHOUT_LAPACK=0 \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_Fortran_COMPILER=${{ matrix.fortran }} \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_Fortran_COMPILER_LAUNCHER=ccache \ + .. + cmake --build . + ;; + *) + echo "::error::Configuration not supported" + exit 1 + ;; + esac + + - name: Show ccache status + continue-on-error: true + run: ccache -s + + - name: Run tests + timeout-minutes: 60 + run: | + case "${{ matrix.build }}" in + "make") + MAKE_FLAGS='DYNAMIC_ARCH=1 USE_OPENMP=0' + echo "::group::Tests in 'test' directory" + make -C test $MAKE_FLAGS FC="ccache ${{ matrix.fortran }}" + echo "::endgroup::" + echo "::group::Tests in 'ctest' directory" + make -C ctest $MAKE_FLAGS FC="ccache ${{ matrix.fortran }}" + echo "::endgroup::" + echo "::group::Tests in 'utest' directory" + make -C utest $MAKE_FLAGS FC="ccache ${{ matrix.fortran }}" + echo "::endgroup::" + ;; + "cmake") + cd build && ctest + ;; + *) + echo "::error::Configuration not supported" + exit 1 + ;; + esac From b92033e3bec431eb6b1b27ce20552edd89eb0b9a Mon Sep 17 00:00:00 2001 From: steppi Date: Mon, 24 Jul 2023 16:20:56 -0400 Subject: [PATCH 2/4] EMPTY: [skip ci] From 42cbcf58bfcb1364c445fa71b6fb9700b1b4c69e Mon Sep 17 00:00:00 2001 From: steppi Date: Mon, 24 Jul 2023 16:38:52 -0400 Subject: [PATCH 3/4] EMPTY: [skip ci] [skip cirrus] From 76aa6bac4df3014acaad26390e6c7e3085d25806 Mon Sep 17 00:00:00 2001 From: steppi Date: Wed, 26 Jul 2023 12:01:12 -0400 Subject: [PATCH 4/4] Fix cirun url [skip actions] --- .cirun.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirun.yml b/.cirun.yml index f0e0149d3..bfc6494d0 100644 --- a/.cirun.yml +++ b/.cirun.yml @@ -1,5 +1,5 @@ # Self-Hosted Github Action Runners on AWS via Cirun.io -# Reference: https://docs.cirun.io/Reference/yml.html +# Reference: https://docs.cirun.io/reference/yaml runners: - name: "aws-runner-graviton" # Cloud Provider: AWS