-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add utilities for benchmarking different code versions (#65)
* Move benchmark data * Rework dataset size benchmark * Move data generation script * Move profiling code inside benchmark * Remove old scripts * Add script for fetching other CLUE versions for comparison * Update workflow for benchmark and profiling * Delete workflow for uploading log * Fix namespace name * Deactivate automatic profiling for now * Add small script for cache profiling with perf
- Loading branch information
Showing
38 changed files
with
2,196,776 additions
and
10,210 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,53 @@ | ||
name: Run benchmark and profiling | ||
|
||
# The workflow gets triggered by pushes and pull requests | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
# checks out the code in the repository | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install matplotlib | ||
- name: Compile and run benchmark | ||
working-directory: ${{ github.workspace }}/benchmark/dataset_size | ||
run: | | ||
cmake -B build -DCMAKE_BUILD_TYPE=Release | ||
cmake --build build -- -j 2 | ||
./build/serial.out 10 18 | ||
# TODO: this works on local but not on github actions | ||
# - name: Compile and run profiling | ||
# working-directory: ${{ github.workspace }}/benchmark/profiling | ||
# run: | | ||
# cmake -B build/Debug -DCMAKE_BUILD_TYPE=Debug | ||
# cmake --build build/Debug -- -j 2 | ||
# cmake -B build/Release -DCMAKE_BUILD_TYPE=Release | ||
# cmake --build build/Release -- -j 2 | ||
# ./build/Debug/serial.out ../../data/data_32768.csv | ||
# gprof ./build/Debug/serial.out ../../data/data_32768.csv | ||
# ./build/Release/serial.out ../../data/data_32768.csv | ||
# gprof ./build/Release/serial.out ../../data/data_32768.csv | ||
|
||
# - name: Check cache misses with perf | ||
# working-directory: ${{ github.workspace }}/benchmark/profiling | ||
# run: | | ||
# perf stat -B -e cache-misses,cycles,instructions,branches ./build/Debug/serial.out ../../data/data_32768.csv | ||
# perf stat -B -e cache-misses,cycles,instructions,branches ./build/Release/serial.out ../../data/data_32768.csv | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,126 @@ | ||
#!/bin/python3 | ||
|
||
import os | ||
import subprocess | ||
import sys | ||
|
||
def parse_args() -> tuple: | ||
path = sys.argv[2] | ||
flags = [] | ||
values = [] | ||
for arg in sys.argv[2:]: | ||
parsed = arg.split('=') | ||
flags.append(parsed[0]) | ||
values.append(parsed[1]) | ||
|
||
return (flags, values) | ||
|
||
if sys.argv[1] == "-h" or sys.argv[1] == "--help" or len(sys.argv) < 3: | ||
print("Usage: $0 <path> <version> <fork>") | ||
sys.exit(0) | ||
|
||
flags, values = parse_args() | ||
if '--fork' in flags: | ||
fork = values[flags.index('--fork')] | ||
else: | ||
fork = 'cms-patatrack' | ||
if '--commit' in flags: | ||
is_commit = True | ||
is_branch = False | ||
version = values[flags.index('--commit')] | ||
elif '--branch' in flags: | ||
is_commit = False | ||
is_branch = True | ||
version = values[flags.index('--branch')] | ||
|
||
clue_version = f"CLUEstering_{fork}_{version}" | ||
|
||
if is_commit: | ||
print(f"Fetching CLUEstering commit {version} from {fork}") | ||
if is_branch: | ||
print(f"Fetching CLUEstering branch {version} from {fork}") | ||
|
||
repo_url = f"https://github.com/{fork}/CLUEstering.git" | ||
# Checkout the repo | ||
os.system("mkdir -p " + clue_version) | ||
|
||
clone = subprocess.run(["git", | ||
"clone", | ||
repo_url, | ||
f"{clue_version}/Debug", | ||
"--recursive", | ||
"--depth=1"], capture_output=True, text=True) | ||
if clone.returncode != 0: | ||
print(f"Error: {clone.stderr}") | ||
print((f"Failed to clone the repo {repo_url}. Check that the insersted repository," | ||
"commit or branch are correct")) | ||
sys.exit(1) | ||
os.system("cp -r " + | ||
f"{clue_version}/Debug " + | ||
f"{clue_version}/Release") | ||
print(f"Cloned {clue_version} successfully") | ||
print('') | ||
print("Compiling the Debug version of the library") | ||
os.chdir(f"{clue_version}/Debug") | ||
# Compile the debug version | ||
compile_debug = subprocess.run(["cmake", | ||
"-B", | ||
"build", | ||
"-DCMAKE_BUILD_TYPE=Debug"], | ||
capture_output=True, | ||
text=True) | ||
if compile_debug.returncode != 0: | ||
print(f"Error: {compile_debug.stderr}") | ||
print("Failed to compile the debug version of the project") | ||
sys.exit(1) | ||
compile_debug = subprocess.run(["cmake", | ||
"--build", | ||
"build", | ||
"--", | ||
"-j", | ||
"2"], | ||
capture_output=True, | ||
text=True) | ||
compile_debug = subprocess.run(["cmake", | ||
"-B", | ||
"build"], | ||
capture_output=True, | ||
text=True) | ||
if compile_debug.returncode != 0: | ||
print(f"Error: {compile_debug.stderr}") | ||
print("Failed to compile the debug version of the project") | ||
sys.exit(1) | ||
print("Finished compiling the debug version.") | ||
print('') | ||
print("Compiling the Release version of the library") | ||
os.chdir("../Release") | ||
# Compile the release version | ||
compile_release = subprocess.run(["cmake", | ||
"-B", | ||
"build", | ||
"-DCMAKE_BUILD_TYPE=Release"], | ||
capture_output=True, | ||
text=True) | ||
if compile_release.returncode != 0: | ||
print(f"Error: {compile_release.stderr}") | ||
print("Failed to compile the release version of the project") | ||
sys.exit(1) | ||
compile_release = subprocess.run(["cmake", | ||
"--build", | ||
"build", | ||
"--", | ||
"-j", | ||
"2"], | ||
capture_output=True, | ||
text=True) | ||
compile_release = subprocess.run(["cmake", | ||
"-B", | ||
"build", | ||
"-DCMAKE_BUILD_TYPE=Release"], | ||
capture_output=True, | ||
text=True) | ||
if compile_release.returncode != 0: | ||
print(f"Error: {compile_release.stderr}") | ||
print("Failed to compile the release version of the project") | ||
sys.exit(1) | ||
print("Finished compiling the release version.") |
Oops, something went wrong.