Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit 78ba5c1

Browse files
varun-sundar-rabindranathVarun Sundar Rabindranath
authored andcommitted
Varun/benchmark workflow (#28)
Add initial bechmark workflow --------- Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com>
1 parent b976653 commit 78ba5c1

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: run vllm benchmarks
2+
description: 'run vllm benchmarks'
3+
inputs:
4+
output_directory:
5+
description: 'output directory to store the benchmark results'
6+
required: true
7+
runs:
8+
using: composite
9+
steps:
10+
- id: benchmark
11+
run: |
12+
mkdir -p ${{ inputs.output_directory }}
13+
SUCCESS=0
14+
.github/workflows/scripts/nm-run-benchmarks.sh ${{ inputs.output_directory }} || SUCCESS=$?
15+
echo "test=${SUCCESS}" >> "$GITHUB_OUTPUT"
16+
exit ${SUCCESS}
17+
shell: bash
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: workflow info
2+
description: 'give a brief summary of workflow parameters'
3+
inputs:
4+
label:
5+
description: "requested runner label (specifies instance)"
6+
required: true
7+
timeout:
8+
description: "time limit for run in minutes "
9+
required: true
10+
gitref:
11+
description: "git commit hash or branch name"
12+
required: true
13+
runs:
14+
using: composite
15+
steps:
16+
- run: |
17+
echo "workflow started ..."
18+
echo "label: '${{ inputs.label }}'"
19+
echo "github actor: '${{ github.actor }}'"
20+
echo "repository: '${{ github.repository }}'"
21+
echo "gitref: '${{ inputs.gitref }}'"
22+
echo "branch name: '${{ github.ref_name }}'"
23+
echo "user on instance: $(whoami)"
24+
echo "workflow timeout: ${{ inputs.timeout }} (min)"
25+
shell: bash

.github/workflows/nm-benchmark.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: benchmark
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
label:
6+
description: "requested runner label (specifies instance)"
7+
type: string
8+
required: true
9+
timeout:
10+
description: "approximate number of minutes to keep instance up (should be at least 20)."
11+
type: string
12+
required: true
13+
gitref:
14+
description: "git commit hash or branch name"
15+
type: string
16+
required: true
17+
18+
jobs:
19+
BENCHMARK:
20+
21+
runs-on: ${{ inputs.label }}
22+
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
23+
24+
steps:
25+
- name: checkout repository code
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
ref: ${{ inputs.gitref }}
30+
submodules: recursive
31+
32+
- name: workflow info
33+
uses: ./.github/actions/nm-workflow-info/
34+
with:
35+
gitref: ${{ inputs.gitref }}
36+
label: ${{ inputs.label }}
37+
timeout: ${{ inputs.timeout }}
38+
39+
# Call the `build` action when available
40+
#- name: build
41+
# id: build
42+
# uses: ./.github/actions/build/
43+
44+
- name: run benchmarks
45+
uses: ./.github/actions/nm-benchmark/
46+
with:
47+
output_directory: benchmark-results
48+
49+
- name: store benchmark result artifacts
50+
uses: actions/upload-artifact@v4
51+
if: success() || failure()
52+
with:
53+
name: ${{ github.run_id }}-${{ inputs.label }}
54+
path: benchmark-results
55+
retention-days: 90
56+
57+
#######################################################
58+
# TODO (Varun) : Remove pause once things are automated
59+
- name: announce pause
60+
if: success() || failure()
61+
run: |
62+
M=${{ inputs.timeout }}
63+
R=$((M - 15))
64+
S=$((R * 60))
65+
echo "pausing for, ${R} minutes"
66+
67+
- name: pause workflow
68+
run: |
69+
M=${{ inputs.timeout }}
70+
R=$((M - 15))
71+
S=$((R * 60))
72+
sleep $S
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -u
5+
6+
if [ $# -ne 1 ];
7+
then
8+
echo "run_benchmarks needs exactly 1 argument - The output path to store the benchmark results"
9+
exit -1
10+
fi
11+
12+
output_directory=$1
13+
14+
touch $ouptut_directory/bench_test_1.txt
15+
touch $ouptut_directory/bench_test_2.txt

0 commit comments

Comments
 (0)