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