Resolve "Parallelize synchronous `apply_rule`" with pSTL
What does this MR do?
Provide parallel features for Utopia.
Build System
- Add TBB as optional dependency.
- Add CMake function
enable_parallel()
for enabling parallel features through a pre-processor definition on targets. - Enable parallelism on models by default, which can be reverted using the new
DISABLE_PARALLEL
option ofadd_model()
.
Parallel Functions
- Add header
parallel.hh
, defining types and functions for deciding parallel execution at runtime. - Add overloads for STL algorithms
copy()
,for_each()
, andtransform()
. - Add tests for these overloads and parallel functionality in general, see
CORE_test_parallel_stl
.
apply_rule()
Parallel - Extend
apply_rule()
interface for manual state update byUtopia::ExecPolicy
parameter for indicating execution policy to use when applying a rule. - Use parallel features inside
apply_rule()
where obviously possible. - Add
apply_rule()
overloads without execution policy parameter for backwards compatibility, which call the respective sequential version.
Documentation
- Document parallel features in Doxygen docs. Add submodule for STL algorithm overloads.
Is there something that needs to be double checked?
- I only added documentation to the Doxygen docs. Should we move/copy some of that into the Sphinx docs?
- Do we need a test for the addition of the
base_cfg
parameter? - So far we only test if
CORE_apply_test
works with parallel features enabled. This only includes "internal" parallelization, as all function calls use sequential overloads. Do we need a dedicated test for calls includingUtopia::ExecPolicy
?
Can this MR be accepted?
-
Add TBB to Docker base image -
Build Docker base image eoan-v2
-
Protect CI Variables again
-
-
Implement changes -
Handle parallel features in build system -
Implement runtime parallelism -
Make apply_rule()
parallel-aware
-
-
Add tests -
Check Utopia-internal parallel features -
Confirm parallel STL algorithms yield expected results -
Confirm that sequential apply_rule()
works the same with parallel features enabled
-
-
Reasonably up-to-date with current master -
Pipeline passing without warnings -
Checked test code coverage on new and adjusted code: 100% line coverage -
History cleaned-up -
Approved by @blsqr
Related issues
Closes #27 (closed)
Edited by Utopia Developers