|
| 1 | +name: 'Continuous Benchmarking' |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request_review: |
| 5 | + types: [submitted] |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + tag: |
| 9 | + description: 'tag to CB' |
| 10 | + required: true |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: write |
| 14 | + deployments: write |
| 15 | + pages: write |
| 16 | + id-token: write |
| 17 | + |
| 18 | +jobs: |
| 19 | + file-changes: |
| 20 | + name: Detect File Changes |
| 21 | + runs-on: 'ubuntu-latest' |
| 22 | + outputs: |
| 23 | + checkall: ${{ steps.changes.outputs.checkall }} |
| 24 | + steps: |
| 25 | + - name: Clone |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Detect Changes |
| 29 | + uses: dorny/paths-filter@v3 |
| 30 | + id: changes |
| 31 | + with: |
| 32 | + filters: ".github/file-filter.yml" |
| 33 | + |
| 34 | + self: |
| 35 | + name: "${{ matrix.name }} (${{ matrix.device }})" |
| 36 | + needs: file-changes |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + include: |
| 41 | + - cluster: phoenix |
| 42 | + name: Georgia Tech | Phoenix (NVHPC) |
| 43 | + group: phoenix |
| 44 | + labels: gt |
| 45 | + flag: p |
| 46 | + device: cpu |
| 47 | + interface: none |
| 48 | + build_script: "" |
| 49 | + - cluster: phoenix |
| 50 | + name: Georgia Tech | Phoenix (NVHPC) |
| 51 | + group: phoenix |
| 52 | + labels: gt |
| 53 | + flag: p |
| 54 | + device: gpu |
| 55 | + interface: acc |
| 56 | + build_script: "" |
| 57 | + - cluster: phoenix |
| 58 | + name: Georgia Tech | Phoenix (NVHPC) |
| 59 | + group: phoenix |
| 60 | + labels: gt |
| 61 | + flag: p |
| 62 | + device: gpu |
| 63 | + interface: omp |
| 64 | + build_script: "" |
| 65 | + - cluster: frontier |
| 66 | + name: Oak Ridge | Frontier (CCE) |
| 67 | + group: phoenix |
| 68 | + labels: frontier |
| 69 | + flag: f |
| 70 | + device: gpu |
| 71 | + interface: acc |
| 72 | + build_script: "bash .github/workflows/frontier/build.sh gpu acc bench" |
| 73 | + runs-on: |
| 74 | + group: ${{ matrix.group }} |
| 75 | + labels: ${{ matrix.labels }} |
| 76 | + timeout-minutes: 1400 |
| 77 | + env: |
| 78 | + ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 |
| 79 | + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true |
| 80 | + steps: |
| 81 | + - name: Clone - PR |
| 82 | + uses: actions/checkout@v4 |
| 83 | + with: |
| 84 | + path: pr |
| 85 | + |
| 86 | + - name: Clone - Master |
| 87 | + uses: actions/checkout@v4 |
| 88 | + with: |
| 89 | + repository: MFlowCode/MFC |
| 90 | + ref: master |
| 91 | + path: master |
| 92 | + |
| 93 | + - name: Setup & Build |
| 94 | + if: matrix.build_script != '' |
| 95 | + run: | |
| 96 | + (cd pr && ${{ matrix.build_script }}) & |
| 97 | + (cd master && ${{ matrix.build_script }}) & |
| 98 | + wait %1 && wait %2 |
| 99 | +
|
| 100 | + - name: Bench (Master v. PR) |
| 101 | + run: | |
| 102 | + (cd pr && bash .github/workflows/${{ matrix.cluster }}/submit-bench.sh .github/workflows/${{ matrix.cluster }}/bench.sh ${{ matrix.device }} ${{ matrix.interface }}) & |
| 103 | + (cd master && bash .github/workflows/${{ matrix.cluster }}/submit-bench.sh .github/workflows/${{ matrix.cluster }}/bench.sh ${{ matrix.device }} ${{ matrix.interface }}) & |
| 104 | + wait %1 && wait %2 |
| 105 | +
|
| 106 | + - name: Generate & Post Comment |
| 107 | + run: | |
| 108 | + git clone "${{ secrets.DOC_PUSH_URL }}" ../www |
| 109 | + cp ../www/documentation/data.js ./pr/data.js |
| 110 | + (cd pr && . ./mfc.sh load -c ${{ matrix.flag }} -m g) |
| 111 | + (cd pr && ./mfc.sh bench_diff ../master/bench-${{ matrix.device }}-${{ matrix.interface }}.yaml ../pr/bench-${{ matrix.device }}-${{ matrix.interface }}.yaml -f data.js -n "${{ matrix.name }} (${{ matrix.device }}/${{ matrix.interface }})") |
| 112 | +
|
| 113 | + - name: Prep Benchmark Results |
| 114 | + run: | |
| 115 | + # should fill in the template in pr/cont-bench-template.json |
| 116 | +
|
| 117 | + - name: Post Benchmark Results |
| 118 | + uses: benchmark-action/github-action-benchmark@v1 |
| 119 | + with: |
| 120 | + name: "${{ matrix.name }} (${{ matrix.device }}/${{ matrix.interface }})" |
| 121 | + tool: 'googlecpp' |
| 122 | + output-file-path: pr/report.json |
| 123 | + github-token: ${{ secrets.TOKEN }} |
| 124 | + auto-push: true |
| 125 | + alert-threshold: '200%' |
| 126 | + comment-on-alert: true |
| 127 | + fail-on-alert: true |
| 128 | + gh-repository: 'github.com/MFlowCode/MFlowCode.github.io' |
| 129 | + gh-pages-branch: 'main' |
| 130 | + benchmark-data-dir-path: 'documentation' |
| 131 | + |
| 132 | + - name: Polishing Results |
| 133 | + run: | |
| 134 | + TAG="${{ github.event.inputs.tag || github.ref_name }}" |
| 135 | + echo "tag=$TAG" >> $GITHUB_OUTPUT |
| 136 | + echo "TAG=$TAG" >> $GITHUB_ENV |
| 137 | +
|
| 138 | + set +e |
| 139 | + git ls-remote "${{ secrets.DOC_PUSH_URL }}" -q |
| 140 | + if [ "$?" -ne "0" ]; then exit 0; fi |
| 141 | + set -e |
| 142 | + git config --global user.name 'MFC Action' |
| 143 | + git config --global user.email '<>' |
| 144 | + git clone "${{ secrets.DOC_PUSH_URL }}" ../www |
| 145 | + sed -i 's/"unit": "s\/iter"/"unit": "s"/g; s/cpu: /runtime: /g; s/iterations: /time steps: /g' ../www/documentation/data.js |
| 146 | + sed -i "s/${GITHUB_SHA::7}/$TAG/g" ../www/documentation/data.js |
| 147 | +
|
| 148 | + git -C ../www add -A |
| 149 | + git -C ../www commit -m "Docs @ ${GITHUB_SHA::7}" || true |
| 150 | + git -C ../www push |
| 151 | +
|
| 152 | + - name: Print Logs |
| 153 | + if: always() |
| 154 | + run: | |
| 155 | + cat pr/bench-${{ matrix.device }}-${{ matrix.interface }}.* 2>/dev/null || true |
| 156 | + cat master/bench-${{ matrix.device }}-${{ matrix.interface }}.* 2>/dev/null || true |
| 157 | +
|
| 158 | + # All other runners (non-Phoenix) just run without special env |
| 159 | + - name: Archive Logs (Frontier) |
| 160 | + if: always() && matrix.cluster != 'phoenix' |
| 161 | + uses: actions/upload-artifact@v4 |
| 162 | + with: |
| 163 | + name: ${{ matrix.cluster }}-${{ matrix.device }}-${{ matrix.interface }} |
| 164 | + path: | |
| 165 | + pr/bench-${{ matrix.device }}-${{ matrix.interface }}.* |
| 166 | + pr/build/benchmarks/* |
| 167 | + master/bench-${{ matrix.device }}-${{ matrix.interface }}.* |
| 168 | + master/build/benchmarks/* |
0 commit comments