adding ad hoc run functionality #8
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: Run Bench Main | |
on: | |
workflow_dispatch: | |
inputs: | |
benchmark_config: | |
description: 'Benchmark configuration file (leave empty for default)' | |
required: false | |
default: '' | |
jdk_version: | |
description: 'Override JDK version (leave empty to use matrix)' | |
required: false | |
default: '' | |
push: | |
branches: | |
- github_actions | |
jobs: | |
test-avx512: | |
concurrency: | |
group: ${{ matrix.isa }}-${{ matrix.jdk }} | |
cancel-in-progress: false | |
strategy: | |
matrix: | |
jdk: [ 20, 24 ] | |
isa: [ isa-avx512f ] | |
runs-on: ${{ matrix.isa }} | |
steps: | |
- name: verify-avx512 | |
run: | | |
# avx2 is included just for illustration | |
required="avx2 avx512f avx512cd avx512bw avx512dq avx512v" | |
printf "required ISA feature flags: %s\n" "${required}" | |
flags="$(lscpu|grep '^Flags'|cut -d: -f2)" | |
output="" | |
for flag in ${required} ; do | |
if [[ " $flags " == *"${flag}"* ]] | |
then output="${output} $flag(OK)" | |
else output="${output} $flag(FAIL)" | |
fi ; done | |
printf "%s\n" ${output} | |
if [[ " $output " == *"FAIL"* ]] ; then exit 2 ; fi | |
- name: Set up GCC | |
run: | | |
sudo apt install -y gcc | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.jdk }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.jdk }} | |
distribution: temurin | |
cache: maven | |
- name: Build with Maven (JDK 20) | |
if: matrix.jdk == '20' | |
run: mvn -B -Pjdk20 package --file pom.xml | |
- name: Build with Maven (JDK 24) | |
if: matrix.jdk == '24' | |
run: mvn -B -Punix-amd64-profile package --file pom.xml | |
- name: Run Bench main | |
run: | | |
# Use the jar-with-dependencies which includes all required dependencies | |
java ${{ matrix.jdk >= 20 && '--enable-native-access=ALL-UNNAMED --add-modules=jdk.incubator.vector' || '' }} \ | |
${{ matrix.jdk >= 22 && '-Djvector.experimental.enable_native_vectorization=true' || '' }} \ | |
-jar jvector-examples/target/jvector-examples-*-jar-with-dependencies.jar --output bench-results.json | |
- name: Upload Bench Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bench-results-${{ matrix.isa }}-jdk${{ matrix.jdk }} | |
path: bench-results.json | |
- name: Download Previous Benchmark Results | |
uses: dawidd6/action-download-artifact@v2 | |
continue-on-error: true | |
with: | |
workflow: run-bench.yml | |
name: bench-results-${{ matrix.isa }}-jdk${{ matrix.jdk }} | |
path: previous-results | |
skip_unpack: false | |
if_no_artifact_found: warn | |
- name: Install Python Dependencies | |
run: | | |
pip install argparse | |
- name: Compare Benchmark Results | |
if: success() && hashFiles('previous-results/bench-results.json') != '' | |
run: | | |
python compare_benchmarks.py bench-results.json previous-results/bench-results.json --output benchmark-comparison.md | |
- name: Upload Comparison Report | |
if: success() && hashFiles('benchmark-comparison.md') != '' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: benchmark-comparison-${{ matrix.isa }}-jdk${{ matrix.jdk }} | |
path: benchmark-comparison.md |