-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial benchmark workflow file and script to extract sycl-bench …
…results
- Loading branch information
1 parent
be1c049
commit 8186182
Showing
2 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Benchmark on self-hosted runners | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
|
||
jobs: | ||
run-benchmark: | ||
if: ${{ github.event.label.name == 'benchmark' }} | ||
runs-on: [self-hosted, gpu-nvidia] | ||
strategy: | ||
matrix: | ||
clang_version: ['15'] | ||
cuda: ['11.0'] | ||
sycl_bench_program: ['scalar_prod', '2DConvolution'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build AdaptiveCpp | ||
run: | | ||
mkdir build && cd build | ||
cmake -DCMAKE_CXX_COMPILER=/usr/bin/clang++-${{matrix.clang_version}} -DCLANG_EXECUTABLE_PATH=/usr/bin/clang++-${{matrix.clang_version}} -DLLVM_DIR=/usr/lib/llvm-${{matrix.clang_version}}/cmake -DWITH_CUDA_BACKEND=ON -DWITH_ROCM_BACKEND=Off -DWITH_OPENCL_BACKEND=Off -DCMAKE_INSTALL_PREFIX=`pwd`/install -DCUDA_TOOLKIT_ROOT_DIR=/opt/cuda-${{matrix.cuda}} .. | ||
make -j16 install | ||
cp /.singularity.d/libs/libcuda.* `pwd`/install/lib/ | ||
- name: Build sycl-bench | ||
run: | | ||
git clone https://github.com/bcosenza/sycl-bench.git | ||
cd sycl-bench | ||
mkdir build && cd build | ||
- name: Run benchmark | ||
run: | | ||
cd sycl-bench/build | ||
python3 ${GITHUB_WORKSPACE}/devops/sycl-bench_to_json.py ./${{matrix.sycl_bench_program}} | tee ${GITHUB_WORKSPACE}/output.json | ||
- name: Download previous benchmark data | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./cache | ||
key: ${{ runner.os }}-benchmark | ||
|
||
- name: Store new result | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
name: sycl-bench ${{matrix.sycl_bench_program}} benchmark | ||
tool: customSmallerIsBetter | ||
output-file-path: output.json | ||
external-data-json-path: ./cache/benchmark-data.json | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
comment-on-alert: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import subprocess | ||
import sys | ||
|
||
result = subprocess.run(sys.argv[1:], stdout=subprocess.PIPE) | ||
if result.returncode == 0: | ||
names = [] | ||
runtime_mean = [] | ||
runtime_stddev = [] | ||
|
||
|
||
for line in result.stdout.decode("utf-8").splitlines(): | ||
if line.startswith("****"): | ||
# The name of the benchmark is always printed as ***** name***** | ||
names.append([s for s in line.split("*") if s != ''][0].strip()) | ||
|
||
if line.startswith("run-time-mean"): | ||
runtime_mean.append(line.split(" ")[1]) | ||
|
||
if line.startswith("run-time-stddev"): | ||
runtime_stddev.append(line.split(" ")[1]) | ||
|
||
assert(len(names) == len(runtime_mean)) | ||
assert(len(names) == len(runtime_stddev)) | ||
|
||
jsonstring = "" | ||
jsonstring += "[" | ||
|
||
for entry in zip(names, runtime_mean, runtime_stddev): | ||
jsonstring += "{" | ||
|
||
jsonstring += "\"name\":" | ||
jsonstring += "\"" + entry[0] + "\"" | ||
jsonstring += "," | ||
|
||
jsonstring += "\"unit\":\"s\"," | ||
|
||
jsonstring += "\"value\":" | ||
jsonstring += entry[1] | ||
jsonstring += "," | ||
|
||
jsonstring += "\"range\":" | ||
jsonstring += entry[2] | ||
|
||
jsonstring += "}," | ||
|
||
jsonstring = jsonstring[:-1] | ||
jsonstring += "]" | ||
|
||
print(jsonstring) |