MpiFx 1.4.0
|
MPI communicator with some additional information. More...
Public Member Functions | |
procedure | init (self, commid, error) |
Initializes the MPI environment. | |
procedure | split (self, splitkey, rankkey, newcomm, error) |
Creates a new communicator by splitting the old one. | |
procedure | split_type (self, splittype, rankkey, newcomm, error) |
Creates a new communicator by splitting the old one given a split type. | |
procedure | free (self) |
Frees the communicator. The communicator should not be used after this. | |
MPI communicator with some additional information.
procedure mpifx_comm_module::mpifx_comm::free | ( | class(mpifx_comm), intent(inout) | self | ) |
Frees the communicator. The communicator should not be used after this.
After this call, the passed communicator should not be used any more.
self | Communicator instance. |
procedure mpifx_comm_module::mpifx_comm::init | ( | class(mpifx_comm), intent(out) | self, |
integer, intent(in), optional | commid, | ||
integer, intent(out), optional | error ) |
Initializes the MPI environment.
self | Initialized instance on exit. |
commid | MPI Communicator ID (default: MPI_COMM_WORLD ) |
error | Error flag on return containing the first error occuring during the calls mpi_comm_size and mpi_comm_rank. |
procedure mpifx_comm_module::mpifx_comm::split | ( | class(mpifx_comm), intent(inout) | self, |
integer, intent(in) | splitkey, | ||
integer, intent(in) | rankkey, | ||
class(mpifx_comm), intent(out) | newcomm, | ||
integer, intent(out), optional | error ) |
Creates a new communicator by splitting the old one.
self | Communicator instance. |
splitkey | Key for the splitting. Processes invoking the routine with the same value for splitkey will be belong to the same communicator. |
rankkey | Is used to determine the rank of the process in its new communicator. Processes calling the routine with a higher value will have a higher rank in the new communicator. |
newcomm | New communicator for the given process. |
error | Optional error code on return. |
Example:
program test_split use libmpifx_module implicit none type(mpifx_comm) :: allproc, groupproc integer :: groupsize, mygroup call mpifx_init() call allproc%init() groupsize = allproc%size / 2 mygroup = allproc%rank / groupsize call allproc%split(mygroup, allproc%rank, groupproc) write(*, "(3(A,1X,I0,1X))") "ID:", allproc%rank, "SUBGROUP", & & mygroup, "SUBGROUP ID", groupproc%rank call mpifx_finalize() end program test_split
MPI_COMM_SPLIT
) procedure mpifx_comm_module::mpifx_comm::split_type | ( | class(mpifx_comm), intent(inout) | self, |
integer, intent(in) | splittype, | ||
integer, intent(in) | rankkey, | ||
class(mpifx_comm), intent(out) | newcomm, | ||
integer, intent(out), optional | error ) |
Creates a new communicator by splitting the old one given a split type.
self | Communicator instance. |
splittype | Determines which ranks to be grouped together. In MPI 3.0, this can only be MPI_COMM_TYPE_SHARED grouping all MPI ranks together that can share memory (usually on a node). |
rankkey | Is used to determine the rank of the process in its new communicator. Processes calling the routine with a higher value will have a higher rank in the new communicator. |
newcomm | New communicator for the given process. |
error | Optional error code on return. |
Example:
program test_split_type use libmpifx_module implicit none type(mpifx_comm) :: allproc, splitproc call mpifx_init() call allproc%init() call allproc%split_type(MPI_COMM_TYPE_SHARED, allproc%rank, splitproc) write(*, "(2(A,1X,I0,1X))") "ID:", allproc%rank, "SPLIT ID", splitproc%rank call mpifx_finalize() end program test_split_type
MPI_COMM_SPLIT_TYPE
)