Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add/update copyright notices.
[simgrid.git] / teshsuite / smpi / alltoall_basic.c
index 485752e..9e2a166 100644 (file)
@@ -1,14 +1,14 @@
-/* Copyright (c) 2009, 2010. The SimGrid Team.
+/* Copyright (c) 2009-2010, 2012-2014. 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 <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
+#include "mpi.h"
 
 #ifndef EXIT_SUCCESS
 #define EXIT_SUCCESS 0
@@ -32,6 +32,7 @@ int main(int argc, char *argv[])
     perror("can't allocate send buffer");
     fflush(stderr);
     MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
+    exit(EXIT_FAILURE);
   }
   rb = (int *) malloc(size * sizeof(int));
   if (!rb) {
@@ -39,11 +40,13 @@ int main(int argc, char *argv[])
     fflush(stderr);
     free(sb);
     MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
+    exit(EXIT_FAILURE);
   }
   for (i = 0; i < size; ++i) {
     sb[i] = rank + 1;
     rb[i] = 0;
   }
+
   status = MPI_Alltoall(sb, 1, MPI_INT, rb, 1, MPI_INT, MPI_COMM_WORLD);
 
   printf("[%d] rcvbuf=[", rank);
@@ -53,7 +56,7 @@ int main(int argc, char *argv[])
 
 
   if (rank == 0) {
-    if (status != 0) {
+    if (status != MPI_SUCCESS) {
       printf("all_to_all returned %d\n", status);
       fflush(stdout);
     }