Skip to content

Commit fc9590a

Browse files
authored
Optimize updatePath function with tbb (#260)
* Optimize updatePath function * Update version * Better * Parallelizing * What about evolving nodes in parallel * Trying to implement TBB * Fix mac installation * Will this fix workflows? * mb * Try to fix codeQL
1 parent 9d263b0 commit fc9590a

20 files changed

+171
-110
lines changed

.github/workflows/benchmark.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17+
- name: Update apt repo
18+
run: sudo apt update
19+
20+
- name: Install tools manually
21+
run: sudo apt install libtbb-dev
22+
1723
- uses: actions/checkout@v4
1824
with:
1925
submodules: true

.github/workflows/cmake_examples.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ jobs:
1818
runs-on: ${{ matrix.os }}
1919

2020
steps:
21+
- name: Install tools manually
22+
run: |
23+
if [ ${{ matrix.os }} == 'ubuntu-latest' ]; then
24+
sudo apt update
25+
sudo apt install libtbb-dev
26+
elif [ ${{ matrix.os }} == 'macos-latest' ]; then
27+
brew install tbb
28+
fi
29+
2130
- uses: actions/checkout@v4
2231

2332
- name: Configure CMake

.github/workflows/cmake_install.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14+
- name: Install tools manually
15+
run: sudo apt update && sudo apt install libtbb-dev
1416
- uses: actions/checkout@v4
1517

1618
- name: Build and install

.github/workflows/cmake_install_macos.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,22 @@ jobs:
1111
runs-on: macos-latest
1212

1313
steps:
14+
- name: Install tools manually
15+
run: brew install tbb
16+
17+
- name: Set environment variables
18+
run: |
19+
echo "CPLUS_INCLUDE_PATH=$(brew --prefix tbb)/include" >> $GITHUB_ENV
20+
echo "LIBRARY_PATH=$(brew --prefix tbb)/lib" >> $GITHUB_ENV
21+
echo "LD_LIBRARY_PATH=$(brew --prefix tbb)/lib" >> $GITHUB_ENV
22+
1423
- uses: actions/checkout@v4
1524

1625
- name: Build and install
1726
working-directory: ${{github.workspace}}
1827
run: |
1928
mkdir -p build && cd build
20-
cmake ..
29+
cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix tbb)
2130
cmake --build .
2231
sudo cmake --install .
2332
@@ -27,5 +36,6 @@ jobs:
2736
touch test.cpp
2837
echo "#include <dsm/dsm.hpp>" >> test.cpp
2938
echo "int main() {}" >> test.cpp
30-
g++ test.cpp -std=c++20 && echo "Compiled successfully" \
31-
|| (echo "Cannot include dsm" ; exit 1)
39+
g++ test.cpp -std=c++20 -I$(brew --prefix tbb)/include -L$(brew --prefix tbb)/lib -ltbb \
40+
&& echo "Compiled successfully" \
41+
|| (echo "Cannot include dsm" ; exit 1)

.github/workflows/cmake_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
run: sudo apt-get update
1919

2020
- name: Install tools manually
21-
run: sudo apt-get install lcov gcovr
21+
run: sudo apt install lcov gcovr libtbb-dev
2222

2323
- uses: actions/checkout@v4
2424

.github/workflows/cmake_test_macos.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ jobs:
1111
runs-on: macos-latest
1212

1313
steps:
14+
- name: Install tools manually
15+
run: brew install tbb
16+
1417
- uses: actions/checkout@v4
1518

1619
- name: Configure CMake

.github/workflows/codeql.yml

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,13 @@ on:
44
push:
55
branches: [ "main" ]
66
pull_request:
7-
# The branches below must be a subset of the branches above
87
branches: [ "main" ]
98
schedule:
109
- cron: '22 20 * * 5'
1110

1211
jobs:
1312
analyze:
1413
name: Analyze
15-
# Runner size impacts CodeQL analysis time. To learn more, please see:
16-
# - https://gh.io/recommended-hardware-resources-for-running-codeql
17-
# - https://gh.io/supported-runners-and-hardware-resources
18-
# - https://gh.io/using-larger-runners
19-
# Consider using larger runners for possible analysis time improvements.
2014
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
2115
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
2216
permissions:
@@ -28,47 +22,36 @@ jobs:
2822
fail-fast: false
2923
matrix:
3024
language: [ 'cpp' ]
31-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
32-
# Use only 'java' to analyze code written in Java, Kotlin or both
33-
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
34-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
3525

3626
steps:
3727
- name: Checkout repository
3828
uses: actions/checkout@v4
3929

40-
# Initializes the CodeQL tools for scanning.
30+
- name: Install TBB (MacOS & Ubuntu)
31+
run: |
32+
if [[ "$RUNNER_OS" == "macOS" ]]; then
33+
brew install tbb
34+
echo "CPLUS_INCLUDE_PATH=$(brew --prefix tbb)/include" >> $GITHUB_ENV
35+
echo "LIBRARY_PATH=$(brew --prefix tbb)/lib" >> $GITHUB_ENV
36+
echo "LD_LIBRARY_PATH=$(brew --prefix tbb)/lib" >> $GITHUB_ENV
37+
elif [[ "$RUNNER_OS" == "Linux" ]]; then
38+
sudo apt update && sudo apt install -y libtbb-dev
39+
fi
40+
4141
- name: Initialize CodeQL
4242
uses: github/codeql-action/init@v2
4343
with:
4444
languages: ${{ matrix.language }}
45-
# If you wish to specify custom queries, you can do so here or in a config file.
46-
# By default, queries listed here will override any specified in a config file.
47-
# Prefix the list here with "+" to use these queries and those in the config file.
48-
49-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
50-
# queries: security-extended,security-and-quality
51-
52-
53-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
54-
# If this step fails, then you should remove it and run the build manually (see below)
55-
# - name: Autobuild
56-
# uses: github/codeql-action/autobuild@v2
57-
58-
# ℹ️ Command-line programs to run using the OS shell.
59-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
60-
61-
# If the Autobuild fails above, remove it and uncomment the following three lines.
62-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
63-
64-
# - run: |
65-
# echo "Run, Build Application using script"
66-
# ./location_of_script_within_repo/buildscript.sh
6745

68-
- run: |
69-
echo "Build C++"
46+
- name: Build C++
47+
run: |
7048
mkdir -p build && cd build
71-
cmake ..
49+
if [[ "$RUNNER_OS" == "macOS" ]]; then
50+
cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix tbb)
51+
else
52+
cmake ..
53+
fi
54+
cmake --build .
7255
sudo make install
7356
7457
- name: Perform CodeQL Analysis

.github/workflows/profile_exec_time.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17+
- name: Install tools manually
18+
run: sudo apt update && sudo apt install libtbb-dev
1719
- uses: actions/checkout@v4
1820

1921
- name: Build test simulation

.github/workflows/profile_mem_usage.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17+
- name: Install tools manually
18+
run: sudo apt update && sudo apt install libtbb-dev
1719
- uses: actions/checkout@v4
1820

1921
- name: Install valgrind

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ set(CMAKE_CXX_STANDARD 20)
77
set(CMAKE_CXX_STANDARD_REQUIRED ON)
88
set(CMAKE_CXX_EXTENSIONS OFF)
99

10+
find_package(TBB REQUIRED CONFIG)
11+
1012
file(GLOB SOURCES "src/dsm/sources/*.cpp" "src/dsm/utility/*.cpp")
1113

1214
add_library(dsm STATIC ${SOURCES})
1315
target_include_directories(dsm PUBLIC
1416
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/headers>
1517
$<INSTALL_INTERFACE:include>
1618
)
19+
target_link_libraries(dsm PRIVATE TBB::tbb)
1720

1821
install(TARGETS dsm
1922
EXPORT dsmConfig

0 commit comments

Comments
 (0)