Skip to content
Snippets Groups Projects
Verified Commit 7c7dc684 authored by raphael.bach's avatar raphael.bach
Browse files

Fix offset computation in `fmpi_partition_block_1d()`

parent a643bf2d
No related branches found
No related tags found
No related merge requests found
...@@ -93,7 +93,7 @@ static struct fmpi_data fmpi_partition_block_1d( ...@@ -93,7 +93,7 @@ static struct fmpi_data fmpi_partition_block_1d(
const size_t rem = data->cnt % (size_t)ctx->mpi->size; const size_t rem = data->cnt % (size_t)ctx->mpi->size;
const size_t cnt = (rank < rem) ? (cnt_per_proc + 1) : cnt_per_proc; const size_t cnt = (rank < rem) ? (cnt_per_proc + 1) : cnt_per_proc;
const size_t size = cnt * data->type.size; const size_t size = cnt * data->type.size;
const size_t offset = (rank * size) + (rank < rem ? 0 : rem); const size_t offset = (rank * size) + (rank < rem ? 0 : (rem * data->type.size));
return (struct fmpi_data){ return (struct fmpi_data){
.type = data->type, .type = data->type,
.cnt = cnt, .cnt = cnt,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment