We wish to give a parallel library its own communicator, with a unique context. The strategy is to pass in, at each invocation of the library, a communicator that describes the process group to be used. The library function ``duplicates'' it, getting a similar communicator, but one with a unique communication context. This becomes the private, library-internal communicator.
The MPI caching mechanism is used to make this work well. The private communicator is associated (cached) with the communicator passed in by the application. This means that the private communicator needs to be created only the first time the library is invoked with that particular communicator as argument. The caching hides the internal communicator from the application and the application need not explicitly manage the internal communicators. The reader is referred to the further sources discussed in sidebar B for details concerning the caching mechanism.