3 typedef struct { short a; int b } s1;
5 main( int argc, char **argv )
11 MPI_Init( &argc, &argv );
12 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
13 for (i=0; i<10; i++) {
19 /* MPI_Allreduce( s, sout, 10, MPI_SHORT_INT, MPI_MINLOC, MPI_COMM_WORLD ); */
24 MPI_Reduce( s, sout, 10, MPI_SHORT_INT, MPI_MINLOC, 1, MPI_COMM_WORLD );
26 for (i=0; i<10; i++) {
27 printf( "[%d] (%x,%x)\n", rank, (int)sout[i].a, sout[i].b );
30 MPI_Send( sout, 10, MPI_SHORT_INT, 0, 0, MPI_COMM_WORLD );
32 MPI_Recv( sout, 10, MPI_SHORT_INT, 1, 0, MPI_COMM_WORLD, &status );
33 /* MPI_Bcast( sout, 10, MPI_SHORT_INT, 1, MPI_COMM_WORLD ); */
34 for (i=0; i<10; i++) {
35 printf( "[%d] (%x,%x)\n", rank, (int)sout[i].a, sout[i].b );