Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
(painfully) constify colls.
[simgrid.git] / src / smpi / colls / reduce_scatter / reduce_scatter-mpich.cpp
index 5134808..a3a1c79 100644 (file)
@@ -24,7 +24,7 @@ static inline int MPIU_Mirror_permutation(unsigned int x, int bits)
 namespace simgrid{
 namespace smpi{
 
-int Coll_reduce_scatter_mpich_pair::reduce_scatter(void *sendbuf, void *recvbuf, int recvcounts[],
+int Coll_reduce_scatter_mpich_pair::reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[],
                               MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
     int   rank, comm_size, i;
@@ -93,11 +93,11 @@ int Coll_reduce_scatter_mpich_pair::reduce_scatter(void *sendbuf, void *recvbuf,
             if (is_commutative || (src < rank)) {
                 if (sendbuf != MPI_IN_PLACE) {
                   if (op != MPI_OP_NULL)
-                    op->apply(tmp_recvbuf, recvbuf, &recvcounts[rank], datatype);
+                    op->apply(tmp_recvbuf, recvbuf, &((const_cast<int*>(recvcounts))[rank]), datatype);
                 }
                 else {
                   if (op != MPI_OP_NULL)
-                    op->apply(tmp_recvbuf, ((char*)recvbuf + disps[rank] * extent), &recvcounts[rank], datatype);
+                    op->apply(tmp_recvbuf, ((char*)recvbuf + disps[rank] * extent), &((const_cast<int*>(recvcounts))[rank]), datatype);
                   /* we can't store the result at the beginning of
                      recvbuf right here because there is useful data
                      there that other process/processes need. at the
@@ -108,7 +108,7 @@ int Coll_reduce_scatter_mpich_pair::reduce_scatter(void *sendbuf, void *recvbuf,
             else {
                 if (sendbuf != MPI_IN_PLACE) {
                   if (op != MPI_OP_NULL)
-                    op->apply(recvbuf, tmp_recvbuf, &recvcounts[rank], datatype);
+                    op->apply(recvbuf, tmp_recvbuf, &((const_cast<int*>(recvcounts))[rank]), datatype);
                   /* copy result back into recvbuf */
                   mpi_errno =
                       Datatype::copy(tmp_recvbuf, recvcounts[rank], datatype, recvbuf, recvcounts[rank], datatype);
@@ -117,7 +117,7 @@ int Coll_reduce_scatter_mpich_pair::reduce_scatter(void *sendbuf, void *recvbuf,
                 }
                 else {
                   if (op != MPI_OP_NULL)
-                    op->apply(((char*)recvbuf + disps[rank] * extent), tmp_recvbuf, &recvcounts[rank], datatype);
+                    op->apply(((char*)recvbuf + disps[rank] * extent), tmp_recvbuf, &((const_cast<int*>(recvcounts))[rank]), datatype);
                   /* copy result back into recvbuf */
                   mpi_errno = Datatype::copy(tmp_recvbuf, recvcounts[rank], datatype,
                                              ((char*)recvbuf + disps[rank] * extent), recvcounts[rank], datatype);
@@ -145,7 +145,7 @@ int Coll_reduce_scatter_mpich_pair::reduce_scatter(void *sendbuf, void *recvbuf,
 }
 
 
-int Coll_reduce_scatter_mpich_noncomm::reduce_scatter(void *sendbuf, void *recvbuf, int recvcounts[],
+int Coll_reduce_scatter_mpich_noncomm::reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[],
                               MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -262,7 +262,7 @@ int Coll_reduce_scatter_mpich_noncomm::reduce_scatter(void *sendbuf, void *recvb
 
 
 
-int Coll_reduce_scatter_mpich_rdb::reduce_scatter(void *sendbuf, void *recvbuf, int recvcounts[],
+int Coll_reduce_scatter_mpich_rdb::reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[],
                               MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
     int   rank, comm_size, i;