MPIBlib: MPI Benchmark library
MPIB_coll_container Struct Reference
[Collective benchmarks]
Inherited by MPIB_Alltoall_container, MPIB_buffer_container, MPIB_Comm_dup_free_container, and MPIB_Reduce_container.
Public Attributes | |
const char * | operation |
int(* | initialize )(void *_this, MPI_Comm comm, int root, int M) |
int(* | execute )(void *_this, MPI_Comm comm, int root, int M) |
int(* | finalize )(void *_this, MPI_Comm comm, int root) |
Detailed Description
Container for a collective communication operation to be measured by MPIB_measure_coll (MPIB_measure_max, MPIB_measure_root, MPIB_measure_global). How to use (example in C):
- Create a data structure with the first field MPIB_coll_container.
typedef struct MPIB_Scatter_container { MPIB_coll_container base; char* buffer; MPIB_Scatter scatter; } MPIB_Scatter_container;
- Implement the functions: initialize, execute, finalize, where
_this
argument can be typecasted to the data structure.void MPIB_Scatter_initialize(void* _this, MPI_Comm comm, int root, int M) { MPIB_Scatter_container* container = (MPIB_Scatter_container*)_this; int rank; MPI_Comm_rank(comm, &rank); int size; MPI_Comm_size(comm, &size); container->buffer = rank == root ? (char*)malloc(sizeof(char) * M * size) : (char*)malloc(sizeof(char) * M); } void MPIB_Scatter_execute(void* _this, MPI_Comm comm, int root, int M) { MPIB_Scatter_container* container = (MPIB_Scatter_container*)_this; container->scatter(container->base.buffer, M, MPI_CHAR, container->base.buffer, M, MPI_CHAR, root, comm); } void MPIB_Scatter_finalize(void* _this, MPI_Comm comm, int root) { MPIB_Scatter_container* container = (MPIB_Scatter_container*)_this; free(container->buffer); }
- Implement the functions that allocate and free the data structure. +
MPIB_Scatter_container* MPIB_Scatter_container_alloc(MPIB_Scatter scatter) { MPIB_Scatter_container* container = (MPIB_Scatter_container*)malloc(sizeof(MPIB_Scatter_container)); container->base.operation = "Scatter"; container->base.initialize = MPIB_Scatter_initialize; container->base.execute = MPIB_Scatter_execute; container->base.finalize = MPIB_Scatter_finalize; container->scatter = scatter; return container; } void MPIB_Scatter_container_free(void* _this) { free(_this); }
In this library, collective containers are implemented in C++.
- Parameters:
-
comm MPI communicator over which the communication operation will be performed root root process M message size
Member Data Documentation
const char* MPIB_coll_container::operation |
Communication operation
int(* MPIB_coll_container::initialize)(void *_this, MPI_Comm comm, int root, int M) |
Initialization of buffers required for the communication operation (in irregular collectives, M can be different at different processors)
int(* MPIB_coll_container::execute)(void *_this, MPI_Comm comm, int root, int M) |
Communication operation (in irregular collectives, M can be different at different processors)
int(* MPIB_coll_container::finalize)(void *_this, MPI_Comm comm, int root) |
Finalization of buffers required for the communication operation
The documentation for this struct was generated from the following file:
- benchmarks/mpib_coll_benchmarks.h