-
Notifications
You must be signed in to change notification settings - Fork 787
[DO NOT MERGE] Test PR for new benchmarking workflow #14351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
45273c1
Added a preliminary benchmark workflow
ianayl 7e56b6c
Fixed typo
ianayl 5c8a4c9
bug fix
ianayl 203e6f8
Bug fix
ianayl 60e8d40
Experimentation
ianayl 3e30dff
Prevent actions/checkout@v4 from overriding my current folder's contents
ianayl b5593d7
Added script to run benchmarks
ianayl 05b2e2f
Bug fix
ianayl efa88cb
Amend lack of column in ubuntu util-linux
ianayl 4998a47
Update repos before proceeding
ianayl d381136
trying to fix networking
ianayl f5ba150
Abort fixing networking, checking current results
ianayl 45fb5b6
Removed dependency on column
ianayl d5b60ae
Do not terminate after segfault
ianayl 03a6c02
Whatever shell this is using does not seem to appreciate newlines
ianayl 8062b73
This shell really hates newlines....
ianayl 83c41e4
Ubuntu docker images use dash as the default shell???
ianayl c4a0f3d
Reintroduce artifacts
ianayl 8c01f8c
Attempt to suppress segfault
ianayl 4c07e96
Temporarily disable other tests again to speed up testing
ianayl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
name: Run benchmarks (using sycl-bench) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
runner: | ||
type: string | ||
required: True | ||
image: | ||
type: string | ||
required: True | ||
image_options: | ||
type: string | ||
required: True | ||
|
||
sycl_toolchain_artifact: | ||
type: string | ||
default: '' | ||
required: False | ||
sycl_toolchain_archive: | ||
type: string | ||
default: '' | ||
required: False | ||
sycl_toolchain_decompress_command: | ||
type: string | ||
default: '' | ||
required: False | ||
|
||
workflow_dispatch: | ||
inputs: | ||
runner: | ||
type: choice | ||
options: | ||
- '["Linux", "gen12"]' | ||
- '["amdgpu"]' | ||
- '["Linux", "arc"]' | ||
- '["cts-cpu"]' | ||
ianayl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
image: | ||
description: | | ||
Use option ending with ":build" for AMDGPU, ":latest" for the rest. | ||
type: choice | ||
options: | ||
- 'ghcr.io/intel/llvm/sycl_ubuntu2204_nightly:latest' | ||
- 'ghcr.io/intel/llvm/sycl_ubuntu2204_nightly:build' | ||
image_options: | ||
description: | | ||
Use option with "--device=/dev/kfd" for AMDGPU, without it for the rest. | ||
type: choice | ||
options: | ||
- '-u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN' | ||
- '-u 1001 --device=/dev/dri --device=/dev/kfd --privileged --cap-add SYS_ADMIN' | ||
|
||
sycl_toolchain_artifact: | ||
type: string | ||
default: '' | ||
required: False | ||
sycl_toolchain_archive: | ||
type: string | ||
default: '' | ||
required: False | ||
sycl_toolchain_decompress_command: | ||
type: string | ||
default: '' | ||
required: False | ||
|
||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
run: | ||
name: Run benchmarks using sycl-bench | ||
runs-on: ${{ fromJSON(inputs.runner || '["Linux", "gen12"]') }} | ||
container: | ||
image: ${{ inputs.image }} | ||
options: ${{ inputs.image_options }} | ||
steps: | ||
- name: Download SYCL toolchain | ||
if: inputs.sycl_toolchain_artifact != '' && github.event_name != 'workflow_run' | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.sycl_toolchain_artifact }} | ||
- name: Debug prints [workflow_run] | ||
if: inputs.sycl_toolchain_artifact != '' && github.event_name == 'workflow_run' | ||
run: | | ||
pwd | ||
ianayl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ls | ||
- name: Download SYCL toolchain [workflow_run] | ||
if: inputs.sycl_toolchain_artifact != '' && github.event_name == 'workflow_run' | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const name = '${{ inputs.sycl_toolchain_artifact }}' | ||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: context.payload.workflow_run.id, | ||
}); | ||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == name | ||
})[0]; | ||
let download = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
let fs = require('fs'); | ||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/` + name + '.zip', Buffer.from(download.data)); | ||
- name: Unzip artifact [workflow_run] | ||
if: inputs.sycl_toolchain_artifact != '' && github.event_name == 'workflow_run' | ||
run: | | ||
pwd | ||
ls | ||
unzip ${{ inputs.sycl_toolchain_artifact }}.zip | ||
rm ${{ inputs.sycl_toolchain_artifact }}.zip | ||
- name: Extract/Setup SYCL toolchain | ||
if: inputs.sycl_toolchain_artifact != '' | ||
run: | | ||
mkdir toolchain | ||
tar -I '${{ inputs.sycl_toolchain_decompress_command }}' -xf ${{ inputs.sycl_toolchain_archive }} -C toolchain | ||
rm -f ${{ inputs.sycl_toolchain_archive }} | ||
echo PATH=$PWD/toolchain/bin/:$PATH >> $GITHUB_ENV | ||
echo SYCL_ARTIFACT_PATH="$PWD/toolchain/" >> $GITHUB_ENV | ||
echo LD_LIBRARY_PATH=$PWD/toolchain/lib/:$LD_LIBRARY_PATH >> $GITHUB_ENV | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: 'ianayl/sycl-bench' | ||
clean: false # Prevents actions/checkout@v4 from deleting the extracted artifact | ||
path: './sycl-bench/' | ||
- name: Build sycl-bench | ||
run: | | ||
cd ./sycl-bench | ||
cmake -DSYCL_IMPL=dpcpp -DCMAKE_CXX_COMPILER=$SYCL_ARTIFACT_PATH/bin/clang++ -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=./bin -S . -B ./build && | ||
cmake --build ./build | ||
cd - | ||
echo LD_LIBRARY_PATH=$SYCL_ARTIFACT_PATH/lib/:$LD_LIBRARY_PATH >> $GITHUB_ENV | ||
- name: Run sycl-bench tests | ||
id: run-benchmarks | ||
run: | | ||
# Determine the index of a column in a CSV given its title | ||
# Usage: get_csv_col_index <benchmark output .csv file> <column name> | ||
get_csv_col_index() { | ||
tmp_csv_col_i="$(cat "$1" | head -n 1 | grep -o "^.*$2," | grep -o ',' | wc -l)" | ||
} | ||
|
||
# Usage: print_bench_res <benchmark output .csv file> <benchmark status code> <summary file> | ||
print_bench_res() { | ||
if [ ! -s $1 ]; then | ||
printf "NO OUTPUT! (Status $2)\n" | tee -a $3 | ||
return # Do not proceed if file is empty | ||
fi | ||
|
||
get_csv_col_index $1 run-time-mean | ||
tmp_run_time_mean_i=$tmp_csv_col_i | ||
get_csv_col_index $1 run-time-median | ||
tmp_run_time_median_i=$tmp_csv_col_i | ||
get_csv_col_index $1 run-time-throughput | ||
tmp_run_time_throughput_i=$tmp_csv_col_i | ||
|
||
# `sycl-bench` output seems to like inserting the header multiple times. | ||
# Here we cache the header to make sure it prints only once: | ||
tmp_header_title="$(cat $1 | head -n 1 | sed 's/^\# Benchmark name/benchmark/')" | ||
tmp_result="$(cat $1 | grep '^[^\#]')" | ||
|
||
printf "%s\n%s" "$tmp_header_title" "$tmp_result" \ | ||
| awk -F',' -v me="$tmp_run_time_mean_i" \ | ||
-v md="$tmp_run_time_median_i" \ | ||
-v th="$tmp_run_time_throughput_i" \ | ||
'{printf "%-57s %-13s %-15s %-20s\n", $1, $me, $md, $th }' \ | ||
| tee -a $3 # Print to summary file | ||
} | ||
|
||
# run sycl bench step | ||
run() { | ||
TIMESTAMP="$(date '+%Y%m%d_%H%M%S')" | ||
mkdir "./sycl-bench/build/bench-$TIMESTAMP/" | ||
tmp_summary_file="./sycl-bench/build/bench-$TIMESTAMP/summary.txt" | ||
|
||
for file in ./sycl-bench/build/bin/*; do | ||
# TODO -size should not be always 256, caution | ||
tmp_bench_output="./sycl-bench/build/bench-$TIMESTAMP/$(basename $file).csv" | ||
tmp_bench_log="./sycl-bench/build/bench-$TIMESTAMP/$(basename $file).log" | ||
|
||
tmp_err="0" | ||
printf "\n### Results for $(basename $file) ###\n" | tee -a $tmp_summary_file | ||
$file --output=$tmp_bench_output --no-verification --size=256 2> "$tmp_bench_log" || tmp_err=$? | ||
print_bench_res $tmp_bench_output $tmp_err $tmp_summary_file | ||
# Remove log if nothing logged | ||
[ ! -s "$tmp_bench_log" ] && rm "$tmp_bench_log" || cat "$tmp_bench_log" | tee -a $tmp_summary_file | ||
done | ||
|
||
# Export timestamp for later use | ||
echo TIMESTAMP=$TIMESTAMP >> $GITHUB_ENV | ||
} | ||
|
||
run | ||
- name: Check results | ||
if: steps.run-benchmarks.outcome == 'success' | ||
run: | | ||
cat "./sycl-bench/build/bench-$TIMESTAMP/summary.txt" | ||
- name: Pack results | ||
if: steps.run-benchmarks.outcome == 'success' | ||
id: pack_results | ||
run: | | ||
ARCHIVE_PATH="./sycl-bench/build/bench-$TIMESTAMP.tar.gz" | ||
tar -I gzip -cf "$ARCHIVE_PATH" -C "./sycl-bench/build/bench-$TIMESTAMP" . | ||
echo ARCHIVE_PATH="$ARCHIVE_PATH" >> $GITHUB_OUTPUT | ||
- name: Upload results | ||
if: steps.run-benchmarks.outcome == 'success' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: sycl_benchmark_res_${{ env.TIMESTAMP }} | ||
path: ${{ steps.pack_results.outputs.ARCHIVE_PATH }} | ||
retention-days: 7 |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.