Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Updated expected output.
[simgrid.git] / examples / smpi / sendrecv.c
index 3f3aeee..6d5ba17 100644 (file)
@@ -1,3 +1,9 @@
+/* Copyright (c) 2009, 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
 #include "mpi.h"
 #include <stdio.h>
 
@@ -28,8 +34,8 @@ static int test(int myid, int numprocs) {
     MPI_Sendrecv(buffer, 10, MPI_INT, left, TAG_SND, buffer2, 10, MPI_INT, right, TAG_RCV, MPI_COMM_WORLD, &status);
  
     for (i=0;i<BUFLEN;i++) {
-               if (buffer2[i]!=((myid+1)%numprocs)) {
-                         fprintf(stderr,"[%d] error: should have values %d, has %d\n",myid,myid-1,buffer[i]);
+               if (buffer2[i]!=right) {
+                         fprintf(stderr,"[%d] error: should have values %d, has %d\n",myid,right,buffer2[i]);
                          return(0);
              }
     }