MPI communicator wrapper type for legacy MPI
Provides object-oriented interface to MPI communicators with type-bound procedures for common operations. Uses integer handles for compatibility with legacy MPI implementations.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | private | :: | is_valid | = | .false. |
Validity flag |
|
| integer, | private | :: | m_comm | = | MPI_COMM_NULL |
Internal MPI communicator (integer handle) |
|
| integer(kind=int32), | private | :: | m_rank | = | -1_int32 |
Cached rank in this communicator |
|
| integer(kind=int32), | private | :: | m_size | = | -1_int32 |
Cached size of this communicator |
Synchronization barrier
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(comm_t), | intent(in) | :: | this |
Create communicator without leader
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(comm_t), | intent(in) | :: | this |
Create communicator with first N ranks
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(comm_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | num_ranks |
Duplicate communicator
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(comm_t), | intent(in) | :: | this |
Free communicator resources
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(comm_t), | intent(inout) | :: | this |
Check if communicator is null
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(comm_t), | intent(in) | :: | this |
Check if this rank is leader (rank 0)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(comm_t), | intent(in) | :: | this |
Get size of communicator
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(comm_t), | intent(in) | :: | this |
Split into shared memory communicators
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(comm_t), | intent(in) | :: | this |
Split communicator by color
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(comm_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | color |
type :: comm_t !! MPI communicator wrapper type for legacy MPI !! !! Provides object-oriented interface to MPI communicators with !! type-bound procedures for common operations. Uses integer handles !! for compatibility with legacy MPI implementations. private integer :: m_comm = MPI_COMM_NULL !! Internal MPI communicator (integer handle) integer(int32) :: m_rank = -1_int32 !! Cached rank in this communicator integer(int32) :: m_size = -1_int32 !! Cached size of this communicator logical :: is_valid = .false. !! Validity flag contains procedure :: rank => comm_rank !! Get rank in communicator procedure :: size => m_size_func !! Get size of communicator procedure :: leader => comm_leader !! Check if this rank is leader (rank 0) procedure :: is_null => comm_is_null !! Check if communicator is null procedure :: get => comm_get !! Get underlying MPI communicator handle procedure :: barrier => comm_barrier !! Synchronization barrier procedure :: split => comm_split_shared !! Split into shared memory communicators procedure :: split_by => comm_split_by_color !! Split communicator by color procedure :: discard_leader => comm_discard_leader !! Create communicator without leader procedure :: discard_to => comm_discard_to !! Create communicator with first N ranks procedure :: duplicate => comm_duplicate !! Duplicate communicator procedure :: finalize => comm_finalize !! Free communicator resources end type comm_t