Skip to content

Commit

Permalink
remove Intel TBB dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
KRM7 committed Sep 24, 2023
1 parent 649075a commit 646ad78
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
{ name: cppcheck, cmake-flag: CMAKE_CXX_CPPCHECK="cppcheck;--version;--verbose;--report-progress;--enable=all;--error-exitcode=1;--std=c++20;--suppressions-list=../.cppcheck-supressions" }
]
include:
- pkgs: clang-15 llvm-15-dev libclang-15-dev clang-tools-15 clang-tidy-15 iwyu cppcheck
- pkgs: clang-15 clang-tools-15 clang-tidy-15 iwyu cppcheck
cxx: clang++-15

defaults:
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
strategy:
matrix:
include:
- pkgs: clang-15 libtbb-dev
- pkgs: clang-15
cxx: clang++-15

name: codeql
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
matrix:
build-type: [ Release, RelWithDebInfo ]
compiler: [
{ cxx: g++-11, pkgs: g++-11 libtbb-dev },
{ cxx: g++-12, pkgs: g++-12 libtbb-dev },
{ cxx: clang++-14, pkgs: clang-14 libtbb-dev },
{ cxx: clang++-15, pkgs: clang-15 libtbb-dev },
{ cxx: g++-11, pkgs: g++-11 },
{ cxx: g++-12, pkgs: g++-12 },
{ cxx: clang++-14, pkgs: clang-14 },
{ cxx: clang++-15, pkgs: clang-15 },
]

defaults:
Expand All @@ -37,7 +37,7 @@ jobs:
- name: setup-build
env:
CXX: ${{ matrix.compiler.cxx }}
run: cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DGAPP_LINK_TBB=ON -DBUILD_SHARED_LIBS=OFF
run: cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DBUILD_SHARED_LIBS=OFF

- name: build
run: cmake --build . --parallel 8
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
sanitizer: [ address, undefined, thread ]
include:
- cxx: clang++-15
pkgs: clang-15 llvm-15 libtbb-dev
pkgs: clang-15 llvm-15

env:
ASAN_OPTIONS: check_initialization_order=1:strict_init_order=1:detect_stack_use_after_return=1:detect_leaks=1
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
- name: setup-build
env:
CXX: ${{ matrix.cxx }}
run: cmake .. -DGAPP_LINK_TBB=ON -DGAPP_CXX_FLAGS="-fsanitize=${{ matrix.sanitizer }} -g -fno-omit-frame-pointer"
run: cmake .. -DGAPP_CXX_FLAGS="-fsanitize=${{ matrix.sanitizer }} -g -fno-omit-frame-pointer"

- name: build
run: cmake --build . --parallel
Expand Down
14 changes: 0 additions & 14 deletions .tsan-supressions
Original file line number Diff line number Diff line change
@@ -1,14 +0,0 @@
race:^tbb::detail::d1::node::node
race:^tbb::detail::d1::tree_node::tree_node

race:^tbb::detail::d1::blocked_range<*>::size
race:^tbb::detail::d1::blocked_range<*>::is_divisible
race:^tbb::detail::d1::auto_partition_type::is_divisible

race:tbb::detail::d1::small_object_allocator::new_object
race:tbb::detail::d1::small_object_allocator::delete_object

race:tbb::detail::d1::dynamic_grainsize_mode<*>::check_being_stolen

race:tbb::detail::d1::start_for<*>::finalize
race:tbb::detail::d1::start_for<*>::offer_work_impl
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ option(GAPP_USE_LTO "Use link time optimizations for the library." ON)
option(GAPP_USE_MARCH_NATIVE "Optimize for the host architecture in release builds (only used for gcc and clang)." OFF)
option(GAPP_DISABLE_EXCEPTIONS "Disable exception support when building the library." OFF)
option(GAPP_DISABLE_RTTI "Disable run-time type information when building the library." OFF)
option(GAPP_LINK_TBB "Link Intel's TBB library (needed for the parallel stl algorithms when using gcc/clang)." OFF)


set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build")
Expand Down Expand Up @@ -141,12 +140,6 @@ target_compile_features(gapp PUBLIC "cxx_std_20")
target_compile_definitions(gapp PUBLIC "$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:GAPP_BUILD_STATIC>")
target_compile_options(gapp PUBLIC "$<$<CXX_COMPILER_ID:MSVC>:-Zc:preprocessor>")

# Dependencies
find_package(TBB)
if(TBB_FOUND AND GAPP_LINK_TBB AND NOT MSVC)
target_link_libraries(gapp PUBLIC "TBB::tbb")
endif()


# Install
install(TARGETS gapp EXPORT gapp-config
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ The following are needed for building and using the library:

- C++20 compiler (gcc 11.0, clang 14.0, msvc 14.30 or later)
- CMake 3.21 or later
- Intel TBB (optional, depending on the standard library implementation)
- Catch2 3.3 or later (optional, only needed for the tests)


Expand Down
22 changes: 3 additions & 19 deletions docs/install-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,17 @@
## Requirements

You will need a C++20 compiler and CMake to build and use the library.
There are no additional required dependencies, but there is an optional dependency
on [Intel's TBB](https://github.com/oneapi-src/oneTBB) library depending on your standard library
implementation, and [Catch2](https://github.com/catchorg/Catch2) is needed to build the tests.
There are no additional required dependencies, but [Catch2](https://github.com/catchorg/Catch2)
is needed to build the tests.

The full list of requirements are:

- C++20 compiler (gcc 11.0, clang 14.0, msvc 14.30 or later)
- CMake 3.21 or later
- Intel TBB (optional, depending on the standard library implementation)
- Catch2 3.3 or later (optional, only needed for the tests)

Intel's TBB library is needed depending on your standard library implementation
for the parallel algorithms that were introduced in C++17. The library depends on these
algorithms to parallelize certain operations, and without standard library support for these,
everything will run sequentially.

Specifically, for the 3 major standard library implementations:

- Microsoft's STL: Doesn't need TBB, the parallel algorithms are supported even without it
- libstdc++: Needs TBB for the algorithms to actually run in parallel
- libc++: Doesn't support C++17's parallel algorithms yet, so everything will be sequential either way

The library works on both Windows and Linux. Both of these platforms and all compilers mentioned
above are tested (gcc and clang on Linux, and msvc and clang-cl on Windows).
above are tested (gcc and clang on Linux, msvc and clang-cl on Windows).


## Install with CMake
Expand Down Expand Up @@ -192,9 +179,6 @@ target_link_libraries(example_project PRIVATE gapp::gapp)
- `GAPP_DISABLE_RTTI` - When this option is `ON`, the library will be built without run-time type information.
The default value is `OFF`.

- `GAPP_LINK_TBB` - When this option is `ON`, the project will attempt to link Intel's TBB library to the
library during the build. This option has no effect if TBB is not installed on the system, or if
CMake can't find it. The default value is `OFF`.

The options are specified during the configuration step of CMake, for example:

Expand Down

0 comments on commit 646ad78

Please sign in to comment.