Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / smpi / colls / bcast-arrival-pattern-aware-wait.c
index 0a12246..8e33648 100644 (file)
@@ -1,3 +1,9 @@
+/* Copyright (c) 2013-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 "colls_private.h"
 
 int bcast_arrival_pattern_aware_wait_segment_size_in_byte = 8192;
@@ -27,7 +33,7 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware_wait(void *buf, int count,
 
   int rank, size;
   int i, j, k;
-  int tag = 50;
+  int tag = -COLL_TAG_BCAST;
   int will_send[BCAST_ARRIVAL_PATTERN_AWARE_MAX_NODE];
 
   int sent_count;
@@ -49,13 +55,13 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware_wait(void *buf, int count,
 
 
 
-  rank = smpi_comm_rank(MPI_COMM_WORLD);
-  size = smpi_comm_size(MPI_COMM_WORLD);
+  rank = smpi_comm_rank(comm);
+  size = smpi_comm_size(comm);
 
 
   /* segment is segment size in number of elements (not bytes) */
   int segment = bcast_arrival_pattern_aware_wait_segment_size_in_byte / extent;
-
+  segment =  segment == 0 ? 1 :segment; 
   /* pipeline length */
   int pipe_length = count / segment;
 
@@ -114,11 +120,11 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware_wait(void *buf, int count,
       for (k = 0; k < 3; k++) {
         for (i = 1; i < size; i++) {
           if ((already_sent[i] == 0) && (will_send[i] == 0)) {
-            smpi_mpi_iprobe(i, MPI_ANY_TAG, MPI_COMM_WORLD, &flag_array[i],
+            smpi_mpi_iprobe(i, MPI_ANY_TAG, comm, &flag_array[i],
                        &temp_status_array[i]);
             if (flag_array[i] == 1) {
               will_send[i] = 1;
-              smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, MPI_COMM_WORLD,
+              smpi_mpi_recv(&temp_buf[i], 1, MPI_CHAR, i, tag, comm,
                        &status);
               i = 0;
             }