Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #218 from Takishipp/MSG2S4U
[simgrid.git] / teshsuite / smpi / coll-allreduce / coll-allreduce.c
index 7eef339..509aec9 100644 (file)
@@ -29,10 +29,10 @@ int main(int argc, char *argv[])
   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
   MPI_Comm_size(MPI_COMM_WORLD, &size);
   if (maxlen > 1)
-    mult = size;
+    mult = maxlen > size ? size : maxlen;
   int* sb = (int *) xbt_malloc(size *maxlen * sizeof(int));
   int* rb = (int *) xbt_malloc(size *maxlen * sizeof(int));
-  
+
   for (i = 0; i < size *maxlen; ++i) {
     sb[i] = rank*size + i;
     rb[i] = 0;