-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add utilities for benchmarking different code versions #65
Changes from all commits
ee8de58
6a835ce
3df2a6e
4b52ac8
37b6898
af27522
933ced1
4155f8d
bc3b8e4
4c74162
8430d74
75c7bcb
c66766b
0ee66e8
61f4023
34b4642
b44da4e
f28e76e
c07a4b5
312b63f
09ccdf9
720ab69
f6b8176
d9f177d
6ba74d5
1b97754
fd35d2f
0edc4a3
0cfd065
490827e
fc756d7
40d2176
0d8e470
b86f994
317fa23
253becf
07efc80
f7fc294
b66e73f
d411d92
74bfd55
be94528
9152714
2b7a3cf
e2d9e72
0ec2c0a
6c38a26
919df5e
7ffba9a
d86155e
b99d390
766397f
a38da37
8aad904
51ab01e
b1f2db8
34de947
9b5c344
35d9014
0a4b2b9
3359c45
f6e2c25
b8b6fc4
8ded032
fb9bd9d
c9b6cbb
1b5e9cc
e4d7ad0
67d5567
e82b877
d4ce3cb
3a1c72d
26cedb3
89521e9
a7a8027
76e192c
ef2d466
a308b98
de71fd4
098ffcd
79f80ab
56e91e8
9381b79
353a473
4cb4791
fd9b13c
f2a2134
6880980
7edd9cc
489d36a
7152c45
01ca5ea
7155522
8d9405c
fa12368
fafe94b
f3d8eda
b877edb
fa7f0a9
f65664e
fcbcee4
c8d020a
098da1d
862f0e6
48e0e09
a94e42a
5fdd657
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
#!/bin/python3 | ||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Missing module docstring Warning test
Missing module docstring
Check warning Code scanning / Pylint (reported by Codacy) Missing module docstring Warning test
Missing module docstring
|
||
|
||
import os | ||
import subprocess | ||
import sys | ||
|
||
def parse_args() -> tuple: | ||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Missing function or method docstring Warning test
Missing function or method docstring
Check warning Code scanning / Pylint (reported by Codacy) Missing function docstring Warning test
Missing function docstring
|
||
path = sys.argv[2] | ||
Check notice Code scanning / Pylintpython3 (reported by Codacy) Unused variable 'path' Note test
Unused variable 'path'
Check notice Code scanning / Pylint (reported by Codacy) Unused variable 'path' Note test
Unused variable 'path'
|
||
Check warning Code scanning / Prospector (reported by Codacy) Unused variable 'path' (unused-variable) Warning test
Unused variable 'path' (unused-variable)
|
||
flags = [] | ||
Check notice Code scanning / Pylintpython3 (reported by Codacy) Redefining name 'flags' from outer scope (line 22) Note test
Redefining name 'flags' from outer scope (line 22)
Check notice Code scanning / Pylint (reported by Codacy) Redefining name 'flags' from outer scope (line 22) Note test
Redefining name 'flags' from outer scope (line 22)
|
||
values = [] | ||
Check notice Code scanning / Pylintpython3 (reported by Codacy) Redefining name 'values' from outer scope (line 22) Note test
Redefining name 'values' from outer scope (line 22)
Check notice Code scanning / Pylint (reported by Codacy) Redefining name 'values' from outer scope (line 22) Note test
Redefining name 'values' from outer scope (line 22)
|
||
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: | ||
Check warning Code scanning / Prospector (reported by Codacy) expected 2 blank lines after class or function definition, found 1 (E305) Warning test
expected 2 blank lines after class or function definition, found 1 (E305)
|
||
print("Usage: $0 <path> <version> <fork>") | ||
sys.exit(0) | ||
|
||
flags, values = parse_args() | ||
Check warning Code scanning / Pylint (reported by Codacy) Constant name "flags" doesn't conform to UPPER_CASE naming style Warning test
Constant name "flags" doesn't conform to UPPER_CASE naming style
Check warning Code scanning / Pylint (reported by Codacy) Constant name "values" doesn't conform to UPPER_CASE naming style Warning test
Constant name "values" doesn't conform to UPPER_CASE naming style
|
||
if '--fork' in flags: | ||
fork = values[flags.index('--fork')] | ||
Check warning Code scanning / Pylint (reported by Codacy) Constant name "fork" doesn't conform to UPPER_CASE naming style Warning test
Constant name "fork" doesn't conform to UPPER_CASE naming style
|
||
else: | ||
fork = 'cms-patatrack' | ||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Constant name "fork" doesn't conform to UPPER_CASE naming style Warning test
Constant name "fork" doesn't conform to UPPER_CASE naming style
Check warning Code scanning / Pylint (reported by Codacy) Constant name "fork" doesn't conform to UPPER_CASE naming style Warning test
Constant name "fork" doesn't conform to UPPER_CASE naming style
|
||
if '--commit' in flags: | ||
is_commit = True | ||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Constant name "is_commit" doesn't conform to UPPER_CASE naming style Warning test
Constant name "is_commit" doesn't conform to UPPER_CASE naming style
Check warning Code scanning / Pylint (reported by Codacy) Constant name "is_commit" doesn't conform to UPPER_CASE naming style Warning test
Constant name "is_commit" doesn't conform to UPPER_CASE naming style
|
||
is_branch = False | ||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Constant name "is_branch" doesn't conform to UPPER_CASE naming style Warning test
Constant name "is_branch" doesn't conform to UPPER_CASE naming style
Check warning Code scanning / Pylint (reported by Codacy) Constant name "is_branch" doesn't conform to UPPER_CASE naming style Warning test
Constant name "is_branch" doesn't conform to UPPER_CASE naming style
|
||
version = values[flags.index('--commit')] | ||
Check warning Code scanning / Pylint (reported by Codacy) Constant name "version" doesn't conform to UPPER_CASE naming style Warning test
Constant name "version" doesn't conform to UPPER_CASE naming style
|
||
elif '--branch' in flags: | ||
is_commit = False | ||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Constant name "is_commit" doesn't conform to UPPER_CASE naming style Warning test
Constant name "is_commit" doesn't conform to UPPER_CASE naming style
Check warning Code scanning / Pylint (reported by Codacy) Constant name "is_commit" doesn't conform to UPPER_CASE naming style Warning test
Constant name "is_commit" doesn't conform to UPPER_CASE naming style
|
||
is_branch = True | ||
Check warning Code scanning / Pylintpython3 (reported by Codacy) Constant name "is_branch" doesn't conform to UPPER_CASE naming style Warning test
Constant name "is_branch" doesn't conform to UPPER_CASE naming style
Check warning Code scanning / Pylint (reported by Codacy) Constant name "is_branch" doesn't conform to UPPER_CASE naming style Warning test
Constant name "is_branch" doesn't conform to UPPER_CASE naming style
|
||
version = values[flags.index('--branch')] | ||
Check warning Code scanning / Pylint (reported by Codacy) Constant name "version" doesn't conform to UPPER_CASE naming style Warning test
Constant name "version" doesn't conform to UPPER_CASE naming style
|
||
|
||
clue_version = f"CLUEstering_{fork}_{version}" | ||
Check warning Code scanning / Pylint (reported by Codacy) Constant name "clue_version" doesn't conform to UPPER_CASE naming style Warning test
Constant name "clue_version" doesn't conform to UPPER_CASE naming style
|
||
|
||
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" | ||
Check warning Code scanning / Pylint (reported by Codacy) Constant name "repo_url" doesn't conform to UPPER_CASE naming style Warning test
Constant name "repo_url" doesn't conform to UPPER_CASE naming style
|
||
# Checkout the repo | ||
os.system("mkdir -p " + clue_version) | ||
Check notice Code scanning / Bandit (reported by Codacy) Starting a process with a shell, possible injection detected, security issue. Note test
Starting a process with a shell, possible injection detected, security issue.
|
||
|
||
clone = subprocess.run(["git", | ||
Check notice Code scanning / Pylintpython3 (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. Note test
Using subprocess.run without explicitly set check is not recommended.
Check warning Code scanning / Pylint (reported by Codacy) Constant name "clone" doesn't conform to UPPER_CASE naming style Warning test
Constant name "clone" doesn't conform to UPPER_CASE naming style
|
||
Check warning Code scanning / Prospector (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check) Warning test
Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check)
Check notice Code scanning / Bandit (reported by Codacy) Starting a process with a partial executable path Note test
Starting a process with a partial executable path
Check notice Code scanning / Bandit (reported by Codacy) subprocess call - check for execution of untrusted input. Note test
subprocess call - check for execution of untrusted input.
|
||
"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 " + | ||
Check notice Code scanning / Bandit (reported by Codacy) Starting a process with a shell, possible injection detected, security issue. Note test
Starting a process with a shell, possible injection detected, security issue.
|
||
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", | ||
Check notice Code scanning / Pylintpython3 (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. Note test
Using subprocess.run without explicitly set check is not recommended.
Check warning Code scanning / Pylint (reported by Codacy) Constant name "compile_debug" doesn't conform to UPPER_CASE naming style Warning test
Constant name "compile_debug" doesn't conform to UPPER_CASE naming style
|
||
Check warning Code scanning / Prospector (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check) Warning test
Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check)
Check notice Code scanning / Bandit (reported by Codacy) Starting a process with a partial executable path Note test
Starting a process with a partial executable path
Check notice Code scanning / Bandit (reported by Codacy) subprocess call - check for execution of untrusted input. Note test
subprocess call - check for execution of untrusted input.
|
||
"-B", | ||
"build", | ||
"-DCMAKE_BUILD_TYPE=Debug"], | ||
capture_output=True, | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
text=True) | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
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", | ||
Check notice Code scanning / Pylintpython3 (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. Note test
Using subprocess.run without explicitly set check is not recommended.
Check warning Code scanning / Pylint (reported by Codacy) Constant name "compile_debug" doesn't conform to UPPER_CASE naming style Warning test
Constant name "compile_debug" doesn't conform to UPPER_CASE naming style
|
||
Check warning Code scanning / Prospector (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check) Warning test
Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check)
Check notice Code scanning / Bandit (reported by Codacy) Starting a process with a partial executable path Note test
Starting a process with a partial executable path
Check notice Code scanning / Bandit (reported by Codacy) subprocess call - check for execution of untrusted input. Note test
subprocess call - check for execution of untrusted input.
|
||
"--build", | ||
"build", | ||
"--", | ||
"-j", | ||
"2"], | ||
capture_output=True, | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
text=True) | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
compile_debug = subprocess.run(["cmake", | ||
Check notice Code scanning / Pylintpython3 (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. Note test
Using subprocess.run without explicitly set check is not recommended.
Check warning Code scanning / Pylint (reported by Codacy) Constant name "compile_debug" doesn't conform to UPPER_CASE naming style Warning test
Constant name "compile_debug" doesn't conform to UPPER_CASE naming style
|
||
Check warning Code scanning / Prospector (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check) Warning test
Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check)
Check notice Code scanning / Bandit (reported by Codacy) Starting a process with a partial executable path Note test
Starting a process with a partial executable path
Check notice Code scanning / Bandit (reported by Codacy) subprocess call - check for execution of untrusted input. Note test
subprocess call - check for execution of untrusted input.
|
||
"-B", | ||
"build"], | ||
capture_output=True, | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
text=True) | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
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", | ||
Check notice Code scanning / Pylintpython3 (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. Note test
Using subprocess.run without explicitly set check is not recommended.
Check warning Code scanning / Pylint (reported by Codacy) Constant name "compile_release" doesn't conform to UPPER_CASE naming style Warning test
Constant name "compile_release" doesn't conform to UPPER_CASE naming style
|
||
Check warning Code scanning / Prospector (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check) Warning test
Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check)
Check notice Code scanning / Bandit (reported by Codacy) subprocess call - check for execution of untrusted input. Note test
subprocess call - check for execution of untrusted input.
Check notice Code scanning / Bandit (reported by Codacy) Starting a process with a partial executable path Note test
Starting a process with a partial executable path
|
||
"-B", | ||
"build", | ||
"-DCMAKE_BUILD_TYPE=Release"], | ||
capture_output=True, | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
text=True) | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
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", | ||
Check notice Code scanning / Pylintpython3 (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. Note test
Using subprocess.run without explicitly set check is not recommended.
Check warning Code scanning / Pylint (reported by Codacy) Constant name "compile_release" doesn't conform to UPPER_CASE naming style Warning test
Constant name "compile_release" doesn't conform to UPPER_CASE naming style
|
||
Check warning Code scanning / Prospector (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check) Warning test
Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check)
Check notice Code scanning / Bandit (reported by Codacy) subprocess call - check for execution of untrusted input. Note test
subprocess call - check for execution of untrusted input.
Check notice Code scanning / Bandit (reported by Codacy) Starting a process with a partial executable path Note test
Starting a process with a partial executable path
|
||
"--build", | ||
"build", | ||
"--", | ||
"-j", | ||
"2"], | ||
capture_output=True, | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
text=True) | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
compile_release = subprocess.run(["cmake", | ||
Check notice Code scanning / Pylintpython3 (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. Note test
Using subprocess.run without explicitly set check is not recommended.
Check warning Code scanning / Pylint (reported by Codacy) Constant name "compile_release" doesn't conform to UPPER_CASE naming style Warning test
Constant name "compile_release" doesn't conform to UPPER_CASE naming style
|
||
Check warning Code scanning / Prospector (reported by Codacy) Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check) Warning test
Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check)
Check notice Code scanning / Bandit (reported by Codacy) Starting a process with a partial executable path Note test
Starting a process with a partial executable path
Check notice Code scanning / Bandit (reported by Codacy) subprocess call - check for execution of untrusted input. Note test
subprocess call - check for execution of untrusted input.
|
||
"-B", | ||
"build", | ||
"-DCMAKE_BUILD_TYPE=Release"], | ||
capture_output=True, | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
text=True) | ||
Check warning Code scanning / Pylint (reported by Codacy) Wrong continued indentation (remove 1 space). Warning test
Wrong continued indentation (remove 1 space).
|
||
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.") |
Check notice
Code scanning / Bandit (reported by Codacy)
Consider possible security implications associated with subprocess module. Note test