Use Parallel_if_available_tag

This commit is contained in:
Andreas Fabri 2019-11-23 15:20:49 +01:00
parent 1287db1138
commit 902183b701
6 changed files with 11 additions and 10 deletions

View File

@ -13,7 +13,7 @@ or the middle depending on the `PolicyTag`.
\tparam PolicyTag must be `Hilbert_sort_median_policy` or `Hilbert_sort_middle_policy`.
\tparam ConcurrencyTag must be `Sequential_tag` or `Parallel_tag`. With `Parallel_tag`
\tparam ConcurrencyTag must be `Sequential_tag`, `Parallel_tag`, or `Parallel_if_available_tag. With parallelism
and TBB enabled, for the median policy up to four threads are used in parallel.
*/
template< typename Traits, typename PolicyTag, typename ConcurrencyTag = Sequential_tag >

View File

@ -11,7 +11,7 @@ or the middle depending on the `PolicyTag`.
\tparam PolicyTag must be `Hilbert_sort_median_policy` or `Hilbert_sort_middle_policy`.
\tparam ConcurrencyTag must be `Sequential_tag` or `Parallel_tag`. With `Parallel_tag`
\tparam ConcurrencyTag must be `Sequential_tag`,`Parallel_tag`, or `Parallel_if_available_tag`. With parallelism
and TBB enabled, for the median policy up to eight threads are used in parallel.
*/
template< typename Traits, typename PolicyTag, typename ConcurrencyTag = Sequential_tag >

View File

@ -8,8 +8,8 @@ along a Hilbert curve.
It sorts the range `[begin, end)` in place.
\tparam ConcurrencyTag must be `Sequential_tag` or `Parallel_tag`.
With `Parallel_tag` and TBB enabled, the sorting will be
\tparam ConcurrencyTag must be `Sequential_tag`, `Parallel_tag`, or `Parallel_if_available_tag`.
With parallelism and TBB enabled, the sorting will be
done using up to four threads in 2D, and up to eight threads in 3D with the median policy.
\tparam RandomAccessIterator

View File

@ -10,8 +10,8 @@ of being close in the order.
It sorts the range `[begin, end)` in place.
\tparam ConcurrencyTag must be `Sequential_tag` or `Parallel_tag`.
With `Parallel_tag` and TBB enabled, the sorting will be
\tparam ConcurrencyTag must be `Sequential_tag`, `Parallel_tag`, or `Parallel_if_available_tag`.
With parallelism and TBB enabled, the sorting will be
done using up to four threads in 2D, and up to eight threads in 3D with the median policy.
\tparam RandomAccessIterator `std::iterator_traits<RandomAccessIterator>::%value_type` must be convertible to

View File

@ -214,7 +214,8 @@ The Hilbert sort and spatial sort functions when using the median policy and wit
enabled, are parallized and use up to four/eight threads for 2D/3D.
By default the sequential version is used. The parallel version is used
by adding the template parameter `CGAL::Parallel_tag`.
by adding the template parameter `CGAL::Parallel_tag`. In case it is not sure
whether TBB is enabled use `CGAL::Parallel_if_available_tag`.
\cgalExample{Spatial_sorting/parallel_spatial_sort_2.cpp}

View File

@ -26,9 +26,9 @@ int main()
// By default sequential
CGAL::spatial_sort(points.begin(),points.end());
// Add the template argument to switch on parallelism
// You will get a compile time warning in case TBB is not enabled
CGAL::spatial_sort<CGAL::Parallel_tag>(points.begin(),points.end());
// Add the template argument to switch on parallelism if available
// You can also use Parallel_tag if you know that TBB is enabled
CGAL::spatial_sort<CGAL::Parallel_if_available_tag>(points.begin(),points.end());
return 0;
}