Skip to content

Commit

Permalink
Merge pull request #727 from lukaszstolarczuk/add-perf-workflow
Browse files Browse the repository at this point in the history
Add perf workflow
  • Loading branch information
lukaszstolarczuk authored Sep 30, 2024
2 parents 1c709c7 + 960d708 commit 36beed3
Showing 1 changed file with 115 additions and 0 deletions.
115 changes: 115 additions & 0 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Performance

on:
# Can be triggered via manual "dispatch" (from workflow view in GitHub Actions tab)
workflow_dispatch:
inputs:
pr_no:
description: PR number (if 0, it'll run on the main)
type: number
required: true

permissions:
contents: read
pull-requests: write

env:
BUILD_DIR : "${{github.workspace}}/build"

jobs:
perf-l0:
name: Build UMF and run performance tests
runs-on: "L0_PERF"

steps:
# Workspace on self-hosted runners is not cleaned automatically.
# We have to delete the files created outside of using actions.
- name: Cleanup self-hosted workspace
if: always()
run: |
ls -la ./
rm -rf ./* || true
- name: Add comment to PR
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ always() && inputs.pr_no != 0 }}
with:
script: |
const pr_no = '${{ inputs.pr_no }}';
const provider = 'LEVEL_ZERO';
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
const body = `Performance workflow for ${provider}_PROVIDER run:\n${url}`;
github.rest.issues.createComment({
issue_number: pr_no,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
- name: Checkout UMF
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Get information about platform
run: .github/scripts/get_system_info.sh

# We need to fetch special ref for proper PR's merge commit. Note, this ref may be absent if the PR is already merged.
- name: Fetch PR's merge commit
if: ${{ inputs.pr_no != 0 }}
working-directory: ${{github.workspace}}
env:
PR_NO: ${{ inputs.pr_no }}
run: |
git fetch -- https://github.com/${{github.repository}} +refs/pull/${PR_NO}/*:refs/remotes/origin/pr/${PR_NO}/*
git checkout origin/pr/${PR_NO}/merge
git rev-parse origin/pr/${PR_NO}/merge
- name: Configure build
run: >
cmake
-B ${{env.BUILD_DIR}}
-DCMAKE_BUILD_TYPE=Release
-DUMF_BUILD_SHARED_LIBRARY=ON
-DUMF_BUILD_BENCHMARKS=ON
-DUMF_BUILD_BENCHMARKS_MT=ON
-DUMF_BUILD_TESTS=OFF
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=OFF
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
-DUMF_BUILD_CUDA_PROVIDER=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
- name: Build
run: cmake --build ${{env.BUILD_DIR}} -j $(nproc)

- name: Run benchmarks
working-directory: ${{env.BUILD_DIR}}
id: benchmarks
run: numactl -N 1 ctest -V --test-dir benchmark -C Release

- name: Add comment to PR
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ always() && inputs.pr_no != 0 }}
with:
script: |
let markdown = ""
try {
const fs = require('fs');
markdown = fs.readFileSync('umf_perf_results.md', 'utf8');
} catch(err) {
}
const pr_no = '${{ inputs.pr_no }}';
const provider = 'LEVEL_ZERO';
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
const test_status = '${{ steps.benchmarks.outcome }}';
const job_status = '${{ job.status }}';
const body = `Performance workflow for ${provider}_PROVIDER run:\n${url}\nJob status: ${job_status}. Test status: ${test_status}.\n ${markdown}`;
github.rest.issues.createComment({
issue_number: pr_no,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})

0 comments on commit 36beed3

Please # to comment.