c++ - Barrier after MPI non-blocking call, without bookkeeping? -


i'm doing bunch of mpi_iallreduce non-blocking communications. i've added these iallreduce calls several different places in code. every often, want pause , wait iallreduce calls finish.


version 1 mpi_request bookkeeping -- works:

mpi_request requests[]; mpi_iallreduce(..., requests[0]); ... mpi_iallreduce(..., requests[n-1]); for(int i=0; i<n; i++){     mpi_wait(requests[i], ...); } 

but, i'm working in pretty big codebase, , i'd rather not write code keep track of these mpi_request objects. i'd following:

version 2 without mpi_request bookkeeping -- segfaults:

mpi_iallreduce(..., requests[0]); ... mpi_iallreduce(..., requests[n-1]); mpi_barrier(...); //wait iallreduces finish, without mpi_request bookkeeping 

but, mpi_barrier version segfaults.


is there way bunch of non-blocking mpi calls, , wait calls finish, without keeping track of mpi_request objects?

it depends on how don't want "track request objects". generally, nothing guarantee calls done other waiting requests. however, way you're doing isn't simplest way. instead, use mpi_waitall.

mpi_iallreduce(..., requests[0]); ... mpi_iallreduce(..., requests[n-1]); mpi_waitall(n, requests, mpi_statuses_ignore); 

this wait of requests complete @ once , when you're done, know of reductions finished. if want more fine grained information how went, can replace mpi_statuses_ignore array of mpi_status objects.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -