Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move collective algorithms to separate folders
[simgrid.git] / src / smpi / colls / smpi_mpich_selector.cpp
index 7e6aa52..f29b79c 100644 (file)
@@ -63,7 +63,7 @@ int smpi_coll_tuned_allreduce_mpich(void *sbuf, void *rbuf, int count,
     int comm_size = comm->size();
     const size_t large_message = 2048; //MPIR_PARAM_ALLREDUCE_SHORT_MSG_SIZE
 
-    dsize = smpi_datatype_size(dtype);
+    dsize = dtype->size();
     block_dsize = dsize * count;
 
 
@@ -72,7 +72,7 @@ int smpi_coll_tuned_allreduce_mpich(void *sbuf, void *rbuf, int count,
     while (pof2 <= comm_size) pof2 <<= 1;
     pof2 >>=1;
 
-    if (block_dsize > large_message && count >= pof2 && smpi_op_is_commute(op)) {
+    if (block_dsize > large_message && count >= pof2 && (op==MPI_OP_NULL || op->is_commutative())) {
       //for long messages
        return (smpi_coll_tuned_allreduce_rab_rdb (sbuf, rbuf, 
                                                                    count, dtype,
@@ -158,7 +158,7 @@ int smpi_coll_tuned_alltoall_mpich( void *sbuf, int scount,
 //   and sends to (rank+i). 
 
 
-    dsize = smpi_datatype_size(sdtype);
+    dsize = sdtype->size();
     block_dsize = dsize * scount;
 
     if ((block_dsize < short_size) && (communicator_size >= 8)) {
@@ -260,7 +260,7 @@ int smpi_coll_tuned_bcast_mpich(void *buff, int count,
     communicator_size = comm->size();
 
     /* else we need data size for decision function */
-    dsize = smpi_datatype_size(datatype);
+    dsize = datatype->size();
     message_size = dsize * (unsigned long)count;   /* needed for decision */
 
     /* Handle messages of small and intermediate size, and 
@@ -351,7 +351,7 @@ int smpi_coll_tuned_reduce_mpich( void *sendbuf, void *recvbuf,
     communicator_size = comm->size();
 
     /* need data size for decision function */
-    dsize=smpi_datatype_size(datatype);
+    dsize=datatype->size();
     message_size = dsize * count;   /* needed for decision */
 
     int pof2 = 1;
@@ -359,7 +359,7 @@ int smpi_coll_tuned_reduce_mpich( void *sendbuf, void *recvbuf,
     pof2 >>= 1;
 
 
-    if ((count < pof2) || (message_size < 2048) || !smpi_op_is_commute(op)) {
+    if ((count < pof2) || (message_size < 2048) || (op!=MPI_OP_NULL && !op->is_commutative())) {
         return smpi_coll_tuned_reduce_binomial (sendbuf, recvbuf, count, datatype, op, root, comm); 
     }
         return smpi_coll_tuned_reduce_scatter_gather(sendbuf, recvbuf, count, datatype, op, root, comm/*, module,
@@ -437,11 +437,11 @@ int smpi_coll_tuned_reduce_scatter_mpich( void *sbuf, void *rbuf,
         total_message_size += rcounts[i];
     }
 
-    if( smpi_op_is_commute(op) &&  total_message_size > 524288) { 
+    if( (op==MPI_OP_NULL || op->is_commutative()) &&  total_message_size > 524288) { 
         return smpi_coll_tuned_reduce_scatter_mpich_pair (sbuf, rbuf, rcounts, 
                                                                     dtype, op, 
                                                                     comm); 
-    }else if (!smpi_op_is_commute(op)) {
+    }else if ((op!=MPI_OP_NULL && !op->is_commutative())) {
         int is_block_regular = 1;
         for (i = 0; i < (comm_size - 1); ++i) {
             if (rcounts[i] != rcounts[i+1]) {
@@ -524,7 +524,7 @@ int smpi_coll_tuned_allgather_mpich(void *sbuf, int scount,
     communicator_size = comm->size();
 
     /* Determine complete data size */
-    dsize=smpi_datatype_size(sdtype);
+    dsize=sdtype->size();
     total_dsize = dsize * scount * communicator_size;   
    
     for (pow2_size  = 1; pow2_size < communicator_size; pow2_size <<=1); 
@@ -690,7 +690,7 @@ int smpi_coll_tuned_scatter_mpich(void *sbuf, int scount,
                                             )
 {
   if(comm->rank()!=root){
-      sbuf=xbt_malloc(rcount*smpi_datatype_get_extent(rdtype));
+      sbuf=xbt_malloc(rcount*rdtype->get_extent());
       scount=rcount;
       sdtype=rdtype;
   }