Add claude GitHub actions 1771783896310 #5336
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Benchmark' | |
| on: | |
| # Trigger when Test Suite completes (no polling needed) | |
| workflow_run: | |
| workflows: ["Test Suite"] | |
| types: [completed] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| file-changes: | |
| name: Detect File Changes | |
| # Only run if Test Suite passed (or manual dispatch) | |
| if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' | |
| runs-on: 'ubuntu-latest' | |
| outputs: | |
| checkall: ${{ steps.changes.outputs.checkall }} | |
| pr_number: ${{ steps.pr-info.outputs.pr_number }} | |
| pr_approved: ${{ steps.pr-info.outputs.approved }} | |
| pr_author: ${{ steps.pr-info.outputs.author }} | |
| steps: | |
| - name: Clone | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_sha || github.sha }} | |
| - name: Detect Changes | |
| uses: dorny/paths-filter@v3 | |
| id: changes | |
| with: | |
| filters: ".github/file-filter.yml" | |
| - name: Get PR Info | |
| id: pr-info | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "pr_number=" >> $GITHUB_OUTPUT | |
| echo "approved=true" >> $GITHUB_OUTPUT | |
| echo "author=${{ github.actor }}" >> $GITHUB_OUTPUT | |
| else | |
| # Get PR number from workflow_run | |
| PR_NUMBER="${{ github.event.workflow_run.pull_requests[0].number }}" | |
| if [ -n "$PR_NUMBER" ]; then | |
| echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT | |
| # Fetch actual PR author from API (workflow_run.actor is the re-runner, not PR author) | |
| PR_AUTHOR=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER --jq '.user.login') | |
| echo "author=$PR_AUTHOR" >> $GITHUB_OUTPUT | |
| # Check if PR is approved | |
| APPROVED=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/reviews \ | |
| --jq '[.[] | select(.state == "APPROVED")] | length') | |
| if [ "$APPROVED" -gt 0 ]; then | |
| echo "approved=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "approved=false" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| echo "pr_number=" >> $GITHUB_OUTPUT | |
| echo "approved=false" >> $GITHUB_OUTPUT | |
| echo "author=" >> $GITHUB_OUTPUT | |
| fi | |
| fi | |
| self: | |
| name: "${{ matrix.name }} (${{ matrix.device }}${{ matrix.interface != 'none' && format('-{0}', matrix.interface) || '' }})" | |
| if: > | |
| github.repository == 'MFlowCode/MFC' && | |
| needs.file-changes.outputs.checkall == 'true' && | |
| ( | |
| github.event_name == 'workflow_dispatch' || | |
| needs.file-changes.outputs.pr_approved == 'true' || | |
| needs.file-changes.outputs.pr_author == 'sbryngelson' || | |
| needs.file-changes.outputs.pr_author == 'wilfonba' | |
| ) | |
| needs: [file-changes] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - cluster: phoenix | |
| name: Georgia Tech | Phoenix (NVHPC) | |
| group: phoenix | |
| labels: gt | |
| flag: p | |
| device: cpu | |
| interface: none | |
| build_script: "" | |
| - cluster: phoenix | |
| name: Georgia Tech | Phoenix (NVHPC) | |
| group: phoenix | |
| labels: gt | |
| flag: p | |
| device: gpu | |
| interface: acc | |
| build_script: "" | |
| - cluster: phoenix | |
| name: Georgia Tech | Phoenix (NVHPC) | |
| group: phoenix | |
| labels: gt | |
| flag: p | |
| device: gpu | |
| interface: omp | |
| build_script: "" | |
| - cluster: frontier | |
| name: Oak Ridge | Frontier (CCE) | |
| group: phoenix | |
| labels: frontier | |
| flag: f | |
| device: gpu | |
| interface: acc | |
| build_script: "bash .github/workflows/frontier/build.sh gpu acc bench" | |
| - cluster: frontier | |
| name: Oak Ridge | Frontier (CCE) | |
| group: phoenix | |
| labels: frontier | |
| flag: f | |
| device: gpu | |
| interface: omp | |
| build_script: "bash .github/workflows/frontier/build.sh gpu omp bench" | |
| - cluster: frontier_amd | |
| name: Oak Ridge | Frontier (AMD) | |
| group: phoenix | |
| labels: frontier | |
| flag: famd | |
| device: gpu | |
| interface: omp | |
| build_script: "bash .github/workflows/frontier_amd/build.sh gpu omp bench" | |
| runs-on: | |
| group: ${{ matrix.group }} | |
| labels: ${{ matrix.labels }} | |
| timeout-minutes: 480 | |
| env: | |
| ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 | |
| ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
| steps: | |
| - name: Clone - PR | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_sha || github.sha }} | |
| path: pr | |
| - name: Clone - Master | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: MFlowCode/MFC | |
| ref: master | |
| path: master | |
| - name: Setup & Build | |
| if: matrix.build_script != '' | |
| run: | | |
| (cd pr && ${{ matrix.build_script }}) & | |
| (cd master && ${{ matrix.build_script }}) & | |
| wait %1 && wait %2 | |
| - name: Bench (Master v. PR) | |
| run: bash pr/.github/scripts/run_parallel_benchmarks.sh ${{ matrix.device }} ${{ matrix.interface }} ${{ matrix.cluster }} | |
| - name: Generate & Post Comment | |
| run: | | |
| (cd pr && . ./mfc.sh load -c ${{ matrix.flag }} -m g) | |
| (cd pr && ./mfc.sh bench_diff ../master/bench-${{ matrix.device }}-${{ matrix.interface }}.yaml ../pr/bench-${{ matrix.device }}-${{ matrix.interface }}.yaml) | |
| - name: Print Logs | |
| if: always() | |
| run: | | |
| cat pr/bench-${{ matrix.device }}-${{ matrix.interface }}.* 2>/dev/null || true | |
| cat master/bench-${{ matrix.device }}-${{ matrix.interface }}.* 2>/dev/null || true | |
| # All other runners (non-Phoenix) just run without special env | |
| - name: Archive Logs (Frontier) | |
| if: always() && matrix.cluster != 'phoenix' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.cluster }}-${{ matrix.device }}-${{ matrix.interface }} | |
| path: | | |
| pr/bench-${{ matrix.device }}-${{ matrix.interface }}.* | |
| pr/build/benchmarks/* | |
| master/bench-${{ matrix.device }}-${{ matrix.interface }}.* | |
| master/build/benchmarks/* |