Skip to content

Commit 0656db5

Browse files
authored
Add benchmark scripts (#26)
A new script, benchmark.py has been added into the tools directory. It can run the Steppable executables while timing them, and outputs a graph about its performance compared to the system method.
2 parents a98633a + d6ddfcb commit 0656db5

26 files changed

+1285
-287
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.jpeg filter=lfs diff=lfs merge=lfs -text
2+
*.svg filter=lfs diff=lfs merge=lfs -text

.github/workflows/benchmark.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
3+
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
4+
name: Benchmark on multiple platforms
5+
on:
6+
push:
7+
branches: ["develop"]
8+
9+
pull_request:
10+
branches: ["main"]
11+
12+
workflow_dispatch:
13+
14+
jobs:
15+
graph:
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
19+
fail-fast: false
20+
# Set up a matrix to run the following 3 configurations:
21+
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
22+
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
23+
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
24+
#
25+
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
26+
matrix:
27+
os: [ubuntu-latest, macos-14]
28+
build_type: [Release]
29+
c_compiler: [clang]
30+
include:
31+
- os: ubuntu-latest
32+
c_compiler: clang
33+
cpp_compiler: clang++
34+
cmake_extra_options: '-GNinja'
35+
- os: macos-14
36+
c_compiler: clang
37+
cpp_compiler: clang++
38+
cmake_extra_options: '-GNinja'
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Set reusable strings
44+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
45+
id: strings
46+
shell: bash
47+
run: |
48+
echo "build-output-dir=${{ github.workspace }}/cmake-build" >> "$GITHUB_OUTPUT"
49+
echo "py-build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
50+
echo "CMAKE_C_COMPILER=${{ matrix.c_compiler }}" >> "$GITHUB_ENV"
51+
echo "CMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}" >> "$GITHUB_ENV"
52+
echo "CMAKE_OPTIONS=${{ matrix.cmake_extra_options }}" >> "$GITHUB_ENV"
53+
54+
- name: Set up Homebrew
55+
id: set-up-homebrew
56+
uses: Homebrew/actions/setup-homebrew@master
57+
58+
- name: Install LLVM
59+
run: |
60+
brew install llvm ninja
61+
echo "PATH=$(brew --prefix llvm)/bin:$PATH" >> "$GITHUB_ENV"
62+
63+
- name: Set up Python
64+
uses: actions/setup-python@v5
65+
with:
66+
cache: 'pip'
67+
python-version: '3.12'
68+
69+
- name: Install dependencies
70+
run: pip install .
71+
shell: bash
72+
73+
- name: Configure CMake
74+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
75+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
76+
run: cmake -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") -DPYTHON_EXECUTABLE:FILEPATH=`which python` -DSTP_BUILD_COMPONENT_EXECUTABLE=True
77+
shell: bash
78+
79+
- name: CMake Build
80+
# Build CMake in a 'build' subdirectory.
81+
run: cmake --build "${{github.workspace}}/build"
82+
shell: bash
83+
84+
- name: Benchmark
85+
run: python tools/benchmark.py -g
86+
shell: bash
87+
88+
- name: Upload Graphs
89+
uses: actions/[email protected]
90+
with:
91+
# Artifact name
92+
name: Benchmark ${{ matrix.os }}
93+
# A file, directory or wildcard pattern that describes what to upload
94+
path: ${{ github.workspace }}/tools/figures
Lines changed: 82 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,112 @@
1+
---
12
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
23
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
34
name: CMake on multiple platforms
4-
55
on:
66
push:
7-
branches: [ "develop" ]
8-
pull_request:
9-
branches: [ "main" ]
7+
branches: ["develop"]
8+
paths:
9+
- "**.cpp"
10+
- "**.hpp"
11+
- "**.py"
1012

13+
pull_request:
14+
branches: ["main"]
1115
jobs:
1216
build:
1317
runs-on: ${{ matrix.os }}
14-
1518
strategy:
1619
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
1720
fail-fast: false
18-
1921
# Set up a matrix to run the following 3 configurations:
2022
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
2123
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
2224
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
2325
#
2426
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
2527
matrix:
26-
os: [ ubuntu-latest, windows-latest, macos-12, macos-13, macos-14 ]
27-
build_type: [ Release ]
28-
c_compiler: [ clang, cl ]
29-
python_version: [ '3.10', '3.11', '3.12' ]
28+
os: [ubuntu-latest, windows-latest, macos-12, macos-13, macos-14]
29+
build_type: [Release]
30+
c_compiler: [clang, cl]
31+
python_version: ['3.10', '3.11', '3.12']
3032
include:
31-
- os: windows-latest
32-
c_compiler: cl
33-
cpp_compiler: cl
34-
cmake_extra_options: ''
35-
- os: ubuntu-latest
36-
c_compiler: clang
37-
cpp_compiler: clang++
38-
cmake_extra_options: '-GNinja'
33+
- os: windows-latest
34+
c_compiler: cl
35+
cpp_compiler: cl
36+
cmake_extra_options: ''
37+
- os: ubuntu-latest
38+
c_compiler: clang
39+
cpp_compiler: clang++
40+
cmake_extra_options: '-GNinja'
3941
# - os: macos-latest
4042
# c_compiler: gcc
4143
# cpp_compiler: g++
42-
- os: macos-12
43-
c_compiler: clang
44-
cpp_compiler: clang++
45-
cmake_extra_options: '-GNinja'
46-
- os: macos-13
47-
c_compiler: clang
48-
cpp_compiler: clang++
49-
cmake_extra_options: '-GNinja'
50-
- os: macos-14
51-
c_compiler: clang
52-
cpp_compiler: clang++
53-
cmake_extra_options: '-GNinja'
54-
44+
- os: macos-12
45+
c_compiler: clang
46+
cpp_compiler: clang++
47+
cmake_extra_options: '-GNinja'
48+
- os: macos-13
49+
c_compiler: clang
50+
cpp_compiler: clang++
51+
cmake_extra_options: '-GNinja'
52+
- os: macos-14
53+
c_compiler: clang
54+
cpp_compiler: clang++
55+
cmake_extra_options: '-GNinja'
5556
exclude:
56-
- os: windows-latest
57-
c_compiler: clang
58-
- os: ubuntu-latest
59-
c_compiler: cl
60-
- os: macos-12
61-
c_compiler: cl
62-
- os: macos-13
63-
c_compiler: cl
64-
- os: macos-14
65-
c_compiler: cl
66-
57+
- os: windows-latest
58+
c_compiler: clang
59+
- os: ubuntu-latest
60+
c_compiler: cl
61+
- os: macos-12
62+
c_compiler: cl
63+
- os: macos-13
64+
c_compiler: cl
65+
- os: macos-14
66+
c_compiler: cl
6767
steps:
68-
- uses: actions/checkout@v4
68+
- uses: actions/checkout@v4
69+
70+
- name: Set reusable strings
71+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
72+
id: strings
73+
shell: bash
74+
run: |
75+
echo "build-output-dir=${{ github.workspace }}/cmake-build" >> "$GITHUB_OUTPUT"
76+
echo "py-build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
77+
echo "CMAKE_C_COMPILER=${{ matrix.c_compiler }}" >> "$GITHUB_ENV"
78+
echo "CMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}" >> "$GITHUB_ENV"
79+
echo "CMAKE_OPTIONS=${{ matrix.cmake_extra_options }}" >> "$GITHUB_ENV"
80+
81+
- name: Set up Homebrew
82+
if: ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'ubuntu-latest'}}
83+
id: set-up-homebrew
84+
uses: Homebrew/actions/setup-homebrew@master
6985

70-
- name: Set reusable strings
71-
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
72-
id: strings
73-
shell: bash
74-
run: |
75-
echo "build-output-dir=${{ github.workspace }}/cmake-build" >> "$GITHUB_OUTPUT"
76-
echo "py-build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
77-
echo "CMAKE_C_COMPILER=${{ matrix.c_compiler }}" >> "$GITHUB_ENV"
78-
echo "CMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}" >> "$GITHUB_ENV"
79-
echo "CMAKE_OPTIONS=${{ matrix.cmake_extra_options }}" >> "$GITHUB_ENV"
86+
- name: Install LLVM
87+
if: ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'ubuntu-latest' }}
88+
run: |
89+
brew install llvm ninja
90+
echo "PATH=$(brew --prefix llvm)/bin:$PATH" >> "$GITHUB_ENV"
8091
81-
- name: Set up Homebrew
82-
if: ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'ubuntu-latest'}}
83-
id: set-up-homebrew
84-
uses: Homebrew/actions/setup-homebrew@master
92+
- name: Set up Python
93+
uses: actions/setup-python@v5
94+
with:
95+
cache: 'pip'
96+
python-version: ${{ matrix.python_version }}
8597

86-
- name: Install LLVM
87-
if: ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'ubuntu-latest' }}
88-
run: |
89-
brew install llvm ninja
90-
echo "PATH=$(brew --prefix llvm)/bin:$PATH" >> "$GITHUB_ENV"
98+
- name: Install dependencies
99+
run: pip install .
100+
shell: bash
91101

92-
- name: Set up Python
93-
uses: actions/setup-python@v5
94-
with:
95-
cache: 'pip'
96-
python-version: ${{ matrix.python_version }}
102+
- name: Python Build
103+
run: python setup.py build
104+
shell: bash
97105

98-
- name: Install packages
99-
run: pip install -r requirements.txt
100-
101-
- name: Python Build
102-
run: python setup.py build
103-
104-
- name: Upload Build Artifact (Python)
105-
uses: actions/[email protected]
106-
with:
107-
# Artifact name
108-
name: PyBuild ${{ matrix.os }}-cp${{ matrix.python_version }}
109-
# A file, directory or wildcard pattern that describes what to upload
110-
path: ${{ steps.strings.outputs.py-build-output-dir }}
106+
- name: Upload Build Artifact (Python)
107+
uses: actions/[email protected]
108+
with:
109+
# Artifact name
110+
name: PyBuild ${{ matrix.os }}-cp${{ matrix.python_version }}
111+
# A file, directory or wildcard pattern that describes what to upload
112+
path: ${{ steps.strings.outputs.py-build-output-dir }}

0 commit comments

Comments
 (0)