Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branches 'master' and 'master' of github.com:simgrid/simgrid
[simgrid.git] / src / smpi / colls / bcast / bcast-scatter-rdb-allgather.cpp
index 7b98385..775b82e 100644 (file)
@@ -1,4 +1,13 @@
+/* Copyright (c) 2011-2017. 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"
+#include "src/smpi/smpi_status.hpp"
+
+namespace simgrid{
+namespace smpi{
 
 static int scatter_for_bcast(
     int root,
@@ -55,7 +64,7 @@ static int scatter_for_bcast(
                                          recv_size, MPI_BYTE, src,
                                          COLL_TAG_BCAST, comm, &status);
                 /* query actual size of data received */
-                curr_size=smpi_mpi_get_count(&status, MPI_BYTE);
+                curr_size=Status::get_count(&status, MPI_BYTE);
             }
             break;
         }
@@ -92,8 +101,9 @@ static int scatter_for_bcast(
     return mpi_errno;
 }
 
+
 int
-smpi_coll_tuned_bcast_scatter_rdb_allgather (
+Coll_bcast_scatter_rdb_allgather::bcast (
     void *buffer, 
     int count, 
     MPI_Datatype datatype, 
@@ -210,7 +220,7 @@ smpi_coll_tuned_bcast_scatter_rdb_allgather (
                                          ((char *)tmp_buf + recv_offset),
                                          (nbytes-recv_offset < 0 ? 0 : nbytes-recv_offset), 
                                          MPI_BYTE, dst, COLL_TAG_BCAST, comm, &status);
-            recv_size=smpi_mpi_get_count(&status, MPI_BYTE);
+            recv_size=Status::get_count(&status, MPI_BYTE);
             curr_size += recv_size;
         }
 
@@ -293,7 +303,7 @@ smpi_coll_tuned_bcast_scatter_rdb_allgather (
                                              comm, &status);
                     /* nprocs_completed is also equal to the no. of processes
                        whose data we don't have */
-                    recv_size=smpi_mpi_get_count(&status, MPI_BYTE);
+                    recv_size=Status::get_count(&status, MPI_BYTE);
                     curr_size += recv_size;
                     /* printf("Rank %d, recv from %d, offset %d, size %d\n", rank, dst, offset, recv_size);
                        fflush(stdout);*/
@@ -314,18 +324,19 @@ smpi_coll_tuned_bcast_scatter_rdb_allgather (
       xbt_die("we didn't receive enough !");
     }
 
-    if (!is_contig || !is_homogeneous)
-    {
-        if (rank != root)
-        {
-            position = 0;
-            mpi_errno = MPI_Unpack(tmp_buf, nbytes, &position, buffer,
-                                         count, datatype, comm);
-            if (mpi_errno) xbt_die("error when unpacking %d", mpi_errno);
-        }
+    if (not is_contig || not is_homogeneous) {
+      if (rank != root) {
+        position  = 0;
+        mpi_errno = MPI_Unpack(tmp_buf, nbytes, &position, buffer, count, datatype, comm);
+        if (mpi_errno)
+          xbt_die("error when unpacking %d", mpi_errno);
+      }
     }
 
 fn_exit:
 /*    xbt_free(tmp_buf);*/
     return mpi_errno;
 }
+
+}
+}