Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
more verbose debug messages
[simgrid.git] / examples / smpi / dsend.c
1 /* Copyright (c) 2011. The SimGrid Team. All rights reserved.               */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 /* This program simply does a very small exchange to test whether using SIMIX dsend to model the eager mode works */
7
8 #include <stdio.h>
9 #include <mpi.h>
10
11 int main(int argc, char *argv[]) {
12   int rank;
13   int data=11;
14    
15
16   MPI_Init(&argc, &argv);
17   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
18    
19   if (rank==1) {
20           data=22;
21           MPI_Send(&data,1,MPI_INT,(rank+1)%2,666,MPI_COMM_WORLD);
22 //       smpi_sleep(1000);
23   } else {
24           MPI_Recv(&data,1,MPI_INT,-1,666,MPI_COMM_WORLD,NULL);
25           if (data !=22) {
26                   printf("rank %d: Damn, data does not match (got %d)\n",rank, data);
27           }
28   }
29
30   printf("rank %d: data exchanged\n", rank);
31   MPI_Finalize();
32   return 0;
33 }