skip to content
Ivan's wiki
Site Tools
Search
Tools
Show pagesource
Backlinks
Recent Changes
Media Manager
Sitemap
>
Recent Changes
Media Manager
Sitemap
mpi-communicator-duplication
This page is read only. You can view the source, but not change it.
# MPI communicator duplication **Communicator duplication** prevents libraries from intercepting application messages. `MPI_Comm_dup` creates a new communicator with its own tag namespace. ```c MPI_Comm lib_comm; MPI_Comm_dup(MPI_COMM_WORLD, &lib_comm); library_init(lib_comm); // all internal library traffic uses lib_comm // ... MPI_Comm_free(&lib_comm); ``` Passing `MPI_COMM_WORLD` directly into a third-party library is unsafe: the library's internal messages can be matched by wildcards in the application and vice versa, producing message mismatches that are difficult to diagnose. The convention is for any reusable MPI code to accept a communicator argument and duplicate it internally rather than operating on the passed communicator directly.
Page Tools
Show pagesource
Backlinks
Back to top