'Is there a end-user interface to the parallel STL implementation `pstl`, like std::sort(pstl::execution::parallel, ...)?

There's this project called pstl which implements parallel execution for the stl algorithms. These days, it seems to live in the LLVM repository.

This implementation seems to be internally used by some standard library implementations, notably e.g. GNU libstdc++.

It supports multiple backends, like OpenMP and TBB.

In our project, we would now like to use this functionality (like std::sort(std::execution::par, ...), but we'd like to make sure that tasks are executed by pstl with the tbb backend. The goal is mostly to achieve somewhat predictable performance across platforms, and avoid having multiple threadpools.

Is there an intended way to achieve this? Is it a sane and intended usage of the pstl project to have a separate set of its headers, exporting its execution namespace with a project-specific prefix? How would one do this? Or does pstl only target compiler / standard library vendors?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source