================================ Scatter operations with overlaps [TOC] ================================ To accommodate the Jacobi solver, it would be helpful to support overlapping sections. Exercise ======== Extend `scatter_by_block` and `gather_by_block` by adding an optional parameter `overlap` that specifies the size of the border. Please consider that in case of `overlap > 0` the scatter and gather operations are no longer symmetrical as `scatter_by_block` sends overlapping regions at least twice while `gather_by_block` sends just the inner sections. ---- CODE (type=cpp) ---------------------------------------------------------- template class MA, template class MB, Require>, Ge>> = true> int scatter_by_block(const MA& A, MB& B, int root, MPI_Comm grid, int dims[2], int coords[2], int overlap = 0) { /* ... */ } template typename MA, template typename MB, Require>, Ge>> = true> int gather_by_block(const MA& A, MB& B, int root, MPI_Comm grid, int dims[2], int coords[2], int overlap = 0) { /* ... */ } ------------------------------------------------------------------------------- Source code =========== Following source code is available for testing: :import:session07/scatter-gather5.cpp :navigate: up -> doc:index back -> doc:session07/page08 next -> doc:session07/page10