Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 16 Feb 2017 11:34:57 +0000 (12:34 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 16 Feb 2017 11:34:57 +0000 (12:34 +0100)
src/smpi/colls/bcast-arrival-scatter.c
src/smpi/colls/reduce-rab.c
src/smpi/smpi_rma.cpp
teshsuite/smpi/coll-reduce/coll-reduce.c

index 7e700eb..ff7b10b 100644 (file)
@@ -192,12 +192,9 @@ int smpi_coll_tuned_bcast_arrival_scatter(void *buf, int count,
              0, tag, comm, &status);
 
     /* at this point all nodes in this set perform all-gather operation */
-    to = header_buf[myordering + 1];
-    from = header_buf[myordering - 1];
-    if (myordering == 0)
-      from = header_buf[total_nodes - 1];
-    if (myordering == (total_nodes - 1))
-      to = header_buf[0];
+    
+    to = (myordering == (total_nodes - 1)) ? header_buf[0] : header_buf[myordering + 1];
+    from = (myordering == 0) ? header_buf[total_nodes - 1] : header_buf[myordering - 1];
 
 
     /* last segment may have a larger size since it also include the remainder */
index e293606..61653b7 100644 (file)
@@ -410,7 +410,7 @@ Benchmark results on CRAY T3E
 #endif
 
 typedef enum {MPIM_SHORT, MPIM_INT, MPIM_LONG, MPIM_UNSIGNED_SHORT,
-              MPIM_UNSIGNED, MPIM_UNSIGNED_LONG, MPIM_FLOAT,
+              MPIM_UNSIGNED, MPIM_UNSIGNED_LONG, MPIM_UNSIGNED_LONG_LONG, MPIM_FLOAT,
               MPIM_DOUBLE, MPIM_BYTE} MPIM_Datatype;
 
 typedef enum {MPIM_MAX, MPIM_MIN, MPIM_SUM, MPIM_PROD,
@@ -467,6 +467,7 @@ MPI_I_DO_OP_C_INTEGER( MPI_I_do_op_long,   long)
 MPI_I_DO_OP_C_INTEGER( MPI_I_do_op_ushort, unsigned short)
 MPI_I_DO_OP_C_INTEGER( MPI_I_do_op_uint,   unsigned int)
 MPI_I_DO_OP_C_INTEGER( MPI_I_do_op_ulong,  unsigned long)
+MPI_I_DO_OP_C_INTEGER( MPI_I_do_op_ulonglong,  unsigned long long)
 MPI_I_DO_OP_FP(        MPI_I_do_op_float,  float)
 MPI_I_DO_OP_FP(        MPI_I_do_op_double, double)
 MPI_I_DO_OP_BYTE(      MPI_I_do_op_byte,   char)
@@ -487,6 +488,8 @@ static void MPI_I_do_op(void* b1, void* b2, void* rslt, int cnt,
                    MPI_I_DO_OP_CALL(MPI_I_do_op_uint,   unsigned int)
   case MPIM_UNSIGNED_LONG:
                    MPI_I_DO_OP_CALL(MPI_I_do_op_ulong,  unsigned long)
+  case MPIM_UNSIGNED_LONG_LONG:
+                   MPI_I_DO_OP_CALL(MPI_I_do_op_ulonglong,  unsigned long long)
   case MPIM_FLOAT : MPI_I_DO_OP_CALL(MPI_I_do_op_float,  float)
   case MPIM_DOUBLE: MPI_I_DO_OP_CALL(MPI_I_do_op_double, double)
   case MPIM_BYTE  : MPI_I_DO_OP_CALL(MPI_I_do_op_byte,   char)
@@ -513,9 +516,12 @@ static int MPI_I_anyReduce(void* Sendbuf, void* Recvbuf, int count, MPI_Datatype
   else if(mpi_datatype==MPI_UNSIGNED_SHORT) datatype=MPIM_UNSIGNED_SHORT;
   else if(mpi_datatype==MPI_UNSIGNED      ) datatype=MPIM_UNSIGNED;
   else if(mpi_datatype==MPI_UNSIGNED_LONG ) datatype=MPIM_UNSIGNED_LONG;
+  else if(mpi_datatype==MPI_UNSIGNED_LONG_LONG ) datatype=MPIM_UNSIGNED_LONG_LONG;
   else if(mpi_datatype==MPI_FLOAT         ) datatype=MPIM_FLOAT;
   else if(mpi_datatype==MPI_DOUBLE        ) datatype=MPIM_DOUBLE;
   else if(mpi_datatype==MPI_BYTE          ) datatype=MPIM_BYTE;
+  else
+   THROWF(arg_error,0, "reduce rab algorithm can't be used with this datatype ! ");
 
   if     (mpi_op==MPI_MAX     ) op=MPIM_MAX;
   else if(mpi_op==MPI_MIN     ) op=MPIM_MIN;
@@ -546,7 +552,7 @@ static int MPI_I_anyReduce(void* Sendbuf, void* Recvbuf, int count, MPI_Datatype
          new_prot = count >= Lsh[is_all][ss]; break;
         case MPIM_INT:    case MPIM_UNSIGNED:
          new_prot = count >= Lin[is_all][ss]; break;
-        case MPIM_LONG:   case MPIM_UNSIGNED_LONG:
+        case MPIM_LONG:   case MPIM_UNSIGNED_LONG: case MPIM_UNSIGNED_LONG_LONG:
          new_prot = count >= Llg[is_all][ss]; break;
      default:
         break;
index 68d8507..6edbee3 100644 (file)
@@ -117,13 +117,16 @@ int smpi_mpi_win_fence( int assert,  MPI_Win win){
     std::vector<MPI_Request> *reqs = win->requests;
     int size = static_cast<int>(reqs->size());
     // start all requests that have been prepared by another process
-    for(auto req: *reqs){
-      if (req && (req->flags & PREPARED))
-        smpi_mpi_start(req);
-    }
+    if(size>0){
+        for(auto req: *reqs){
+          if (req && (req->flags & PREPARED))
+            smpi_mpi_start(req);
+        }
+
+        MPI_Request* treqs = &(*reqs)[0];
 
-    MPI_Request* treqs = &(*reqs)[0];
-    smpi_mpi_waitall(size,treqs,MPI_STATUSES_IGNORE);
+        smpi_mpi_waitall(size,treqs,MPI_STATUSES_IGNORE);
+    }
     win->count=0;
   }
   win->assert = assert;
index 9543c53..b7da72a 100644 (file)
@@ -19,16 +19,16 @@ int main(int argc, char *argv[])
 {
   int rank, size;
   int i;
-  long int *sb;
-  long int *rb;
+  unsigned long long *sb;
+  unsigned long long *rb;
   int status;
 
   MPI_Init(&argc, &argv);
   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
   MPI_Comm_size(MPI_COMM_WORLD, &size);
 
-  sb = (long int *) xbt_malloc(size * sizeof(long int));
-  rb = (long int *) xbt_malloc(size * sizeof(long int));
+  sb = (unsigned long long *) xbt_malloc(size * sizeof(unsigned long long));
+  rb = (unsigned long long *) xbt_malloc(size * sizeof(unsigned long long));
 
   for (i = 0; i < size; ++i) {
     sb[i] = rank*size + i;
@@ -36,17 +36,17 @@ int main(int argc, char *argv[])
   }
   printf("[%d] sndbuf=[", rank);
   for (i = 0; i < size; i++)
-    printf("%ld ", sb[i]);
+    printf("%llu ", sb[i]);
   printf("]\n");
 
   int root=0;
-  status = MPI_Reduce(sb, rb, size, MPI_LONG, MPI_SUM, root, MPI_COMM_WORLD);
+  status = MPI_Reduce(sb, rb, size, MPI_UNSIGNED_LONG_LONG, MPI_SUM, root, MPI_COMM_WORLD);
   MPI_Barrier(MPI_COMM_WORLD);
 
   if (rank == root) {
     printf("[%d] rcvbuf=[", rank);
     for (i = 0; i < size; i++)
-      printf("%ld ", rb[i]);
+      printf("%llu ", rb[i]);
     printf("]\n");
     if (status != MPI_SUCCESS) {
       printf("all_to_all returned %d\n", status);
@@ -56,17 +56,17 @@ int main(int argc, char *argv[])
 
   printf("[%d] second sndbuf=[", rank);
   for (i = 0; i < 1; i++)
-    printf("%ld ", sb[i]);
+    printf("%llu ", sb[i]);
   printf("]\n");
 
   root=size-1;
-  status = MPI_Reduce(sb, rb, 1, MPI_LONG, MPI_PROD, root, MPI_COMM_WORLD);
+  status = MPI_Reduce(sb, rb, 1, MPI_UNSIGNED_LONG_LONG, MPI_PROD, root, MPI_COMM_WORLD);
   MPI_Barrier(MPI_COMM_WORLD);
 
   if (rank == root) {
     printf("[%d] rcvbuf=[", rank);
     for (i = 0; i < 1; i++)
-      printf("%ld ", rb[i]);
+      printf("%llu ", rb[i]);
     printf("]\n");
     if (status != MPI_SUCCESS) {
       printf("all_to_all returned %d\n", status);