diff --git a/src/TNL/DistributedContainers/Partitioner.h b/src/TNL/DistributedContainers/Partitioner.h index 3c8cace6fbbdd3ce146dcebaf23217b3cc3d3338..c42646f286eb32750e4948ddc9df5d9be04767dc 100644 --- a/src/TNL/DistributedContainers/Partitioner.h +++ b/src/TNL/DistributedContainers/Partitioner.h @@ -43,7 +43,7 @@ public: __cuda_callable__ static int getOwner( Index i, Index globalSize, int partitions ) { - return i * partitions / globalSize; + return min( partitions - 1, i / (globalSize / partitions) ); } // Gets the offset of data for given rank.