From 034fee0c8bcf7a5b33683a97745c8b34eff22f7c Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Fri, 30 Aug 2024 11:13:51 -0600 Subject: [PATCH] Make sure stride_small_size is at least 1. --- source/base/mpi_compute_index_owner_internal.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/base/mpi_compute_index_owner_internal.cc b/source/base/mpi_compute_index_owner_internal.cc index c7825de990..d6795a0f35 100644 --- a/source/base/mpi_compute_index_owner_internal.cc +++ b/source/base/mpi_compute_index_owner_internal.cc @@ -19,6 +19,8 @@ #include +#include + DEAL_II_NAMESPACE_OPEN namespace Utilities @@ -439,12 +441,11 @@ namespace Utilities dofs_per_process = (size + n_procs - 1) / n_procs; if (dofs_per_process < range_minimum_grain_size) - { - dofs_per_process = range_minimum_grain_size; - stride_small_size = dofs_per_process * n_procs / size; - } - else - stride_small_size = 1; + dofs_per_process = range_minimum_grain_size; + + stride_small_size = + std::max(dofs_per_process * n_procs / size, 1); + local_range.first = get_index_offset(my_rank); local_range.second = get_index_offset(my_rank + 1); -- 2.39.5