Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <mpi.h>
- #include <stdio.h>
- #include <math.h>
- int main( int argc, char *argv[] )
- {
- int id,from,to,tag,numproc;
- double data;
- MPI_Init(&argc,&argv);
- MPI_Status status;
- MPI_Comm_rank(MPI_COMM_WORLD, &id);
- if( id == 0 )
- {
- to = 3; tag = 2012; data = 10.12;
- MPI_Send(&data, 1, MPI_DOUBLE, to, tag, MPI_COMM_WORLD);
- }
- else if (id == 3)
- {
- from = 0; tag = 2012;
- MPI_Recv(&data,1,MPI_DOUBLE,from,tag,MPI_COMM_WORLD,&status);
- printf("Proces %d odebral %f\n", id,data);
- }
- else {}
- MPI_Finalize();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment