Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPI Call Size computation #23

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

besnardjb
Copy link

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;
}

Signed-off-by: BESNARD Jean-Baptiste <[email protected]>
Signed-off-by: BESNARD Jean-Baptiste <[email protected]>
Add sizes for the MPI_File family
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant