wrap
wrap copied to clipboard
MPI Call Size computation
This adds the {{size}} macro which allows to compute the volume of data manipulated by the various MPI calls while also differentiating inbound and outboud traffic.
Notes:
- Neighborhood are implemented (adds some boilerplate code particularly for cartesian)
- This is a relatively "simple" implementation which can certainly be improved all comments are welcome !
- Misses MPI_Reduce_scatter and MPI_Reduce_scatter_block for now
Wrapper:
{{fnall foo}}
ENTER(FUNC_{{foo}});
{{callfn}}
LEAVE(FUNC_{{foo}});
{{size}}
REPORT_SIZE(FUNC_{{foo}}, _size, _size_in, _size_out);
{{endfnall}}
Generated code:
_EXTERN_C_ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispls[], const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[], const int rdispls[], const MPI_Datatype recvtypes[], MPI_Comm comm, MPI_Request *request) {
int _wrap_py_return_val = 0;
ENTER(FUNC_MPI_Ialltoallw);
_wrap_py_return_val = PMPI_Ialltoallw(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm, request);
LEAVE(FUNC_MPI_Ialltoallw);
size_t _size_in = 0;
{
{
int _csize = 0;
PMPI_Comm_size(comm, &_csize);
size_t _total_size = 0;
int i;
for(i = 0 ; i < _csize; i++)
{
MPI_Count _tsize = 0;
PMPI_Type_size_x(recvtypes[i], &_tsize);
_total_size += recvcounts[i] * _tsize;
}
_size_in = _total_size;
}
}
size_t _size_out = 0;
{
{
int _csize = 0;
PMPI_Comm_size(comm, &_csize);
size_t _total_size = 0;
int i;
for(i = 0 ; i < _csize; i++)
{
MPI_Count _tsize = 0;
PMPI_Type_size_x(sendtypes[i], &_tsize);
_total_size += sendcounts[i] * _tsize;
}
_size_out = _total_size;
}
}
size_t _size = _size_in + _size_out;
REPORT_SIZE(FUNC_MPI_Ialltoallw, _size, _size_in, _size_out);
return _wrap_py_return_val;
}