Exercise - Writing libraries


Up: Tools for writing libraries Next: MPI Objects Previous: Commentary

Objective: Use private communicators and attributes

Write a routine to circulate data to the next process, using a nonblocking send and receive operation.

void Init_pipe( comm ) 
void ISend_pipe( comm, bufin, len, datatype, bufout ) 
void Wait_pipe( comm ) 
A typical use is
Init_pipe( MPI_COMM_WORLD ) 
for (i=0; i<n; i++) { 
    ISend_pipe( comm, bufin, len, datatype, bufout ); 
    Do_Work( bufin, len ); 
    Wait_pipe( comm ); 
    t = bufin; bufin = bufout; bufout = t; 
    } 
What happens if Do_Work calls MPI routines?

127 What do you need to do to clean up Init_pipe?

127 How can you use a user-defined topology to determine the next process? (Hint: see MPI_Topo_test and MPI_Cartdim_get.)



Up: Tools for writing libraries Next: MPI Objects Previous: Commentary