Skip to content

Commit 70490ef

Browse files
committed
configure time error reporting for STDPAR feature and CI test
1 parent fd1305f commit 70490ef

3 files changed

Lines changed: 44 additions & 14 deletions

File tree

.github/workflows/builds.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
- os: ubuntu-22.04
1515
- os: ubuntu-22.04
1616
parallelisation: 'openmp'
17+
- os: ubuntu-22.04
18+
parallelisation: 'stdpar'
1719
env:
1820
BUILD_TYPE: Release
1921
CMAKE_FLAGS: >
@@ -33,6 +35,14 @@ jobs:
3335
sudo apt-get update
3436
sudo apt-get install -y xorg-dev libglu1-mesa-dev libgtk-3-dev
3537
38+
- name: Install oneapiTBB package
39+
if: matrix.os == 'ubuntu-22.04' && matrix.parallelisation == 'stdpar'
40+
run: |
41+
curl https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | sudo gpg --dearmor -o /usr/share/keyrings/oneapi-archive-keyring.gpg
42+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
43+
sudo apt-get update
44+
sudo apt-get install -y intel-oneapi-tbb-devel
45+
3646
- uses: actions/setup-python@v5
3747
with:
3848
python-version: '3.x'
@@ -59,6 +69,17 @@ jobs:
5969
-DSPIRIT_USE_OPENMP=ON
6070
$CMAKE_FLAGS
6171
72+
- name: Configure with STL parallelisation
73+
if: matrix.parallelisation == 'stdpar'
74+
shell: bash
75+
working-directory: ${{runner.workspace}}/build
76+
run: >
77+
cmake $GITHUB_WORKSPACE
78+
$BUILD_SYSTEM_FLAG
79+
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
80+
$CMAKE_FLAGS
81+
-DSPIRIT_USE_STDPAR=ON
82+
6283
- name: Build
6384
shell: bash
6485
working-directory: ${{runner.workspace}}/build

core/CMake/FindTBB.cmake

Lines changed: 0 additions & 11 deletions
This file was deleted.

core/CMakeLists.txt

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,34 @@ endif()
232232

233233
######### TBB decisions ############################################
234234
if( SPIRIT_USE_STDPAR )
235-
include( FindTBB )
235+
# Try to find TBB module
236+
find_package( TBB )
236237
if( TBB_FOUND )
237-
set( SPIRIT_COMPILE_DEFINITIONS ${SPIRIT_COMPILE_DEFINITIONS} -DSPIRIT_USE_STDPAR )
238+
set( TBB_LIB TBB::tbb )
238239
message( STATUS ">> using TBB for parallel STL" )
239240
else()
241+
set( TBB_LIB )
240242
message( WARNING ">> TBB could not be found." )
241-
set( SPIRIT_USE_STDPAR OFF )
242243
endif()
244+
# All of these symbols are required to use this feature.
245+
# So, if this compiles even if TBB was not found it should be fine.
246+
list( APPEND CMAKE_REQUIRED_LIBRARIES ${TBB_LIB} )
247+
include(CheckCXXSourceCompiles)
248+
check_cxx_source_compiles("
249+
#include <execution>
250+
int main()
251+
{
252+
(void)std::execution::seq;
253+
(void)std::execution::par;
254+
(void)std::execution::par_unseq;
255+
return 0;
256+
}
257+
" HAVE_CXX17_PARALLEL_ALGORITHM)
258+
259+
if( NOT HAVE_CXX17_PARALLEL_ALGORITHM )
260+
message( FATAL_ERROR "C++17 execution policies are required for SPIRIT_USE_STDPAR=ON" )
261+
endif()
262+
set( SPIRIT_COMPILE_DEFINITIONS ${SPIRIT_COMPILE_DEFINITIONS} -DSPIRIT_USE_STDPAR )
243263
endif()
244264
######### TBB decisions ############################################
245265

0 commit comments

Comments
 (0)