Basic HTML version of Foils prepared August 29 98

Foil 45 MPI Example

From Designing and Building Parallel Programs I: Introduction DoD Modernization Tutorial -- 1995-1998. by Ian Foster, Gina Goff, Ehtesham Hayder, Chuck Koelbel


main(int argc, char *argv[]) {
MPI_Comm com = MPI_COMM_WORLD;
MPI_Init(&argc,&argv);
MPI_Comm_size(com,&np);
MPI_Send(local+1,1,MPI_FLOAT,lnbr,10,com);
MPI_Recv(local,1,MPI_FLOAT,rnbr,10,com,&status);
MPI_Send(local+lsize,1,MPI_FLOAT,rnbr,10,com);
MPI_Recv(local+lsize+1,1,MPI_FLOAT,lnbr,10,com,&status);
ldiff = maxerror(local);
MPI_Allreduce(&ldiff,&diff,1,MPI_FLOAT,MPI_MAX,com);
MPI_Finalize();
}



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Apr 11 1999