#2112: move CCTK_MyHost and friends into flesh --------------------------+------------------------------------------------- Reporter: rhaas | Owner: Type: enhancement | Status: new Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: Carpet PUGH driver --------------------------+-------------------------------------------------
Comment (by rhaas):
I see. The hope is that the the complex logic can stay in Carpet (or go into the ExternalLibraries/MPI thorn since it is not driver specific), I am at this point only advocating to make {{{CCTK_MyHostID}}} a Cactus overloaded function rather than an aliased function it is now.
The flesh still could then stay MPI-free (except the MPI_Init() calls which are required) if possible.
The MPI3 method is definitely easier it seems. Another way to do this without having to rely on hostname and string surgery seems to use POSIX (or SysIV) shared memory sections which are basically the same as the MPI3 shared communicators. I have not tried this exactly but have used shared memory (which is what made me wish for a hostid function) and semaphores.
1. make a shared memory section of a known name which will automatically be shared by all ranks on a node 1. use POSIX or SysIV semaphores to have exactly one rank per node write its global MPI rank into the shared memory, this rank will be random since it depends on which process first grabs the semaphore 1. one needs a couple of MPI_Barriers to make sure that there is proper serialization in some places
The method is not too hard (easier probably than string surgery) and works as long as one has POSIX or SysIV IPC capabilities (so hopefully everywhere, in particular since we do require POSIX by now).