Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
(painfully) constify colls.
[simgrid.git] / src / smpi / colls / smpi_openmpi_selector.cpp
index ead3440..3d8134d 100644 (file)
@@ -1,6 +1,6 @@
 /* selector for collective algorithms based on openmpi's default coll_tuned_decision_fixed selector */
 
-/* Copyright (c) 2009-2010, 2013-2017. The SimGrid Team.
+/* Copyright (c) 2009-2019. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -11,7 +11,7 @@
 namespace simgrid{
 namespace smpi{
 
-int Coll_allreduce_ompi::allreduce(void *sbuf, void *rbuf, int count,
+int Coll_allreduce_ompi::allreduce(const void *sbuf, void *rbuf, int count,
                         MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
 {
     size_t dsize, block_dsize;
@@ -55,7 +55,7 @@ int Coll_allreduce_ompi::allreduce(void *sbuf, void *rbuf, int count,
 
 
 
-int Coll_alltoall_ompi::alltoall( void *sbuf, int scount,
+int Coll_alltoall_ompi::alltoall(const void *sbuf, int scount,
                                              MPI_Datatype sdtype,
                                              void* rbuf, int rcount,
                                              MPI_Datatype rdtype,
@@ -88,15 +88,15 @@ int Coll_alltoall_ompi::alltoall( void *sbuf, int scount,
                                                     comm);
 }
 
-int Coll_alltoallv_ompi::alltoallv(void *sbuf, int *scounts, int *sdisps,
+int Coll_alltoallv_ompi::alltoallv(const void *sbuf, const int *scounts, const int *sdisps,
                                               MPI_Datatype sdtype,
-                                              void *rbuf, int *rcounts, int *rdisps,
+                                              void *rbuf, const int *rcounts, const int *rdisps,
                                               MPI_Datatype rdtype,
                                               MPI_Comm  comm
                                               )
 {
     /* For starters, just keep the original algorithm. */
-    return Coll_alltoallv_ompi_basic_linear::alltoallv(sbuf, scounts, sdisps, sdtype,
+    return Coll_alltoallv_ring::alltoallv(sbuf, scounts, sdisps, sdtype,
                                                         rbuf, rcounts, rdisps,rdtype,
                                                         comm);
 }
@@ -224,7 +224,7 @@ int Coll_bcast_ompi::bcast(void *buff, int count,
 #endif  /* 0 */
 }
 
-int Coll_reduce_ompi::reduce( void *sendbuf, void *recvbuf,
+int Coll_reduce_ompi::reduce(const void *sendbuf, void *recvbuf,
                                             int count, MPI_Datatype  datatype,
                                             MPI_Op   op, int root,
                                             MPI_Comm   comm
@@ -327,8 +327,8 @@ int Coll_reduce_ompi::reduce( void *sendbuf, void *recvbuf,
 #endif  /* 0 */
 }
 
-int Coll_reduce_scatter_ompi::reduce_scatter( void *sbuf, void *rbuf,
-                                                    int *rcounts,
+int Coll_reduce_scatter_ompi::reduce_scatter(const void *sbuf, void *rbuf,
+                                                    const int *rcounts,
                                                     MPI_Datatype dtype,
                                                     MPI_Op  op,
                                                     MPI_Comm  comm
@@ -381,7 +381,7 @@ int Coll_reduce_scatter_ompi::reduce_scatter( void *sbuf, void *rbuf,
 
 }
 
-int Coll_allgather_ompi::allgather(void *sbuf, int scount,
+int Coll_allgather_ompi::allgather(const void *sbuf, int scount,
                                               MPI_Datatype sdtype,
                                               void* rbuf, int rcount,
                                               MPI_Datatype rdtype,
@@ -461,10 +461,10 @@ int Coll_allgather_ompi::allgather(void *sbuf, int scount,
 #endif  /* defined(USE_MPICH2_DECISION) */
 }
 
-int Coll_allgatherv_ompi::allgatherv(void *sbuf, int scount,
+int Coll_allgatherv_ompi::allgatherv(const void *sbuf, int scount,
                                                MPI_Datatype sdtype,
-                                               void* rbuf, int *rcounts,
-                                               int *rdispls,
+                                               void* rbuf, const int *rcounts,
+                                               const int *rdispls,
                                                MPI_Datatype rdtype,
                                                MPI_Comm  comm
                                                )
@@ -491,10 +491,7 @@ int Coll_allgatherv_ompi::allgatherv(void *sbuf, int scount,
 
     /* Decision based on allgather decision.   */
     if (total_dsize < 50000) {
-/*        return Coll_allgatherv_intra_bruck::allgatherv(sbuf, scount, sdtype,
-                                                      rbuf, rcounts, rdispls, rdtype,
-                                                      comm, module);*/
-    return Coll_allgatherv_ring::allgatherv(sbuf, scount, sdtype,
+        return Coll_allgatherv_ompi_bruck::allgatherv(sbuf, scount, sdtype,
                                                       rbuf, rcounts, rdispls, rdtype,
                                                       comm);
 
@@ -511,7 +508,7 @@ int Coll_allgatherv_ompi::allgatherv(void *sbuf, int scount,
     }
 }
 
-int Coll_gather_ompi::gather(void *sbuf, int scount,
+int Coll_gather_ompi::gather(const void *sbuf, int scount,
                                            MPI_Datatype sdtype,
                                            void* rbuf, int rcount,
                                            MPI_Datatype rdtype,
@@ -571,7 +568,7 @@ int Coll_gather_ompi::gather(void *sbuf, int scount,
 }
 
 
-int Coll_scatter_ompi::scatter(void *sbuf, int scount,
+int Coll_scatter_ompi::scatter(const void *sbuf, int scount,
                                             MPI_Datatype sdtype,
                                             void* rbuf, int rcount,
                                             MPI_Datatype rdtype,
@@ -607,7 +604,7 @@ int Coll_scatter_ompi::scatter(void *sbuf, int scount,
             rbuf, rcount, rdtype,
             root, comm);
         if(rank!=root){
-            xbt_free(sbuf);
+            xbt_free(const_cast<void*>(sbuf));
         }
         return ret;
     }