Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add tesh files to test all new collectives
authorPaul Bédaride <paul.bedaride@gmail.com>
Thu, 4 Apr 2013 09:15:57 +0000 (11:15 +0200)
committerPaul Bédaride <paul.bedaride@gmail.com>
Thu, 4 Apr 2013 09:51:05 +0000 (11:51 +0200)
40 files changed:
buildtools/Cmake/AddTests.cmake
src/simgrid/sg_config.c
src/smpi/colls/allgather-2dmesh.c
src/smpi/colls/allreduce-NTS.c
src/smpi/colls/allreduce-rab-rdb.c
src/smpi/colls/allreduce-rab-reduce-scatter.c
src/smpi/colls/allreduce-rab-rsag.c
src/smpi/colls/allreduce-rab1.c
src/smpi/colls/allreduce-rab2.c
src/smpi/colls/allreduce-rdb.c
src/smpi/colls/allreduce-redbcast.c
src/smpi/colls/alltoall-2dmesh.c
src/smpi/colls/alltoall-3dmesh.c
src/smpi/colls/alltoall-bruck.c
src/smpi/colls/alltoall-pair-light-barrier.c
src/smpi/colls/alltoall-pair-mpi-barrier.c
src/smpi/colls/alltoall-pair-one-barrier.c
src/smpi/colls/alltoall-pair.c
src/smpi/colls/alltoall-rdb.c
src/smpi/colls/alltoall-ring-light-barrier.c
src/smpi/colls/alltoall-ring-mpi-barrier.c
src/smpi/colls/alltoall-ring-one-barrier.c
src/smpi/colls/alltoall-ring.c
src/smpi/colls/alltoall-simple.c
src/smpi/colls/bcast-binomial-tree.c
src/smpi/colls/bcast-scatter-LR-allgather.c
src/smpi/colls/bcast-scatter-rdb-allgather.c
src/smpi/smpirun.in
teshsuite/smpi/CMakeLists.txt
teshsuite/smpi/allgather_coll.c [new file with mode: 0644]
teshsuite/smpi/allgather_coll.tesh [new file with mode: 0644]
teshsuite/smpi/allreduce_coll.c [new file with mode: 0644]
teshsuite/smpi/allreduce_coll.tesh [new file with mode: 0644]
teshsuite/smpi/alltoall_basic.c
teshsuite/smpi/alltoall_coll.c [new file with mode: 0644]
teshsuite/smpi/alltoall_coll.tesh [new file with mode: 0644]
teshsuite/smpi/bcast_coll.c [new file with mode: 0644]
teshsuite/smpi/bcast_coll.tesh [new file with mode: 0644]
teshsuite/smpi/reduce_coll.c [new file with mode: 0644]
teshsuite/smpi/reduce_coll.tesh [new file with mode: 0644]

index 651f18e..6f5e02e 100644 (file)
@@ -369,6 +369,29 @@ if(NOT enable_memcheck)
       ADD_TEST(smpi-tracing-ptp                 ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/tracing/smpi_traced.tesh)
       ADD_TEST(smpi-replay                      ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/smpi_replay.tesh)
     endif()
+
+    FOREACH (ALLGATHER_COLL default GB loosely_lr lr NTSLR NTSLR_NB pair rdb RDB rhv ring SMP_NTS
+                           smp_simple SMP_simple spreading_simple)
+        ADD_TEST(smpi-allgather-coll-${ALLGATHER_COLL} ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg smpi/allgather:${ALLGATHER_COLL} --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/allgather_coll.tesh)
+    ENDFOREACH()
+    FOREACH (ALLREDUCE_COLL default lr NTS rab1 rab2 rab_rsag rdb smp_binomial smp_rdb smp_rsag
+                           smp_rsag_lr smp_rsag_rab redbcast)
+        ADD_TEST(smpi-allreduce-coll-${ALLREDUCE_COLL} ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg smpi/allreduce:${ALLREDUCE_COLL} --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/allreduce_coll.tesh)
+    ENDFOREACH()
+    FOREACH (ALLTOALL_COLL 2dmesh 3dmesh pair pair_light_barrier pair_mpi_barrier rdb
+                          ring ring_light_barrier ring_mpi_barrier ring_one_barrier
+                          simple bruck basic_linear pairwise)
+        ADD_TEST(smpi-alltoall-coll-${ALLTOALL_COLL} ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg smpi/alltoall:${ALLTOALL_COLL} --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/alltoall_coll.tesh)
+    ENDFOREACH()
+    FOREACH (BCAST_COLL default arrival_nb arrival_pattern_aware arrival_pattern_aware_wait arrival_scatter
+                       binomial_tree flattree flattree_pipeline NTSB NTSL NTSL_Isend scatter_LR_allgathe
+                       scatter_rdb_allgather SMP_binary SMP_binomial SMP_linear TSB)
+               ADD_TEST(smpi-bcast-coll-${BCAST_COLL} ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg smpi/bcast:${BCAST_COLL} --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/bcast_coll.tesh)
+    ENDFOREACH()
+    FOREACH (REDUCE_COLL default arrival_pattern_aware binomial flat_tree NTSL scatter_gather)
+        ADD_TEST(smpi-reduce-coll-${REDUCE_COLL} ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg smpi/reduce:${REDUCE_COLL} --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/reduce_coll.tesh)
+    ENDFOREACH()
+
   endif()
 
   # END TESH TESTS
index dea71e1..433195f 100644 (file)
@@ -771,7 +771,6 @@ void sg_config_init(int *argc, char **argv)
                     xbt_cfgelm_string, &default_value, 1, 1, &_sg_cfg_cb__coll_alltoall,
                     NULL);
 
-
     default_value = xbt_strdup("default");
     xbt_cfg_register(&_sg_cfg_set, "smpi/bcast",
                     "Which collective to use for bcast",
index 8fa5d40..0a9f688 100644 (file)
@@ -129,12 +129,7 @@ smpi_coll_tuned_allgather_2dmesh(void *send_buff, int send_count, MPI_Datatype
   if (Y > X)
     num_reqs = Y;
 
-  req = (MPI_Request *) malloc(num_reqs * sizeof(MPI_Request));
-  if (!req) {
-    printf("allgather-2dmesh-shoot.c:85: cannot allocate memory\n");
-    MPI_Finalize();
-    exit(failure);
-  }
+  req = (MPI_Request *) xbt_malloc(num_reqs * sizeof(MPI_Request));
 
   req_ptr = req;
 
index eac171c..70c6924 100644 (file)
@@ -89,5 +89,5 @@ smpi_coll_tuned_allreduce_NTS(void *sbuf, void *rbuf, int rcount,
                          comm);
   }
 
-  return 0;
+  return MPI_SUCCESS;
 }
index 0496c87..2c7b49b 100644 (file)
@@ -24,11 +24,7 @@ int smpi_coll_tuned_allreduce_rab_rdb(void *sbuff, void *rbuff, int count,
   MPI_Comm_rank(comm, &rank);
 
   MPI_Type_extent(dtype, &extent);
-  tmp_buf = (void *) malloc(count * extent);
-  if (!tmp_buf) {
-    printf("Could not allocate memory for tmp_buf\n");
-    return 1;
-  }
+  tmp_buf = (void *) xbt_malloc(count * extent);
 
   MPIR_Localcopy(sbuff, count, dtype, rbuff, count, dtype);
 
@@ -200,5 +196,5 @@ int smpi_coll_tuned_allreduce_rab_rdb(void *sbuff, void *rbuff, int count,
   }
 
   free(tmp_buf);
-  return 0;
+  return MPI_SUCCESS;
 }
index 7a9eb2a..29b3866 100755 (executable)
@@ -345,11 +345,7 @@ int smpi_coll_tuned_allreduce_rab_reduce_scatter(void *sbuff, void *rbuff,
   MPI_Comm_rank(comm, &rank);
 
   MPI_Type_extent(dtype, &extent);
-  tmp_buf = (void *) malloc(count * extent);
-  if (!tmp_buf) {
-    printf("Could not allocate memory for tmp_buf\n");
-    return 1;
-  }
+  tmp_buf = (void *) xbt_malloc(count * extent);
 
   MPIR_Localcopy(sbuff, count, dtype, rbuff, count, dtype);
 
@@ -521,5 +517,5 @@ int smpi_coll_tuned_allreduce_rab_reduce_scatter(void *sbuff, void *rbuff,
   }
 
   free(tmp_buf);
-  return 0;
+  return MPI_SUCCESS;
 }
index 5af0511..54149d4 100644 (file)
@@ -15,11 +15,7 @@ int smpi_coll_tuned_allreduce_rab_rsag(void *sbuff, void *rbuff, int count,
   MPI_Comm_rank(comm, &rank);
 
   MPI_Type_extent(dtype, &extent);
-  tmp_buf = (void *) malloc(count * extent);
-  if (!tmp_buf) {
-    printf("Could not allocate memory for tmp_buf\n");
-    return 1;
-  }
+  tmp_buf = (void *) xbt_malloc(count * extent);
 
   MPI_Sendrecv(sbuff, count, dtype, rank, tag, rbuff, count, dtype, rank, tag,
                comm, &status);
@@ -193,5 +189,5 @@ int smpi_coll_tuned_allreduce_rab_rsag(void *sbuff, void *rbuff, int count,
   }
 
   free(tmp_buf);
-  return 0;
+  return MPI_SUCCESS;
 }
index 0dc64c1..ec6afc7 100644 (file)
@@ -97,5 +97,5 @@ int smpi_coll_tuned_allreduce_rab1(void *sbuff, void *rbuff,
     free(tmp_buf);
   }
 
-  return 0;
+  return MPI_SUCCESS;
 }
index d09cd11..b3c2c74 100644 (file)
@@ -74,5 +74,5 @@ int smpi_coll_tuned_allreduce_rab2(void *sbuff, void *rbuff,
     free(recv);
   }
 
-  return 0;
+  return MPI_SUCCESS;
 }
index fec95bc..204de02 100644 (file)
@@ -22,12 +22,8 @@ int smpi_coll_tuned_allreduce_rdb(void *sbuff, void *rbuff, int count,
   nprocs=smpi_comm_size(comm);
   rank=smpi_comm_rank(comm);
 
-  smpi_datatype_extent(dtype,&lb, &extent);
-  tmp_buf = (void *) malloc(count * extent);
-  if (!tmp_buf) {
-    printf("Could not allocate memory for tmp_buf\n");
-    return 1;
-  }
+  smpi_datatype_extent(dtype, &lb, &extent);
+  tmp_buf = (void *) xbt_malloc(count * extent);
 
   smpi_mpi_sendrecv(sbuff, count, dtype, rank, 500,
                rbuff, count, dtype, rank, 500, comm, &status);
@@ -126,5 +122,5 @@ int smpi_coll_tuned_allreduce_rdb(void *sbuff, void *rbuff, int count,
   }
 
   free(tmp_buf);
-  return 0;
+  return MPI_SUCCESS;
 }
index bc6f286..88d3561 100644 (file)
@@ -6,5 +6,5 @@ int smpi_coll_tuned_allreduce_redbcast(void *buf, void *buf2, int count,
 {
   smpi_mpi_reduce(buf, buf2, count, datatype, op, 0, comm);
   smpi_mpi_bcast(buf2, count, datatype, 0, comm);
-  return 0;
+  return MPI_SUCCESS;
 }
index b1ac1eb..644e6b9 100644 (file)
@@ -63,14 +63,14 @@ int smpi_coll_tuned_alltoall_2dmesh(void *send_buff, int send_count,
   int i, j, src, dst, rank, num_procs, count, num_reqs;
   int X, Y, send_offset, recv_offset;
   int my_row_base, my_col_base, src_row_base, block_size;
-  int tag = 1, failure = 0, success = 1;
+  int tag = 1;
 
   MPI_Comm_rank(comm, &rank);
   MPI_Comm_size(comm, &num_procs);
   MPI_Type_extent(send_type, &extent);
 
   if (!alltoall_check_is_2dmesh(num_procs, &X, &Y))
-    return failure;
+    return MPI_ERR_OTHER;
 
   my_row_base = (rank / Y) * Y;
   my_col_base = rank % Y;
@@ -81,14 +81,14 @@ int smpi_coll_tuned_alltoall_2dmesh(void *send_buff, int send_count,
   if (!tmp_buff1) {
     XBT_DEBUG("alltoall-2dmesh_shoot.c:88: cannot allocate memory");
     MPI_Finalize();
-    exit(failure);
+    exit(MPI_ERR_OTHER);
   }
 
   tmp_buff2 = (char *) malloc(block_size * Y);
   if (!tmp_buff2) {
     XBT_WARN("alltoall-2dmesh_shoot.c:88: cannot allocate memory");
     MPI_Finalize();
-    exit(failure);
+    exit(MPI_ERR_OTHER);
   }
 
 
@@ -102,7 +102,7 @@ int smpi_coll_tuned_alltoall_2dmesh(void *send_buff, int send_count,
   if (!reqs) {
     XBT_WARN("alltoall-2dmesh_shoot.c:88: cannot allocate memory");
     MPI_Finalize();
-    exit(failure);
+    exit(MPI_ERR_OTHER);
   }
 
   req_ptr = reqs;
@@ -188,5 +188,5 @@ int smpi_coll_tuned_alltoall_2dmesh(void *send_buff, int send_count,
   free(statuses);
   free(tmp_buff1);
   free(tmp_buff2);
-  return success;
+  return MPI_SUCCESS;
 }
index cae32a2..7ffac2b 100644 (file)
@@ -50,7 +50,7 @@ int smpi_coll_tuned_alltoall_3dmesh(void *send_buff, int send_count,
   MPI_Status status, *statuses;
   int i, j, src, dst, rank, num_procs, num_reqs, X, Y, Z, block_size, count;
   int my_z, two_dsize, my_row_base, my_col_base, my_z_base, src_row_base;
-  int src_z_base, send_offset, recv_offset, tag = 1, failure = 0, success = 1;
+  int src_z_base, send_offset, recv_offset, tag = 1;
 
   char *tmp_buff1, *tmp_buff2;
 
@@ -59,7 +59,7 @@ int smpi_coll_tuned_alltoall_3dmesh(void *send_buff, int send_count,
   MPI_Type_extent(send_type, &extent);
 
   if (!alltoall_check_is_3dmesh(num_procs, &X, &Y, &Z))
-    return failure;
+    return MPI_ERR_OTHER;
 
   num_reqs = X;
   if (Y > X)
@@ -76,27 +76,11 @@ int smpi_coll_tuned_alltoall_3dmesh(void *send_buff, int send_count,
 
   block_size = extent * send_count;
 
-  tmp_buff1 = (char *) malloc(block_size * num_procs * two_dsize);
-  if (!tmp_buff1) {
-    printf("alltoall-3Dmesh:97: cannot allocate memory\n");
-    MPI_Finalize();
-    exit(failure);
-  }
-
-  tmp_buff2 = (char *) malloc(block_size * two_dsize);
-  if (!tmp_buff2) {
-    printf("alltoall-3Dmesh:105: cannot allocate memory\n");
-    MPI_Finalize();
-    exit(failure);
-  }
+  tmp_buff1 = (char *) xbt_malloc(block_size * num_procs * two_dsize);
+  tmp_buff2 = (char *) xbt_malloc(block_size * two_dsize);
 
-  statuses = (MPI_Status *) malloc(num_reqs * sizeof(MPI_Status));
-  reqs = (MPI_Request *) malloc(num_reqs * sizeof(MPI_Request));
-  if (!reqs) {
-    printf("alltoall-3Dmesh:113: cannot allocate memory\n");
-    MPI_Finalize();
-    exit(failure);
-  }
+  statuses = (MPI_Status *) xbt_malloc(num_reqs * sizeof(MPI_Status));
+  reqs = (MPI_Request *) xbt_malloc(num_reqs * sizeof(MPI_Request));
 
   req_ptr = reqs;
 
@@ -193,5 +177,5 @@ int smpi_coll_tuned_alltoall_3dmesh(void *send_buff, int send_count,
   free(statuses);
   free(tmp_buff1);
   free(tmp_buff2);
-  return success;
+  return MPI_SUCCESS;
 }
index d6e12c2..d275395 100644 (file)
@@ -30,7 +30,7 @@ smpi_coll_tuned_alltoall_bruck(void *send_buff, int send_count,
 
   int *blocks_length, *disps;
   int i, src, dst, rank, num_procs, count, remainder, block, position;
-  int pack_size, tag = 1, pof2 = 1, success = 1, failure = 0;
+  int pack_size, tag = 1, pof2 = 1;
 
 
   char *tmp_buff;
@@ -42,27 +42,9 @@ smpi_coll_tuned_alltoall_bruck(void *send_buff, int send_count,
 
   MPI_Type_extent(recv_type, &extent);
 
-  tmp_buff = (char *) malloc(num_procs * recv_count * extent);
-  if (!tmp_buff) {
-    printf("alltoall-bruck:53: cannot allocate memory\n");
-    MPI_Finalize();
-    exit(failure);
-  }
-
-  disps = (int *) malloc(sizeof(int) * num_procs);
-  if (!disps) {
-    printf("alltoall-bruck:61: cannot allocate memory\n");
-    MPI_Finalize();
-    exit(failure);
-  }
-
-  blocks_length = (int *) malloc(sizeof(int) * num_procs);
-  if (!blocks_length) {
-    printf("alltoall-bruck:69: cannot allocate memory\n");
-    MPI_Finalize();
-    exit(failure);
-  }
-
+  tmp_buff = (char *) xbt_malloc(num_procs * recv_count * extent);
+  disps = (int *) xbt_malloc(sizeof(int) * num_procs);
+  blocks_length = (int *) xbt_malloc(sizeof(int) * num_procs);
 
   MPI_Sendrecv(send_ptr + rank * send_count * extent,
                (num_procs - rank) * send_count, send_type, rank, tag,
@@ -123,5 +105,5 @@ smpi_coll_tuned_alltoall_bruck(void *send_buff, int send_count,
                  recv_count, recv_type, rank, tag, comm, &status);
 
   free(tmp_buff);
-  return success;
+  return MPI_SUCCESS;
 }
index c26f57e..bde809b 100644 (file)
@@ -31,7 +31,7 @@ smpi_coll_tuned_alltoall_pair_light_barrier(void *send_buff, int send_count,
   MPI_Aint send_chunk, recv_chunk;
   MPI_Status s;
   int i, src, dst, rank, num_procs, next_partner;
-  int tag = 1, success = 1;     /*, failure = 0; */
+  int tag = 1;     /*, failure = 0; */
 
   char send_sync = 'a', recv_sync = 'b';
   char *send_ptr = (char *) send_buff;
@@ -62,5 +62,5 @@ smpi_coll_tuned_alltoall_pair_light_barrier(void *send_buff, int send_count,
                    &recv_sync, 1, MPI_CHAR, next_partner, tag, comm, &s);
     }
   }
-  return success;
+  return MPI_SUCCESS;
 }
index bbd6286..78d3caa 100644 (file)
@@ -30,7 +30,7 @@ smpi_coll_tuned_alltoall_pair_mpi_barrier(void *send_buff, int send_count,
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
   int i, src, dst, rank, num_procs;
-  int tag = 101, success = 1;   /*, failure = 0, pof2 = 1; */
+  int tag = 101;
   char *send_ptr = (char *) send_buff;
   char *recv_ptr = (char *) recv_buff;
 
@@ -49,5 +49,5 @@ smpi_coll_tuned_alltoall_pair_mpi_barrier(void *send_buff, int send_count,
                  tag, recv_ptr + src * recv_chunk, recv_count, recv_type,
                  src, tag, comm, &s);
   }
-  return success;
+  return MPI_SUCCESS;
 }
index 3de912a..195f455 100644 (file)
@@ -30,7 +30,7 @@ smpi_coll_tuned_alltoall_pair_one_barrier(void *send_buff, int send_count,
   MPI_Aint send_chunk, recv_chunk;
   MPI_Status s;
   int i, src, dst, rank, num_procs;
-  int tag = 1, success = 1;     /*, failure = 0, pof2 = 1; */
+  int tag = 1;
 
   char *send_ptr = (char *) send_buff;
   char *recv_ptr = (char *) recv_buff;
@@ -51,5 +51,5 @@ smpi_coll_tuned_alltoall_pair_one_barrier(void *send_buff, int send_count,
                  src, tag, comm, &s);
   }
 
-  return success;
+  return MPI_SUCCESS;
 }
index f5c5a94..6c5d8ee 100644 (file)
@@ -68,8 +68,7 @@ int smpi_coll_tuned_alltoall_pair(void *send_buff, int send_count,
   MPI_Aint send_chunk, recv_chunk;
   MPI_Status s;
   int i, src, dst, rank, num_procs;
-  int tag = 1, success = 1;
-
+  int tag = 1;
   char *send_ptr = (char *) send_buff;
   char *recv_ptr = (char *) recv_buff;
 
@@ -83,10 +82,10 @@ int smpi_coll_tuned_alltoall_pair(void *send_buff, int send_count,
 
   for (i = 0; i < num_procs; i++) {
     src = dst = rank ^ i;
-    MPI_Sendrecv(send_ptr + dst * send_chunk, send_count, send_type, dst,
-                 tag, recv_ptr + src * recv_chunk, recv_count, recv_type,
-                 src, tag, comm, &s);
+    MPI_Sendrecv(send_ptr + dst * send_chunk, send_count, send_type, dst, tag,
+                recv_ptr + src * recv_chunk, recv_count, recv_type, src, tag,
+                comm, &s);
   }
 
-  return success;
+  return MPI_SUCCESS;
 }
index 406d98d..edee61a 100644 (file)
@@ -33,7 +33,7 @@ int smpi_coll_tuned_alltoall_rdb(void *send_buff, int send_count,
   int dst_tree_root, rank_tree_root, send_offset, recv_offset;
   int rank, num_procs, j, k, dst, curr_size, max_size;
   int last_recv_count, tmp_mask, tree_root, num_procs_completed;
-  int tag = 1, mask = 1, success = 1, failure = 0, i = 0;
+  int tag = 1, mask = 1, i = 0;
 
   char *tmp_buff;
   char *send_ptr = (char *) send_buff;
@@ -50,12 +50,7 @@ int smpi_coll_tuned_alltoall_rdb(void *send_buff, int send_count,
 
   max_size = num_procs * recv_increment;
 
-  tmp_buff = (char *) malloc(max_size);
-  if (!tmp_buff) {
-    printf("alltoall-rdb:56: cannot allocate memory\n");
-    MPI_Finalize();
-    exit(failure);
-  }
+  tmp_buff = (char *) xbt_malloc(max_size);
 
   curr_size = send_count * num_procs;
 
@@ -149,5 +144,5 @@ int smpi_coll_tuned_alltoall_rdb(void *send_buff, int send_count,
                  recv_ptr + (i * recv_count * extent),
                  recv_count, recv_type, rank, tag, comm, &status);
   free(tmp_buff);
-  return success;
+  return MPI_SUCCESS;
 }
index f901445..a721c77 100644 (file)
@@ -31,7 +31,7 @@ smpi_coll_tuned_alltoall_ring_light_barrier(void *send_buff, int send_count,
   MPI_Aint send_chunk, recv_chunk;
   MPI_Status s;
   int i, src, dst, rank, num_procs, next_dst, next_src;
-  int tag = 1, success = 1;     /*, failure = 0; */
+  int tag = 1;
 
   char send_sync = 'a', recv_sync = 'b';
   char *send_ptr = (char *) send_buff;
@@ -66,5 +66,5 @@ smpi_coll_tuned_alltoall_ring_light_barrier(void *send_buff, int send_count,
     }
   }
 
-  return success;
+  return MPI_SUCCESS;
 }
index aaa6ac7..94a5fb9 100644 (file)
@@ -29,7 +29,7 @@ smpi_coll_tuned_alltoall_ring_mpi_barrier(void *send_buff, int send_count,
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
   int i, src, dst, rank, num_procs;
-  int tag = 1, success = 1;     /*, failure = 0, pof2 = 1; */
+  int tag = 1;
 
   char *send_ptr = (char *) send_buff;
   char *recv_ptr = (char *) recv_buff;
@@ -52,5 +52,5 @@ smpi_coll_tuned_alltoall_ring_mpi_barrier(void *send_buff, int send_count,
                  src, tag, comm, &s);
   }
 
-  return success;
+  return MPI_SUCCESS;
 }
index e008cfb..73ce561 100644 (file)
@@ -28,7 +28,7 @@ smpi_coll_tuned_alltoall_ring_one_barrier(void *send_buff, int send_count,
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
   int i, src, dst, rank, num_procs;
-  int tag = 1, success = 1;     /*, failure = 0, pof2 = 1; */
+  int tag = 1;
 
   char *send_ptr = (char *) send_buff;
   char *recv_ptr = (char *) recv_buff;
@@ -50,5 +50,5 @@ smpi_coll_tuned_alltoall_ring_one_barrier(void *send_buff, int send_count,
                  tag, recv_ptr + src * recv_chunk, recv_count, recv_type,
                  src, tag, comm, &s);
   }
-  return success;
+  return MPI_SUCCESS;
 }
index 9197609..88edd6e 100644 (file)
@@ -28,7 +28,7 @@ smpi_coll_tuned_alltoall_ring(void *send_buff, int send_count,
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
   int i, src, dst, rank, num_procs;
-  int tag = 1, success = 1; /*, failure = 0, pof2 = 1 */ ;
+  int tag = 11;
 
   char *send_ptr = (char *) send_buff;
   char *recv_ptr = (char *) recv_buff;
@@ -49,5 +49,5 @@ smpi_coll_tuned_alltoall_ring(void *send_buff, int send_count,
                  tag, recv_ptr + src * recv_chunk, recv_count, recv_type,
                  src, tag, comm, &s);
   }
-  return success;
+  return MPI_SUCCESS;
 }
index dd64a1d..d2988a7 100644 (file)
@@ -49,13 +49,8 @@ int smpi_coll_tuned_alltoall_simple(void *send_buff, int send_count,
 
   nreqs = 2 * (size - 1);
   if (nreqs > 0) {
-    req = (MPI_Request *) malloc(nreqs * sizeof(MPI_Request));
-    statuses = (MPI_Status *) malloc(nreqs * sizeof(MPI_Status));
-    if (!req || !statuses) {
-      free(req);
-      free(statuses);
-      return 0;
-    }
+    req = (MPI_Request *) xbt_malloc(nreqs * sizeof(MPI_Request));
+    statuses = (MPI_Status *) xbt_malloc(nreqs * sizeof(MPI_Status));
   } else {
     req = NULL;
     statuses = NULL;
@@ -118,5 +113,5 @@ int smpi_coll_tuned_alltoall_simple(void *send_buff, int send_count,
     free((char *) req);
   if (statuses)
     free(statuses);
-  return (1);
+  return MPI_SUCCESS;
 }
index ae67cfc..284f2c4 100644 (file)
@@ -68,7 +68,7 @@ smpi_coll_tuned_bcast_binomial_tree(void *buff, int count,
                                     MPI_Comm comm)
 {
   int src, dst, rank, num_procs, mask, relative_rank;
-  int tag = 1, success = 0;
+  int tag = 1;
 
   MPI_Comm_rank(comm, &rank);
   MPI_Comm_size(comm, &num_procs);
@@ -98,5 +98,5 @@ smpi_coll_tuned_bcast_binomial_tree(void *buff, int count,
     mask >>= 1;
   }
 
-  return success;
+  return MPI_SUCCESS;
 }
index db265a6..759f979 100644 (file)
@@ -71,7 +71,7 @@ smpi_coll_tuned_bcast_scatter_LR_allgather(void *buff, int count,
   int i, src, dst, rank, num_procs;
   int mask, relative_rank, curr_size, recv_size, send_size, nbytes;
   int scatter_size, left, right, next_src, *recv_counts, *disps;
-  int tag = 1, success = 0, failure = 1;
+  int tag = 1;
 
   MPI_Comm_rank(comm, &rank);
   MPI_Comm_size(comm, &num_procs);
@@ -131,19 +131,8 @@ smpi_coll_tuned_bcast_scatter_LR_allgather(void *buff, int count,
   }
 
   // done scatter now do allgather
-  recv_counts = (int *) malloc(sizeof(int) * num_procs);
-  if (!recv_counts) {
-    printf("bcast-scatter-LR-allgather:95: cannot allocate memory\n");
-    MPI_Finalize();
-    exit(failure);
-  }
-
-  disps = (int *) malloc(sizeof(int) * num_procs);
-  if (!disps) {
-    printf("bcast-scatter-LR-allgather:103: cannot allocate memory\n");
-    MPI_Finalize();
-    exit(failure);
-  }
+  recv_counts = (int *) xbt_malloc(sizeof(int) * num_procs);
+  disps = (int *) xbt_malloc(sizeof(int) * num_procs);
 
   for (i = 0; i < num_procs; i++) {
     recv_counts[i] = nbytes - i * scatter_size;
@@ -179,5 +168,5 @@ smpi_coll_tuned_bcast_scatter_LR_allgather(void *buff, int count,
   free(recv_counts);
   free(disps);
 
-  return success;
+  return MPI_SUCCESS;
 }
index 489f168..db3402c 100644 (file)
@@ -73,7 +73,7 @@ smpi_coll_tuned_bcast_scatter_rdb_allgather(void *buff, int count, MPI_Datatype
   int mask, relative_rank, curr_size, recv_size, send_size, nbytes;
   int scatter_size, tree_root, relative_dst, dst_tree_root;
   int my_tree_root, offset, tmp_mask, num_procs_completed;
-  int tag = 1, success = 0;
+  int tag = 1;
 
   MPI_Comm_rank(comm, &rank);
   MPI_Comm_size(comm, &num_procs);
@@ -232,5 +232,5 @@ smpi_coll_tuned_bcast_scatter_rdb_allgather(void *buff, int count, MPI_Datatype
     i++;
   }
 
-  return success;
+  return MPI_SUCCESS;
 }
index d53e729..a5f406f 100755 (executable)
@@ -163,6 +163,24 @@ else
 fi
 shift
 
+# steel --cfg and --logs options
+while [ $# -gt 0 ]; do
+  case "$1" in
+   "--cfg="*|"--log="*)
+     for OPT in ${1#*=}
+     do
+       SIMOPTS="$SIMOPTS ${1%%=*}=$OPT"
+     done
+     shift 1
+   ;;
+    *)
+      PROC_ARGS="$PROC_ARGS $1"
+      shift      
+    ;;
+  esac
+done
+
+
 ##-----------------------------------
 
 # Basic checks on the provided arguments
@@ -301,7 +319,7 @@ do
       echo "    <argument value=\"${hosttraces[0]}\"/>" >> ${APPLICATIONTMP}
     fi
   else 
-    for ARG in $*; do
+    for ARG in $PROC_ARGS; do
        echo "    <argument value=\"${ARG}\"/>" >> ${APPLICATIONTMP}
     done
   fi
index 857c23b..ca97628 100644 (file)
@@ -11,17 +11,22 @@ if(enable_smpi)
   
   include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi")
 
-  add_executable(alltoall2 alltoall2.c )
+  add_executable(allgather_coll allgather_coll.c)
+  add_executable(alltoall2 alltoall2.c)
   add_executable(alltoall_basic alltoall_basic.c)
+  add_executable(alltoall_coll alltoall_coll.c)        
   add_executable(alltoallv alltoallv.c)
   add_executable(allreduce allreduce.c)
+  add_executable(allreduce_coll allreduce_coll.c)  
   add_executable(bcast bcast.c)
+  add_executable(bcast_coll bcast_coll.c)  
   add_executable(compute compute.c)
   add_executable(compute2 compute2.c)
   add_executable(compute3 compute3.c)
   add_executable(pingpong pingpong.c)
   add_executable(scatter scatter.c)
   add_executable(reduce reduce.c)
+  add_executable(reduce_coll reduce_coll.c)
   add_executable(split split.c)
   add_executable(smpi_sendrecv sendrecv.c)
   add_executable(ttest01 ttest01.c)
@@ -30,17 +35,22 @@ if(enable_smpi)
   add_executable(indexed_test indexed_test.c)
   add_executable(struct_test struct_test.c)
 
+  target_link_libraries(allgather_coll simgrid)    
   target_link_libraries(alltoall2 simgrid)
   target_link_libraries(alltoall_basic simgrid)
+  target_link_libraries(alltoall_coll simgrid)    
   target_link_libraries(alltoallv simgrid)
   target_link_libraries(allreduce simgrid)
+  target_link_libraries(allreduce_coll simgrid)      
   target_link_libraries(bcast simgrid)
+  target_link_libraries(bcast_coll simgrid)      
   target_link_libraries(compute simgrid)
   target_link_libraries(compute2 simgrid)
   target_link_libraries(compute3 simgrid)
   target_link_libraries(pingpong simgrid)
   target_link_libraries(scatter simgrid)
   target_link_libraries(reduce simgrid)
+  target_link_libraries(reduce_coll simgrid)      
   target_link_libraries(split simgrid)
   target_link_libraries(smpi_sendrecv simgrid)
   target_link_libraries(ttest01 simgrid)
@@ -61,12 +71,17 @@ endif()
 
 set(tesh_files
   ${tesh_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/allgather_coll.tesh
+  ${CMAKE_CURRENT_SOURCE_DIR}/allreduce_coll.tesh
+  ${CMAKE_CURRENT_SOURCE_DIR}/alltoall_coll.tesh  
   ${CMAKE_CURRENT_SOURCE_DIR}/bcast.tesh
+  ${CMAKE_CURRENT_SOURCE_DIR}/bcast_coll.tesh  
   ${CMAKE_CURRENT_SOURCE_DIR}/compute.tesh
   ${CMAKE_CURRENT_SOURCE_DIR}/hvector.tesh
   ${CMAKE_CURRENT_SOURCE_DIR}/indexed.tesh
   ${CMAKE_CURRENT_SOURCE_DIR}/pt2pt.tesh
   ${CMAKE_CURRENT_SOURCE_DIR}/reduce.tesh
+  ${CMAKE_CURRENT_SOURCE_DIR}/reduce_coll.tesh  
   ${CMAKE_CURRENT_SOURCE_DIR}/struct.tesh
   ${CMAKE_CURRENT_SOURCE_DIR}/vector.tesh  
   PARENT_SCOPE
@@ -77,6 +92,11 @@ set(xml_files
   )
 set(examples_src
   ${examples_src}
+  ${CMAKE_CURRENT_SOURCE_DIR}/allgather_coll.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/allreduce_coll.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/alltoall_coll.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/bcast_coll.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/reduce_coll.c
   ${CMAKE_CURRENT_SOURCE_DIR}/alltoallv.c
   ${CMAKE_CURRENT_SOURCE_DIR}/get_processor_name.c
   ${CMAKE_CURRENT_SOURCE_DIR}/pingpong.c
diff --git a/teshsuite/smpi/allgather_coll.c b/teshsuite/smpi/allgather_coll.c
new file mode 100644 (file)
index 0000000..dfc7769
--- /dev/null
@@ -0,0 +1,62 @@
+/* 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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include "mpi.h"
+
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+#endif
+
+int main(int argc, char *argv[])
+{
+  int rank, size;
+  int i;
+  int *sb;
+  int *rb;
+  int status;
+
+  MPI_Init(&argc, &argv);
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+  int count = 2;
+  sb = (int *) xbt_malloc(count * sizeof(int));
+  rb = (int *) xbt_malloc(count * size * sizeof(int));
+  
+  for (i = 0; i < count; ++i)
+    sb[i] = rank * count + i;
+  for (i = 0; i < count * size; ++i)  
+    rb[i] = 0;
+
+  printf("[%d] sndbuf=[", rank);
+  for (i = 0; i < count; i++)
+    printf("%d ", sb[i]);
+  printf("]\n");
+
+  status = MPI_Allgather(sb, count, MPI_INT, rb, count, MPI_INT, MPI_COMM_WORLD);
+
+  printf("[%d] rcvbuf=[", rank);
+  for (i = 0; i < count * size; i++)
+    printf("%d ", rb[i]);
+  printf("]\n");
+
+
+  if (rank == 0) {
+    if (status != MPI_SUCCESS) {
+      printf("allgather returned %d\n", status);
+      fflush(stdout);
+    }
+  }
+  free(sb);
+  free(rb);
+  MPI_Finalize();
+  return (EXIT_SUCCESS);
+}
diff --git a/teshsuite/smpi/allgather_coll.tesh b/teshsuite/smpi/allgather_coll.tesh
new file mode 100644 (file)
index 0000000..2ff7d58
--- /dev/null
@@ -0,0 +1,57 @@
+# Smpi Alltoall collectives tests
+! setenv LD_LIBRARY_PATH=../../lib
+! output sort
+
+p Test all to all
+$ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../../examples/msg/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ./allgather_coll
+> You requested to use 16 processes, but there is only 5 processes in your hostfile...
+> [rank 0] -> Tremblay
+> [rank 1] -> Jupiter
+> [rank 2] -> Fafard
+> [rank 3] -> Ginette
+> [rank 4] -> Bourassa
+> [rank 5] -> Tremblay
+> [rank 6] -> Jupiter
+> [rank 7] -> Fafard
+> [rank 8] -> Ginette
+> [rank 9] -> Bourassa
+> [rank 10] -> Tremblay
+> [rank 11] -> Jupiter
+> [rank 12] -> Fafard
+> [rank 13] -> Ginette
+> [rank 14] -> Bourassa
+> [rank 15] -> Tremblay
+> [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
+> [0] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [1] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [2] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [3] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [4] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [5] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [6] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [7] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [8] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [9] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [10] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [11] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [12] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [13] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [14] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [15] rcvbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [0] sndbuf=[0 1 ]
+> [1] sndbuf=[2 3 ]
+> [2] sndbuf=[4 5 ]
+> [3] sndbuf=[6 7 ]
+> [4] sndbuf=[8 9 ]
+> [5] sndbuf=[10 11 ]
+> [6] sndbuf=[12 13 ]
+> [7] sndbuf=[14 15 ]
+> [8] sndbuf=[16 17 ]
+> [9] sndbuf=[18 19 ]
+> [10] sndbuf=[20 21 ]
+> [11] sndbuf=[22 23 ]
+> [12] sndbuf=[24 25 ]
+> [13] sndbuf=[26 27 ]
+> [14] sndbuf=[28 29 ]
+> [15] sndbuf=[30 31 ]
+
diff --git a/teshsuite/smpi/allreduce_coll.c b/teshsuite/smpi/allreduce_coll.c
new file mode 100644 (file)
index 0000000..a2c9921
--- /dev/null
@@ -0,0 +1,61 @@
+/* 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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include "mpi.h"
+
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+#endif
+
+int main(int argc, char *argv[])
+{
+  int rank, size;
+  int i;
+  int *sb;
+  int *rb;
+  int status;
+
+  MPI_Init(&argc, &argv);
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+  sb = (int *) xbt_malloc(size * sizeof(int));
+  rb = (int *) xbt_malloc(size * sizeof(int));
+  
+  for (i = 0; i < size; ++i) {
+    sb[i] = rank*size + i;
+    rb[i] = 0;
+  }
+
+  printf("[%d] sndbuf=[", rank);
+  for (i = 0; i < size; i++)
+    printf("%d ", sb[i]);
+  printf("]\n");
+
+  status = MPI_Allreduce(sb, rb, size, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+
+  printf("[%d] rcvbuf=[", rank);
+  for (i = 0; i < size; i++)
+    printf("%d ", rb[i]);
+  printf("]\n");
+
+
+  if (rank == 0) {
+    if (status != MPI_SUCCESS) {
+      printf("all_to_all returned %d\n", status);
+      fflush(stdout);
+    }
+  }
+  free(sb);
+  free(rb);
+  MPI_Finalize();
+  return (EXIT_SUCCESS);
+}
diff --git a/teshsuite/smpi/allreduce_coll.tesh b/teshsuite/smpi/allreduce_coll.tesh
new file mode 100644 (file)
index 0000000..8cde55d
--- /dev/null
@@ -0,0 +1,57 @@
+# Smpi Allreduce collectives tests
+! setenv LD_LIBRARY_PATH=../../lib
+! output sort
+
+p Test allreduce
+$ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../../examples/msg/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ./allreduce_coll
+> You requested to use 16 processes, but there is only 5 processes in your hostfile...
+> [rank 0] -> Tremblay
+> [rank 1] -> Jupiter
+> [rank 2] -> Fafard
+> [rank 3] -> Ginette
+> [rank 4] -> Bourassa
+> [rank 5] -> Tremblay
+> [rank 6] -> Jupiter
+> [rank 7] -> Fafard
+> [rank 8] -> Ginette
+> [rank 9] -> Bourassa
+> [rank 10] -> Tremblay
+> [rank 11] -> Jupiter
+> [rank 12] -> Fafard
+> [rank 13] -> Ginette
+> [rank 14] -> Bourassa
+> [rank 15] -> Tremblay
+> [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
+> [0] sndbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ]
+> [1] sndbuf=[16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [2] sndbuf=[32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 ]
+> [3] sndbuf=[48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 ]
+> [4] sndbuf=[64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 ]
+> [5] sndbuf=[80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ]
+> [6] sndbuf=[96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 ]
+> [7] sndbuf=[112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 ]
+> [8] sndbuf=[128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 ]
+> [9] sndbuf=[144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 ]
+> [10] sndbuf=[160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 ]
+> [11] sndbuf=[176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 ]
+> [12] sndbuf=[192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 ]
+> [13] sndbuf=[208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 ]
+> [14] sndbuf=[224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 ]
+> [15] sndbuf=[240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 ]
+> [0] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [1] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [2] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [3] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [4] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [5] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [6] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [7] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [8] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [9] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [10] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [11] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [12] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [13] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [14] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [15] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+
index ad25e7a..869dd7c 100644 (file)
@@ -44,6 +44,7 @@ int main(int argc, char *argv[])
     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 +54,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);
     }
diff --git a/teshsuite/smpi/alltoall_coll.c b/teshsuite/smpi/alltoall_coll.c
new file mode 100644 (file)
index 0000000..4c95ba3
--- /dev/null
@@ -0,0 +1,61 @@
+/* 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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include "mpi.h"
+
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+#endif
+
+int main(int argc, char *argv[])
+{
+  int rank, size;
+  int i;
+  int *sb;
+  int *rb;
+  int status;
+
+  MPI_Init(&argc, &argv);
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+  sb = (int *) xbt_malloc(size * sizeof(int) * 2);
+  rb = (int *) xbt_malloc(size * sizeof(int) * 2);
+  
+  for (i = 0; i < size; ++i) {
+    sb[i] = rank*size + i;
+    rb[i] = 0;
+  }
+
+  printf("[%d] sndbuf=[", rank);
+  for (i = 0; i < size; i++)
+    printf("%d ", sb[i]);
+  printf("]\n");
+
+  status = MPI_Alltoall(sb, 1, MPI_INT, rb, 1, MPI_INT, MPI_COMM_WORLD);
+
+  printf("[%d] rcvbuf=[", rank);
+  for (i = 0; i < size; i++)
+    printf("%d ", rb[i]);
+  printf("]\n");
+
+
+  if (rank == 0) {
+    if (status != MPI_SUCCESS) {
+      printf("all_to_all returned %d\n", status);
+      fflush(stdout);
+    }
+  }
+  free(sb);
+  free(rb);
+  MPI_Finalize();
+  return (EXIT_SUCCESS);
+}
diff --git a/teshsuite/smpi/alltoall_coll.tesh b/teshsuite/smpi/alltoall_coll.tesh
new file mode 100644 (file)
index 0000000..0cab7ea
--- /dev/null
@@ -0,0 +1,57 @@
+# Smpi Alltoall collectives tests
+! setenv LD_LIBRARY_PATH=../../lib
+! output sort
+
+p Test all to all
+$ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../../examples/msg/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ./alltoall_coll -q
+> You requested to use 16 processes, but there is only 5 processes in your hostfile...
+> [rank 0] -> Tremblay
+> [rank 1] -> Jupiter
+> [rank 2] -> Fafard
+> [rank 3] -> Ginette
+> [rank 4] -> Bourassa
+> [rank 5] -> Tremblay
+> [rank 6] -> Jupiter
+> [rank 7] -> Fafard
+> [rank 8] -> Ginette
+> [rank 9] -> Bourassa
+> [rank 10] -> Tremblay
+> [rank 11] -> Jupiter
+> [rank 12] -> Fafard
+> [rank 13] -> Ginette
+> [rank 14] -> Bourassa
+> [rank 15] -> Tremblay
+> [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
+> [0] sndbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ]
+> [1] sndbuf=[16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [2] sndbuf=[32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 ]
+> [3] sndbuf=[48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 ]
+> [4] sndbuf=[64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 ]
+> [5] sndbuf=[80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ]
+> [6] sndbuf=[96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 ]
+> [7] sndbuf=[112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 ]
+> [8] sndbuf=[128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 ]
+> [9] sndbuf=[144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 ]
+> [10] sndbuf=[160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 ]
+> [11] sndbuf=[176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 ]
+> [12] sndbuf=[192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 ]
+> [13] sndbuf=[208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 ]
+> [14] sndbuf=[224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 ]
+> [15] sndbuf=[240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 ]
+> [0] rcvbuf=[0 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 ]
+> [1] rcvbuf=[1 17 33 49 65 81 97 113 129 145 161 177 193 209 225 241 ]
+> [2] rcvbuf=[2 18 34 50 66 82 98 114 130 146 162 178 194 210 226 242 ]
+> [3] rcvbuf=[3 19 35 51 67 83 99 115 131 147 163 179 195 211 227 243 ]
+> [4] rcvbuf=[4 20 36 52 68 84 100 116 132 148 164 180 196 212 228 244 ]
+> [5] rcvbuf=[5 21 37 53 69 85 101 117 133 149 165 181 197 213 229 245 ]
+> [6] rcvbuf=[6 22 38 54 70 86 102 118 134 150 166 182 198 214 230 246 ]
+> [7] rcvbuf=[7 23 39 55 71 87 103 119 135 151 167 183 199 215 231 247 ]
+> [8] rcvbuf=[8 24 40 56 72 88 104 120 136 152 168 184 200 216 232 248 ]
+> [9] rcvbuf=[9 25 41 57 73 89 105 121 137 153 169 185 201 217 233 249 ]
+> [10] rcvbuf=[10 26 42 58 74 90 106 122 138 154 170 186 202 218 234 250 ]
+> [11] rcvbuf=[11 27 43 59 75 91 107 123 139 155 171 187 203 219 235 251 ]
+> [12] rcvbuf=[12 28 44 60 76 92 108 124 140 156 172 188 204 220 236 252 ]
+> [13] rcvbuf=[13 29 45 61 77 93 109 125 141 157 173 189 205 221 237 253 ]
+> [14] rcvbuf=[14 30 46 62 78 94 110 126 142 158 174 190 206 222 238 254 ]
+> [15] rcvbuf=[15 31 47 63 79 95 111 127 143 159 175 191 207 223 239 255 ]
+
diff --git a/teshsuite/smpi/bcast_coll.c b/teshsuite/smpi/bcast_coll.c
new file mode 100644 (file)
index 0000000..1402883
--- /dev/null
@@ -0,0 +1,37 @@
+/* Copyright (c) 2009. 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 <stdio.h>
+#include <mpi.h>
+
+int main(int argc, char **argv)
+{
+  int size, rank;
+  int value = 3;
+  int status;
+
+  MPI_Init(&argc, &argv);
+  MPI_Comm_size(MPI_COMM_WORLD, &size);
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+  if (0 == rank) {
+    value = 17;
+  }
+  status = MPI_Bcast(&value, 1, MPI_INT, 0, MPI_COMM_WORLD);
+  printf("node %d has value %d after broadcast\n", rank, value);
+
+  MPI_Barrier(MPI_COMM_WORLD);
+
+  if (rank == 0) {
+    if (status != MPI_SUCCESS) {
+      printf("bcast returned %d\n", status);
+      fflush(stdout);
+    }
+  }
+
+  MPI_Finalize();
+  return 0;
+}
diff --git a/teshsuite/smpi/bcast_coll.tesh b/teshsuite/smpi/bcast_coll.tesh
new file mode 100644 (file)
index 0000000..08d965d
--- /dev/null
@@ -0,0 +1,41 @@
+p Test Broadcast with more processes than hosts
+! setenv LD_LIBRARY_PATH=../../lib
+! output sort
+
+$ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../../examples/msg/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ./bcast_coll
+> You requested to use 16 processes, but there is only 5 processes in your hostfile...
+> [rank 0] -> Tremblay
+> [rank 1] -> Jupiter
+> [rank 2] -> Fafard
+> [rank 3] -> Ginette
+> [rank 4] -> Bourassa
+> [rank 5] -> Tremblay
+> [rank 6] -> Jupiter
+> [rank 7] -> Fafard
+> [rank 8] -> Ginette
+> [rank 9] -> Bourassa
+> [rank 10] -> Tremblay
+> [rank 11] -> Jupiter
+> [rank 12] -> Fafard
+> [rank 13] -> Ginette
+> [rank 14] -> Bourassa
+> [rank 15] -> Tremblay
+> [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
+> node 0 has value 17 after broadcast
+> node 1 has value 17 after broadcast
+> node 2 has value 17 after broadcast
+> node 3 has value 17 after broadcast
+> node 4 has value 17 after broadcast
+> node 5 has value 17 after broadcast
+> node 6 has value 17 after broadcast
+> node 7 has value 17 after broadcast
+> node 8 has value 17 after broadcast
+> node 9 has value 17 after broadcast
+> node 10 has value 17 after broadcast
+> node 11 has value 17 after broadcast
+> node 12 has value 17 after broadcast
+> node 13 has value 17 after broadcast
+> node 14 has value 17 after broadcast
+> node 15 has value 17 after broadcast
+
+
diff --git a/teshsuite/smpi/reduce_coll.c b/teshsuite/smpi/reduce_coll.c
new file mode 100644 (file)
index 0000000..ee629e3
--- /dev/null
@@ -0,0 +1,62 @@
+/* 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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include "mpi.h"
+
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+#endif
+
+int main(int argc, char *argv[])
+{
+  int rank, size;
+  int i;
+  int *sb;
+  int *rb;
+  int status;
+
+  MPI_Init(&argc, &argv);
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+  sb = (int *) xbt_malloc(size * sizeof(int));
+  rb = (int *) xbt_malloc(size * sizeof(int));
+  
+  for (i = 0; i < size; ++i) {
+    sb[i] = rank*size + i;
+    rb[i] = 0;
+  }
+
+  printf("[%d] sndbuf=[", rank);
+  for (i = 0; i < size; i++)
+    printf("%d ", sb[i]);
+  printf("]\n");
+
+  status = MPI_Reduce(sb, rb, size, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
+  MPI_Barrier(MPI_COMM_WORLD);
+
+  printf("[%d] rcvbuf=[", rank);
+  for (i = 0; i < size; i++)
+    printf("%d ", rb[i]);
+  printf("]\n");
+
+
+  if (rank == 0) {
+    if (status != MPI_SUCCESS) {
+      printf("all_to_all returned %d\n", status);
+      fflush(stdout);
+    }
+  }
+  free(sb);
+  free(rb);
+  MPI_Finalize();
+  return (EXIT_SUCCESS);
+}
diff --git a/teshsuite/smpi/reduce_coll.tesh b/teshsuite/smpi/reduce_coll.tesh
new file mode 100644 (file)
index 0000000..539c2d2
--- /dev/null
@@ -0,0 +1,56 @@
+# Smpi Allreduce collectives tests
+! setenv LD_LIBRARY_PATH=../../lib
+! output sort
+
+p Test allreduce
+$ ../../bin/smpirun -map -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../../examples/msg/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ./reduce_coll
+> You requested to use 16 processes, but there is only 5 processes in your hostfile...
+> [rank 0] -> Tremblay
+> [rank 1] -> Jupiter
+> [rank 2] -> Fafard
+> [rank 3] -> Ginette
+> [rank 4] -> Bourassa
+> [rank 5] -> Tremblay
+> [rank 6] -> Jupiter
+> [rank 7] -> Fafard
+> [rank 8] -> Ginette
+> [rank 9] -> Bourassa
+> [rank 10] -> Tremblay
+> [rank 11] -> Jupiter
+> [rank 12] -> Fafard
+> [rank 13] -> Ginette
+> [rank 14] -> Bourassa
+> [rank 15] -> Tremblay
+> [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
+> [0] sndbuf=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ]
+> [1] sndbuf=[16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ]
+> [2] sndbuf=[32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 ]
+> [3] sndbuf=[48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 ]
+> [4] sndbuf=[64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 ]
+> [5] sndbuf=[80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ]
+> [6] sndbuf=[96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 ]
+> [7] sndbuf=[112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 ]
+> [8] sndbuf=[128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 ]
+> [9] sndbuf=[144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 ]
+> [10] sndbuf=[160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 ]
+> [11] sndbuf=[176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 ]
+> [12] sndbuf=[192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 ]
+> [13] sndbuf=[208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 ]
+> [14] sndbuf=[224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 ]
+> [15] sndbuf=[240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 ]
+> [0] rcvbuf=[1920 1936 1952 1968 1984 2000 2016 2032 2048 2064 2080 2096 2112 2128 2144 2160 ]
+> [1] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [2] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [3] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [4] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [5] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [6] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [7] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [8] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [9] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [10] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [11] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [12] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [13] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [14] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
+> [15] rcvbuf=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]