From 4353832084af0f2830d5a6b5be213c2b055592d3 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 5 May 2019 15:12:18 -0400 Subject: [PATCH] Add some documentation on chunk sizes. This came up on GitHub recently (see issue #7851). --- include/deal.II/lac/vector_operations_internal.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index ab1a9b954f..d7ff76dd36 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -188,6 +188,13 @@ namespace internal partitioner->acquire_one_partitioner(); TBBForFunctor generic_functor(functor, start, end); + // We use a minimum grain size of 1 here since the grains at this + // stage of dividing the work refer to the number of vector chunks + // that are processed by (possibly different) threads in the + // parallelized for loop (i.e., they do not refer to individual + // vector entries). The number of chunks here is calculated inside + // TBBForFunctor. See also GitHub issue #2496 for further discussion + // of this strategy. parallel::internal::parallel_for(static_cast(0), static_cast( generic_functor.n_chunks), @@ -1391,6 +1398,13 @@ namespace internal TBBReduceFunctor generic_functor(op, start, end); + // We use a minimum grain size of 1 here since the grains at this + // stage of dividing the work refer to the number of vector chunks + // that are processed by (possibly different) threads in the + // parallelized for loop (i.e., they do not refer to individual + // vector entries). The number of chunks here is calculated inside + // TBBForFunctor. See also GitHub issue #2496 for further discussion + // of this strategy. parallel::internal::parallel_for(static_cast(0), static_cast( generic_functor.n_chunks), -- 2.39.5