Using the multi-model mechanism in Carpet
This text was originally extracted from multi-model code in Carpet to Cactus developers mailing list.
To use the multi-model mechanism in Carpet:
- Arrange for mpirun to start the Cactus run with different parameter files for different MPI ranks. All MPI implementations I know of have a mechanism for this. You may or may not want to use different executables as well.
- In the parameter files, set the parameter
Carpet::model
to different strings. - Carpet will then group all MPI ranks by this parameter's value, create a communicator for each of these, and start independent runs for each.
- So far, all you've done is starting several completely unrelated and independent simulations with one mpirun call.
- Carpet offers an aliased function
GetMPICommUniverse
that returns the original MPI communicator that allows all processes to communicate. (Compare withGetMPICommWorld
.) Note that there is no implicit or implied synchronization between the different worlds; this is your responsibility. - Thorn CactusNumerical/Slab has a mechanism for passing an MPI communicator that it should use, allowing you to transfer hyperslabs between worlds. Other thorns may be extended similarly if necessary.