Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
replace star_reduction by our own reduction
authorAugustin Degomme <degomme@idpann.imag.fr>
Tue, 9 Apr 2013 16:19:00 +0000 (18:19 +0200)
committerAugustin Degomme <degomme@idpann.imag.fr>
Tue, 9 Apr 2013 16:19:00 +0000 (18:19 +0200)
19 files changed:
buildtools/Cmake/DefinePackages.cmake
src/smpi/colls/allreduce-NTS.c
src/smpi/colls/allreduce-lr.c
src/smpi/colls/allreduce-rab-rsag.c
src/smpi/colls/allreduce-rab1.c
src/smpi/colls/allreduce-rab2.c
src/smpi/colls/allreduce-rdb.c
src/smpi/colls/allreduce-smp-binomial.c
src/smpi/colls/allreduce-smp-rdb.c
src/smpi/colls/allreduce-smp-rsag-lr.c
src/smpi/colls/allreduce-smp-rsag-rab.c
src/smpi/colls/allreduce-smp-rsag.c
src/smpi/colls/colls_private.h
src/smpi/colls/reduce-NTSL.c
src/smpi/colls/reduce-arrival-pattern-aware.c
src/smpi/colls/reduce-binomial.c
src/smpi/colls/reduce-flat-tree.c
src/smpi/colls/reduce-scatter-gather.c
src/smpi/colls/star-reduction.c [deleted file]

index 1bc2ee7..2d6ba83 100644 (file)
@@ -175,7 +175,6 @@ set(SMPI_SRC
   src/smpi/colls/reduce-flat-tree.c
   src/smpi/colls/reduce-NTSL.c
   src/smpi/colls/reduce-scatter-gather.c
   src/smpi/colls/reduce-flat-tree.c
   src/smpi/colls/reduce-NTSL.c
   src/smpi/colls/reduce-scatter-gather.c
-  src/smpi/colls/star-reduction.c
   )
 
 if(SMPI_F2C)
   )
 
 if(SMPI_F2C)
index c7e145d..32ca68b 100644 (file)
@@ -69,7 +69,7 @@ smpi_coll_tuned_allreduce_NTS(void *sbuf, void *rbuf, int rcount,
                  ((rank + size - 1) % size), tag + i, comm, &status);
 
     // compute result to rbuf+recv_offset
                  ((rank + size - 1) % size), tag + i, comm, &status);
 
     // compute result to rbuf+recv_offset
-    star_reduction(op, (char *)sbuf + recv_offset, (char *)rbuf + recv_offset, &count, &dtype);
+    smpi_op_apply(op, (char *)sbuf + recv_offset, (char *)rbuf + recv_offset, &count, &dtype);
   }
 
   // all-gather
   }
 
   // all-gather
index a7f7336..d526629 100644 (file)
@@ -75,7 +75,7 @@ smpi_coll_tuned_allreduce_lr(void *sbuf, void *rbuf, int rcount,
                  ((rank + size - 1) % size), tag + i, comm, &status);
 
     // compute result to rbuf+recv_offset
                  ((rank + size - 1) % size), tag + i, comm, &status);
 
     // compute result to rbuf+recv_offset
-    star_reduction(op, (char *) sbuf + recv_offset, (char *) rbuf + recv_offset,
+    smpi_op_apply(op, (char *) sbuf + recv_offset, (char *) rbuf + recv_offset,
                    &count, &dtype);
   }
 
                    &count, &dtype);
   }
 
index 268ac8b..f136020 100644 (file)
@@ -52,7 +52,7 @@ int smpi_coll_tuned_allreduce_rab_rsag(void *sbuff, void *rbuff, int count,
       // do the reduction on received data. since the
       // ordering is right, it doesn't matter whether
       // the operation is commutative or not.
       // do the reduction on received data. since the
       // ordering is right, it doesn't matter whether
       // the operation is commutative or not.
-      star_reduction(op, tmp_buf, rbuff, &count, &dtype);
+      smpi_op_apply(op, tmp_buf, rbuff, &count, &dtype);
 
       // change the rank 
       newrank = rank / 2;
 
       // change the rank 
       newrank = rank / 2;
@@ -121,7 +121,7 @@ int smpi_coll_tuned_allreduce_rab_rsag(void *sbuff, void *rbuff, int count,
 
       // This algorithm is used only for predefined ops
       // and predefined ops are always commutative.
 
       // This algorithm is used only for predefined ops
       // and predefined ops are always commutative.
-      star_reduction(op, (char *) tmp_buf + disps[recv_idx] * extent,
+      smpi_op_apply(op, (char *) tmp_buf + disps[recv_idx] * extent,
                      (char *) rbuff + disps[recv_idx] * extent,
                      &recv_cnt, &dtype);
 
                      (char *) rbuff + disps[recv_idx] * extent,
                      &recv_cnt, &dtype);
 
index e57ac2f..ae72f74 100644 (file)
@@ -50,7 +50,7 @@ int smpi_coll_tuned_allreduce_rab1(void *sbuff, void *rbuff,
       smpi_mpi_sendrecv((char *) recv + send_idx * extent, send_cnt, dtype, dst, tag,
                    tmp_buf, recv_cnt, dtype, dst, tag, comm, &status);
 
       smpi_mpi_sendrecv((char *) recv + send_idx * extent, send_cnt, dtype, dst, tag,
                    tmp_buf, recv_cnt, dtype, dst, tag, comm, &status);
 
-      star_reduction(op, tmp_buf, (char *) recv + recv_idx * extent, &recv_cnt,
+      smpi_op_apply(op, tmp_buf, (char *) recv + recv_idx * extent, &recv_cnt,
                      &dtype);
 
       // update send_idx for next iteration 
                      &dtype);
 
       // update send_idx for next iteration 
@@ -84,7 +84,7 @@ int smpi_coll_tuned_allreduce_rab1(void *sbuff, void *rbuff,
       smpi_mpi_sendrecv((char *) rbuff + send_idx * extent, send_cnt, dtype, dst,
                    tag, tmp_buf, recv_cnt, dtype, dst, tag, comm, &status);
 
       smpi_mpi_sendrecv((char *) rbuff + send_idx * extent, send_cnt, dtype, dst,
                    tag, tmp_buf, recv_cnt, dtype, dst, tag, comm, &status);
 
-      star_reduction(op, tmp_buf, (char *) rbuff + recv_idx * extent, &recv_cnt,
+      smpi_op_apply(op, tmp_buf, (char *) rbuff + recv_idx * extent, &recv_cnt,
                      &dtype);
 
       // update send_idx for next iteration 
                      &dtype);
 
       // update send_idx for next iteration 
index ca1dee9..982933c 100644 (file)
@@ -45,7 +45,7 @@ int smpi_coll_tuned_allreduce_rab2(void *sbuff, void *rbuff,
     memcpy(tmp, recv, nbytes);
 
     for (i = 1, s_offset = nbytes; i < nprocs; i++, s_offset = i * nbytes)
     memcpy(tmp, recv, nbytes);
 
     for (i = 1, s_offset = nbytes; i < nprocs; i++, s_offset = i * nbytes)
-      star_reduction(op, (char *) recv + s_offset, tmp, &send_size, &dtype);
+      smpi_op_apply(op, (char *) recv + s_offset, tmp, &send_size, &dtype);
 
     mpi_coll_allgather_fun(tmp, send_size, dtype, recv, send_size, dtype, comm);
     memcpy(rbuff, recv, count * s_extent);
 
     mpi_coll_allgather_fun(tmp, send_size, dtype, recv, send_size, dtype, comm);
     memcpy(rbuff, recv, count * s_extent);
@@ -66,7 +66,7 @@ int smpi_coll_tuned_allreduce_rab2(void *sbuff, void *rbuff,
     memcpy((char *) rbuff + r_offset, recv, nbytes);
 
     for (i = 1, s_offset = nbytes; i < nprocs; i++, s_offset = i * nbytes)
     memcpy((char *) rbuff + r_offset, recv, nbytes);
 
     for (i = 1, s_offset = nbytes; i < nprocs; i++, s_offset = i * nbytes)
-      star_reduction(op, (char *) recv + s_offset, (char *) rbuff + r_offset,
+      smpi_op_apply(op, (char *) recv + s_offset, (char *) rbuff + r_offset,
                      &send_size, &dtype);
 
     mpi_coll_allgather_fun((char *) rbuff + r_offset, send_size, dtype, rbuff, send_size,
                      &send_size, &dtype);
 
     mpi_coll_allgather_fun((char *) rbuff + r_offset, send_size, dtype, rbuff, send_size,
index bb9c82e..f1fe9f6 100644 (file)
@@ -60,7 +60,7 @@ int smpi_coll_tuned_allreduce_rdb(void *sbuff, void *rbuff, int count,
       // do the reduction on received data. since the
       // ordering is right, it doesn't matter whether
       // the operation is commutative or not.
       // do the reduction on received data. since the
       // ordering is right, it doesn't matter whether
       // the operation is commutative or not.
-      star_reduction(op, tmp_buf, rbuff, &count, &dtype);
+      smpi_op_apply(op, tmp_buf, rbuff, &count, &dtype);
 
       // change the rank 
       newrank = rank / 2;
 
       // change the rank 
       newrank = rank / 2;
@@ -98,10 +98,10 @@ int smpi_coll_tuned_allreduce_rdb(void *sbuff, void *rbuff, int count,
       // we assume it is commuttive op
       //      if (op -> op_commute  || (dst < rank))
       if ((dst < rank)) {
       // we assume it is commuttive op
       //      if (op -> op_commute  || (dst < rank))
       if ((dst < rank)) {
-        star_reduction(op, tmp_buf, rbuff, &count, &dtype);
+        smpi_op_apply(op, tmp_buf, rbuff, &count, &dtype);
       } else                    // op is noncommutative and the order is not right
       {
       } else                    // op is noncommutative and the order is not right
       {
-        star_reduction(op, rbuff, tmp_buf, &count, &dtype);
+        smpi_op_apply(op, rbuff, tmp_buf, &count, &dtype);
 
         // copy result back into recvbuf
         smpi_mpi_sendrecv(tmp_buf, count, dtype, rank, tag, rbuff, count,
 
         // copy result back into recvbuf
         smpi_mpi_sendrecv(tmp_buf, count, dtype, rank, tag, rbuff, count,
index 49bf0ab..cf68dfb 100644 (file)
@@ -73,7 +73,7 @@ int smpi_coll_tuned_allreduce_smp_binomial(void *send_buf, void *recv_buf,
       src = (inter_rank * num_core) + (intra_rank | mask);
       if (src < comm_size) {
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
       src = (inter_rank * num_core) + (intra_rank | mask);
       if (src < comm_size) {
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
-        star_reduction(op, tmp_buf, recv_buf, &count, &dtype);
+        smpi_op_apply(op, tmp_buf, recv_buf, &count, &dtype);
       }
     } else {
       dst = (inter_rank * num_core) + (intra_rank & (~mask));
       }
     } else {
       dst = (inter_rank * num_core) + (intra_rank & (~mask));
@@ -92,7 +92,7 @@ int smpi_coll_tuned_allreduce_smp_binomial(void *send_buf, void *recv_buf,
         src = (inter_rank | mask) * num_core;
         if (src < comm_size) {
           smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
         src = (inter_rank | mask) * num_core;
         if (src < comm_size) {
           smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
-          star_reduction(op, tmp_buf, recv_buf, &count, &dtype);
+          smpi_op_apply(op, tmp_buf, recv_buf, &count, &dtype);
         }
       } else {
         dst = (inter_rank & (~mask)) * num_core;
         }
       } else {
         dst = (inter_rank & (~mask)) * num_core;
index ee60379..d208584 100644 (file)
@@ -71,7 +71,7 @@ int smpi_coll_tuned_allreduce_smp_rdb(void *send_buf, void *recv_buf, int count,
       src = (inter_rank * num_core) + (intra_rank | mask);
       if (src < comm_size) {
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
       src = (inter_rank * num_core) + (intra_rank | mask);
       if (src < comm_size) {
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
-        star_reduction(op, tmp_buf, recv_buf, &count, &dtype);
+        smpi_op_apply(op, tmp_buf, recv_buf, &count, &dtype);
       }
     } else {
       dst = (inter_rank * num_core) + (intra_rank & (~mask));
       }
     } else {
       dst = (inter_rank * num_core) + (intra_rank & (~mask));
@@ -108,7 +108,7 @@ int smpi_coll_tuned_allreduce_smp_rdb(void *send_buf, void *recv_buf, int count,
       } else {
         src = rank - num_core;
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
       } else {
         src = rank - num_core;
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
-        star_reduction(op, tmp_buf, recv_buf, &count, &dtype);
+        smpi_op_apply(op, tmp_buf, recv_buf, &count, &dtype);
         newrank = inter_rank / 2;
       }
     } else {
         newrank = inter_rank / 2;
       }
     } else {
@@ -134,7 +134,7 @@ int smpi_coll_tuned_allreduce_smp_rdb(void *send_buf, void *recv_buf, int count,
         /* exchange data in rdb manner */
         smpi_mpi_sendrecv(recv_buf, count, dtype, dst, tag, tmp_buf, count, dtype,
                      dst, tag, comm, &status);
         /* exchange data in rdb manner */
         smpi_mpi_sendrecv(recv_buf, count, dtype, dst, tag, tmp_buf, count, dtype,
                      dst, tag, comm, &status);
-        star_reduction(op, tmp_buf, recv_buf, &count, &dtype);
+        smpi_op_apply(op, tmp_buf, recv_buf, &count, &dtype);
         mask <<= 1;
       }
     }
         mask <<= 1;
       }
     }
index dba0a06..fd49327 100644 (file)
@@ -66,7 +66,7 @@ int smpi_coll_tuned_allreduce_smp_rsag_lr(void *send_buf, void *recv_buf,
       //      if (src < ((inter_rank + 1) * num_core)) {
       if (src < comm_size) {
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
       //      if (src < ((inter_rank + 1) * num_core)) {
       if (src < comm_size) {
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
-        star_reduction(op, tmp_buf, recv_buf, &count, &dtype);
+        smpi_op_apply(op, tmp_buf, recv_buf, &count, &dtype);
         //printf("Node %d recv from node %d when mask is %d\n", rank, src, mask);
       }
     } else {
         //printf("Node %d recv from node %d when mask is %d\n", rank, src, mask);
       }
     } else {
@@ -124,7 +124,7 @@ int smpi_coll_tuned_allreduce_smp_rsag_lr(void *send_buf, void *recv_buf,
                    &status);
 
       // result is in rbuf
                    &status);
 
       // result is in rbuf
-      star_reduction(op, tmp_buf, (char *) recv_buf + recv_offset, &recv_count,
+      smpi_op_apply(op, tmp_buf, (char *) recv_buf + recv_offset, &recv_count,
                      &dtype);
     }
 
                      &dtype);
     }
 
index af6871a..c98b78d 100644 (file)
@@ -53,7 +53,7 @@ int smpi_coll_tuned_allreduce_smp_rsag_rab(void *sbuf, void *rbuf, int count,
       //      if (src < ((inter_rank + 1) * num_core)) {
       if (src < comm_size) {
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
       //      if (src < ((inter_rank + 1) * num_core)) {
       if (src < comm_size) {
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
-        star_reduction(op, tmp_buf, rbuf, &count, &dtype);
+        smpi_op_apply(op, tmp_buf, rbuf, &count, &dtype);
         //printf("Node %d recv from node %d when mask is %d\n", rank, src, mask);
       }
     } else {
         //printf("Node %d recv from node %d when mask is %d\n", rank, src, mask);
       }
     } else {
@@ -112,7 +112,7 @@ int smpi_coll_tuned_allreduce_smp_rsag_rab(void *sbuf, void *rbuf, int count,
                    tmp_buf, curr_count, dtype, (dst * num_core), tag,
                    comm, &status);
 
                    tmp_buf, curr_count, dtype, (dst * num_core), tag,
                    comm, &status);
 
-      star_reduction(op, tmp_buf, (char *)rbuf + recv_offset, &curr_count, &dtype);
+      smpi_op_apply(op, tmp_buf, (char *)rbuf + recv_offset, &curr_count, &dtype);
 
       mask *= 2;
       curr_count /= 2;
 
       mask *= 2;
       curr_count /= 2;
index 53d1a7f..24ccaa0 100644 (file)
@@ -65,7 +65,7 @@ int smpi_coll_tuned_allreduce_smp_rsag(void *send_buf, void *recv_buf,
       //      if (src < ((inter_rank + 1) * num_core)) {
       if (src < comm_size) {
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
       //      if (src < ((inter_rank + 1) * num_core)) {
       if (src < comm_size) {
         smpi_mpi_recv(tmp_buf, count, dtype, src, tag, comm, &status);
-        star_reduction(op, tmp_buf, recv_buf, &count, &dtype);
+        smpi_op_apply(op, tmp_buf, recv_buf, &count, &dtype);
         //printf("Node %d recv from node %d when mask is %d\n", rank, src, mask);
       }
     } else {
         //printf("Node %d recv from node %d when mask is %d\n", rank, src, mask);
       }
     } else {
@@ -105,7 +105,7 @@ int smpi_coll_tuned_allreduce_smp_rsag(void *send_buf, void *recv_buf,
                    &status);
 
       // result is in rbuf
                    &status);
 
       // result is in rbuf
-      star_reduction(op, tmp_buf, (char *) recv_buf + recv_offset, &seg_count,
+      smpi_op_apply(op, tmp_buf, (char *) recv_buf + recv_offset, &seg_count,
                      &dtype);
     }
 
                      &dtype);
     }
 
index 5686a71..66a2114 100644 (file)
@@ -4,6 +4,5 @@
 #include "colls.h"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_colls);
 #include "colls.h"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_colls);
-void star_reduction(MPI_Op op, void *src, void *target, int *count, MPI_Datatype *dtype);
 
 #endif
 
 #endif
index a462533..5a3b887 100644 (file)
@@ -66,12 +66,12 @@ int smpi_coll_tuned_reduce_NTSL(void *buf, void *rbuf, int count,
   if (count <= segment) {
     if (rank == root) {
       smpi_mpi_recv(tmp_buf, count, datatype, from, tag, comm, &status);
   if (count <= segment) {
     if (rank == root) {
       smpi_mpi_recv(tmp_buf, count, datatype, from, tag, comm, &status);
-      star_reduction(op, tmp_buf, rbuf, &count, &datatype);
+      smpi_op_apply(op, tmp_buf, rbuf, &count, &datatype);
     } else if (rank == ((root - 1 + size) % size)) {
       smpi_mpi_send(rbuf, count, datatype, to, tag, comm);
     } else {
       smpi_mpi_recv(tmp_buf, count, datatype, from, tag, comm, &status);
     } else if (rank == ((root - 1 + size) % size)) {
       smpi_mpi_send(rbuf, count, datatype, to, tag, comm);
     } else {
       smpi_mpi_recv(tmp_buf, count, datatype, from, tag, comm, &status);
-      star_reduction(op, tmp_buf, rbuf, &count, &datatype);
+      smpi_op_apply(op, tmp_buf, rbuf, &count, &datatype);
       smpi_mpi_send(rbuf, count, datatype, to, tag, comm);
     }
     free(tmp_buf);
       smpi_mpi_send(rbuf, count, datatype, to, tag, comm);
     }
     free(tmp_buf);
@@ -97,7 +97,7 @@ int smpi_coll_tuned_reduce_NTSL(void *buf, void *rbuf, int count,
       }
       for (i = 0; i < pipe_length; i++) {
         smpi_mpi_wait(&recv_request_array[i], &status);
       }
       for (i = 0; i < pipe_length; i++) {
         smpi_mpi_wait(&recv_request_array[i], &status);
-        star_reduction(op, tmp_buf + (i * increment), (char *)rbuf + (i * increment),
+        smpi_op_apply(op, tmp_buf + (i * increment), (char *)rbuf + (i * increment),
                        &segment, &datatype);
       }
     }
                        &segment, &datatype);
       }
     }
@@ -119,7 +119,7 @@ int smpi_coll_tuned_reduce_NTSL(void *buf, void *rbuf, int count,
       }
       for (i = 0; i < pipe_length; i++) {
         smpi_mpi_wait(&recv_request_array[i], &status);
       }
       for (i = 0; i < pipe_length; i++) {
         smpi_mpi_wait(&recv_request_array[i], &status);
-        star_reduction(op, tmp_buf + (i * increment), (char *)rbuf + (i * increment),
+        smpi_op_apply(op, tmp_buf + (i * increment), (char *)rbuf + (i * increment),
                        &segment, &datatype);
         send_request_array[i] = smpi_mpi_isend((char *) rbuf + (i * increment), segment, datatype, to,
                   (tag + i), comm);
                        &segment, &datatype);
         send_request_array[i] = smpi_mpi_isend((char *) rbuf + (i * increment), segment, datatype, to,
                   (tag + i), comm);
index 7c921af..1e25250 100644 (file)
@@ -129,7 +129,7 @@ int smpi_coll_tuned_reduce_arrival_pattern_aware(void *buf, void *rbuf,
 
           smpi_mpi_send(header_buf, HEADER_SIZE, MPI_INT, to, tag, comm);
           smpi_mpi_recv(tmp_buf, count, datatype, from, tag, comm, &status);
 
           smpi_mpi_send(header_buf, HEADER_SIZE, MPI_INT, to, tag, comm);
           smpi_mpi_recv(tmp_buf, count, datatype, from, tag, comm, &status);
-          star_reduction(op, tmp_buf, rbuf, &count, &datatype);
+          smpi_op_apply(op, tmp_buf, rbuf, &count, &datatype);
         }
       }                         /* while loop */
     }
         }
       }                         /* while loop */
     }
@@ -181,7 +181,7 @@ int smpi_coll_tuned_reduce_arrival_pattern_aware(void *buf, void *rbuf,
         from = header_buf[myordering - 1];
         smpi_mpi_recv(tmp_buf, count, datatype, header_buf[myordering - 1], tag,
                  comm, &status);
         from = header_buf[myordering - 1];
         smpi_mpi_recv(tmp_buf, count, datatype, header_buf[myordering - 1], tag,
                  comm, &status);
-        star_reduction(op, tmp_buf, rbuf, &count, &datatype);
+        smpi_op_apply(op, tmp_buf, rbuf, &count, &datatype);
         smpi_mpi_send(rbuf, count, datatype, to, tag, comm);
       }
     }                           /* non-root */
         smpi_mpi_send(rbuf, count, datatype, to, tag, comm);
       }
     }                           /* non-root */
@@ -257,7 +257,7 @@ int smpi_coll_tuned_reduce_arrival_pattern_aware(void *buf, void *rbuf,
           for (i = 0; i < pipe_length; i++) {
             smpi_mpi_recv(tmp_buf + (i * increment), segment, datatype, from, tag,
                      comm, &status);
           for (i = 0; i < pipe_length; i++) {
             smpi_mpi_recv(tmp_buf + (i * increment), segment, datatype, from, tag,
                      comm, &status);
-            star_reduction(op, tmp_buf + (i * increment),
+            smpi_op_apply(op, tmp_buf + (i * increment),
                            (char *)rbuf + (i * increment), &segment, &datatype);
           }
         }
                            (char *)rbuf + (i * increment), &segment, &datatype);
           }
         }
@@ -311,7 +311,7 @@ int smpi_coll_tuned_reduce_arrival_pattern_aware(void *buf, void *rbuf,
         }
         for (i = 0; i < pipe_length; i++) {
           smpi_mpi_wait(&recv_request_array[i], MPI_STATUS_IGNORE);
         }
         for (i = 0; i < pipe_length; i++) {
           smpi_mpi_wait(&recv_request_array[i], MPI_STATUS_IGNORE);
-          star_reduction(op, tmp_buf + (i * increment), (char *)rbuf + (i * increment),
+          smpi_op_apply(op, tmp_buf + (i * increment), (char *)rbuf + (i * increment),
                          &segment, &datatype);
           send_request_array[i]=smpi_mpi_isend((char *)rbuf + (i * increment), segment, datatype, to, tag, comm);
         }
                          &segment, &datatype);
           send_request_array[i]=smpi_mpi_isend((char *)rbuf + (i * increment), segment, datatype, to, tag, comm);
         }
index 76fef91..63de8fe 100644 (file)
@@ -35,7 +35,7 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
       if (source < comm_size) {
         source = (source + root) % comm_size;
         smpi_mpi_recv(tmp_buf, count, datatype, source, tag, comm, &status);
       if (source < comm_size) {
         source = (source + root) % comm_size;
         smpi_mpi_recv(tmp_buf, count, datatype, source, tag, comm, &status);
-        star_reduction(op, tmp_buf, recvbuf, &count, &datatype);
+        smpi_op_apply(op, tmp_buf, recvbuf, &count, &datatype);
       }
     } else {
       dst = ((relrank & (~mask)) + root) % comm_size;
       }
     } else {
       dst = ((relrank & (~mask)) + root) % comm_size;
index 7d178e1..f304e78 100644 (file)
@@ -50,7 +50,7 @@ smpi_coll_tuned_reduce_flat_tree(void *sbuf, void *rbuf, int count,
     }
 
     /* Call reduction function. */
     }
 
     /* Call reduction function. */
-    star_reduction(op, inbuf, rbuf, &count, &dtype);
+    smpi_op_apply(op, inbuf, rbuf, &count, &dtype);
 
   }
 
 
   }
 
index 4dbcbf1..fd1c5dc 100644 (file)
@@ -56,7 +56,7 @@ int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf,
         newrank = -1;
       } else {
         smpi_mpi_recv(tmp_buf, count, datatype, rank + 1, tag, comm, &status);
         newrank = -1;
       } else {
         smpi_mpi_recv(tmp_buf, count, datatype, rank + 1, tag, comm, &status);
-        star_reduction(op, tmp_buf, recv_ptr, &new_count, &datatype);
+        smpi_op_apply(op, tmp_buf, recv_ptr, &new_count, &datatype);
         newrank = rank / 2;
       }
     } else                      /* rank >= 2*rem */
         newrank = rank / 2;
       }
     } else                      /* rank >= 2*rem */
@@ -109,7 +109,7 @@ int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf,
         /* tmp_buf contains data received in this step.
            recvbuf contains data accumulated so far */
 
         /* tmp_buf contains data received in this step.
            recvbuf contains data accumulated so far */
 
-        star_reduction(op, (char *) tmp_buf + disps[recv_idx] * extent,
+        smpi_op_apply(op, (char *) tmp_buf + disps[recv_idx] * extent,
                        (char *) recv_ptr + disps[recv_idx] * extent,
                        &recv_cnt, &datatype);
 
                        (char *) recv_ptr + disps[recv_idx] * extent,
                        &recv_cnt, &datatype);
 
@@ -233,7 +233,7 @@ int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf,
 
       else {
         smpi_mpi_recv(tmp_buf, count, datatype, rank + 1, tag, comm, &status);
 
       else {
         smpi_mpi_recv(tmp_buf, count, datatype, rank + 1, tag, comm, &status);
-        star_reduction(op, tmp_buf, recvbuf, &count, &datatype);
+        smpi_op_apply(op, tmp_buf, recvbuf, &count, &datatype);
         newrank = rank / 2;
       }
     } else                      /* rank >= 2*rem */
         newrank = rank / 2;
       }
     } else                      /* rank >= 2*rem */
@@ -286,7 +286,7 @@ int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf,
         /* tmp_buf contains data received in this step.
            recvbuf contains data accumulated so far */
 
         /* tmp_buf contains data received in this step.
            recvbuf contains data accumulated so far */
 
-        star_reduction(op, (char *) tmp_buf + disps[recv_idx] * extent,
+        smpi_op_apply(op, (char *) tmp_buf + disps[recv_idx] * extent,
                        (char *) recvbuf + disps[recv_idx] * extent,
                        &recv_cnt, &datatype);
 
                        (char *) recvbuf + disps[recv_idx] * extent,
                        &recv_cnt, &datatype);
 
diff --git a/src/smpi/colls/star-reduction.c b/src/smpi/colls/star-reduction.c
deleted file mode 100644 (file)
index 2ca8149..0000000
+++ /dev/null
@@ -1,334 +0,0 @@
-#include "colls_private.h"
-
-/*
- * created by Pitch Patarasuk
- * Modified by Xin Yuan
- * 
- * realize a subset of MPI predefine operators:
- * MPI_LAND, MPI_BAND: C integer, Fortran integer, Byte
- * MPI_LOR, MPI_BOR: C integer, Fortran integer, Byte
- * MPI_LXOR, MPI_BXOR: C integer, Fortran integer, Byte
- * MPI_SUM, MPI_PROD: C integer, Fortran integer, Floating point
- * MPI_MIN, MPI_MAX: C integer, Fortran integer, Floating point, Byte
- *
- * Types not implemented: MPI_LONG_DOUBLE, MPI_LOGICAL, MPI_COMPLEX
- */
-
-#ifndef STAR_REDUCTION
-#define STAR_REDUCTION
-
-
-#ifdef MPICH2_REDUCTION
-extern MPI_User_function * MPIR_Op_table[];
-#elif defined MVAPICH_REDUCETION
-extern void *MPIR_ToPointer();
-struct MPIR_OP
-{
-  MPI_User_function *op;
-  int               commute;
-  int               permanent;
-};
-#endif
-
-static void star_generic_reduction(MPI_Op op, void *src, void *target, int *count, MPI_Datatype *dtype){
-  int i;
-  if ((op == MPI_BOR) || (op == MPI_LOR)) {
-    if ((*dtype == MPI_BYTE) || (*dtype == MPI_CHAR)) {
-      for (i=0;i<*count;i++) {
-          ((char *)target)[i] |= ((char *)src)[i];
-      }
-    }
-    else if ((*dtype == MPI_INT) 
-            || (*dtype == MPI_LONG) 
-            || (*dtype == MPI_INT) 
-             || (*dtype == MPI_UNSIGNED) 
-            || (*dtype == MPI_UNSIGNED_LONG)) {
-      for (i=0;i<*count;i++) {
-          ((int *)target)[i] |= ((int *)src)[i];
-      }
-    } 
-    else if ((*dtype == MPI_SHORT) 
-            || (*dtype == MPI_UNSIGNED_SHORT)) { 
-      for (i=0;i<*count;i++) {
-          ((short *)target)[i] |= ((short *)src)[i];
-      }
-    } 
-    else {
-      printf("reduction operation not supported\n");
-    }
-  }
-
-  else if ((op == MPI_BAND) || (op == MPI_LAND)) {
-    if ((*dtype == MPI_BYTE) || (*dtype == MPI_CHAR)) {
-      for (i=0;i<*count;i++) {
-          ((char *)target)[i] &= ((char *)src)[i];
-      }
-    }
-    else if ((*dtype == MPI_INT) 
-            || (*dtype == MPI_LONG) 
-             || (*dtype == MPI_UNSIGNED) 
-            || (*dtype == MPI_UNSIGNED_LONG)) {
-      for (i=0;i<*count;i++) {
-          ((int *)target)[i] &= ((int *)src)[i];
-      }
-    } 
-    else if ((*dtype == MPI_SHORT) 
-            || (*dtype == MPI_UNSIGNED_SHORT)) { 
-      for (i=0;i<*count;i++) {
-          ((short *)target)[i] &= ((short *)src)[i];
-      }
-    } 
-    else {
-      printf("reduction operation not supported\n");
-    }
-  }
-
-
-  else if ((op == MPI_BXOR) || (op == MPI_LXOR)) {
-    if ((*dtype == MPI_BYTE) || (*dtype == MPI_CHAR)) {
-      for (i=0;i<*count;i++) {
-          ((char *)target)[i] ^= ((char *)src)[i];
-      }
-    }
-    else if ((*dtype == MPI_INT) 
-            || (*dtype == MPI_LONG) 
-             || (*dtype == MPI_UNSIGNED) 
-            || (*dtype == MPI_UNSIGNED_LONG)) {
-      for (i=0;i<*count;i++) {
-          ((int *)target)[i] ^= ((int *)src)[i];
-      }
-    } 
-    else if ((*dtype == MPI_SHORT) 
-            || (*dtype == MPI_UNSIGNED_SHORT)) { 
-      for (i=0;i<*count;i++) {
-          ((short *)target)[i] ^= ((short *)src)[i];
-      }
-    } 
-    else {
-      printf("reduction operation not supported\n");
-    }
-  }
-
-  else if (op == MPI_MAX) {
-    if ((*dtype == MPI_INT) 
-       || (*dtype == MPI_LONG)) { 
-      for (i=0;i<*count;i++) {
-        if (((int *)src)[i] > ((int *)target)[i]) {
-          ((int *)target)[i] = ((int *)src)[i];
-        }
-      }
-    }
-    else if ((*dtype == MPI_UNSIGNED) 
-       || (*dtype == MPI_UNSIGNED_LONG)) {
-      for (i=0;i<*count;i++) {
-        if (((unsigned int *)src)[i] > ((unsigned int *)target)[i]) {
-          ((unsigned int *)target)[i] = ((unsigned int *)src)[i];
-        }
-      }
-    }
-    else if (*dtype == MPI_SHORT) {
-      for (i=0;i<*count;i++) {
-        if (((short *)src)[i] > ((short *)target)[i]) {
-          ((short *)target)[i] = ((short *)src)[i];
-        }
-      }
-    }
-    else if (*dtype == MPI_UNSIGNED_SHORT) { 
-      for (i=0;i<*count;i++) {
-        if (((unsigned short *)src)[i] > ((unsigned short *)target)[i]) {
-          ((unsigned short *)target)[i] = ((unsigned short *)src)[i];
-        }
-      }
-    }
-
-    else if (*dtype == MPI_DOUBLE) {
-      for (i=0;i<*count;i++) {
-        if (((double *)src)[i] > ((double *)target)[i]) {
-          ((double *)target)[i] = ((double *)src)[i];
-        }
-      }
-    }
-    else if (*dtype == MPI_FLOAT) {
-      for (i=0;i<*count;i++) {
-        if (((float *)src)[i] > ((float *)target)[i]) {
-          ((float *)target)[i] = ((float *)src)[i];
-        }
-      }
-    }
-    else if ((*dtype == MPI_CHAR) || (*dtype == MPI_BYTE)) {
-      for (i=0;i<*count;i++) {
-        if (((char *)src)[i] > ((char *)target)[i]) {
-          ((char *)target)[i] = ((char *)src)[i];
-        }
-      }
-    }
-    else {
-      printf("reduction operation not supported\n");
-    }
-  }
-
-
-
-  else if (op == MPI_MIN) {
-    if ((*dtype == MPI_INT) 
-       || (*dtype == MPI_LONG)) { 
-      for (i=0;i<*count;i++) {
-        if (((int *)src)[i] < ((int *)target)[i]) {
-          ((int *)target)[i] = ((int *)src)[i];
-        }
-      }
-    }
-    else if ((*dtype == MPI_UNSIGNED) 
-       || (*dtype == MPI_UNSIGNED_LONG)) {
-      for (i=0;i<*count;i++) {
-        if (((unsigned int *)src)[i] < ((unsigned int *)target)[i]) {
-          ((unsigned int *)target)[i] = ((unsigned int *)src)[i];
-        }
-      }
-    }
-    else if (*dtype == MPI_SHORT) {
-      for (i=0;i<*count;i++) {
-        if (((short *)src)[i] < ((short *)target)[i]) {
-          ((short *)target)[i] = ((short *)src)[i];
-        }
-      }
-    }
-    else if (*dtype == MPI_UNSIGNED_SHORT) { 
-      for (i=0;i<*count;i++) {
-        if (((unsigned short *)src)[i] < ((unsigned short *)target)[i]) {
-          ((unsigned short *)target)[i] = ((unsigned short *)src)[i];
-        }
-      }
-    }
-
-    else if (*dtype == MPI_DOUBLE) {
-      for (i=0;i<*count;i++) {
-        if (((double *)src)[i] < ((double *)target)[i]) {
-          ((double *)target)[i] = ((double *)src)[i];
-        }
-      }
-    }
-    else if (*dtype == MPI_FLOAT) {
-      for (i=0;i<*count;i++) {
-        if (((float *)src)[i] < ((float *)target)[i]) {
-          ((float *)target)[i] = ((float *)src)[i];
-        }
-      }
-    }
-    else if ((*dtype == MPI_CHAR) || (*dtype == MPI_BYTE)) {
-      for (i=0;i<*count;i++) {
-        if (((char *)src)[i] < ((char *)target)[i]) {
-          ((char *)target)[i] = ((char *)src)[i];
-        }
-      }
-    }
-    else {
-      printf("reduction operation not supported\n");
-    }
-  }
-
-
-  else if (op == MPI_SUM) {
-    if ((*dtype == MPI_INT) 
-       || (*dtype == MPI_LONG)) { 
-      for (i=0;i<*count;i++) {
-          ((int *)target)[i] += ((int *)src)[i];
-      }
-    }
-    else if ((*dtype == MPI_UNSIGNED) 
-       || (*dtype == MPI_UNSIGNED_LONG)) {
-      for (i=0;i<*count;i++) {
-          ((unsigned int *)target)[i] += ((unsigned int *)src)[i];
-      }
-    }
-    else if (*dtype == MPI_SHORT) {
-      for (i=0;i<*count;i++) {
-          ((short *)target)[i] += ((short *)src)[i];
-      }
-    }
-    else if (*dtype == MPI_UNSIGNED_SHORT) { 
-      for (i=0;i<*count;i++) {
-          ((unsigned short *)target)[i] += ((unsigned short *)src)[i];
-      }
-    }
-
-    else if (*dtype == MPI_DOUBLE) {
-      for (i=0;i<*count;i++) {
-          ((double *)target)[i] += ((double *)src)[i];
-      }
-    }
-    else if (*dtype == MPI_FLOAT) {
-      for (i=0;i<*count;i++) {
-          ((float *)target)[i] += ((float *)src)[i];
-      }
-    }
-    else {
-      printf("reduction operation not supported\n");
-    }
-  }
-
-  else if (op == MPI_PROD) {
-    if ((*dtype == MPI_INT) 
-       || (*dtype == MPI_LONG)) { 
-      for (i=0;i<*count;i++) {
-          ((int *)target)[i] *= ((int *)src)[i];
-      }
-    }
-    else if ((*dtype == MPI_UNSIGNED) 
-       || (*dtype == MPI_UNSIGNED_LONG)) {
-      for (i=0;i<*count;i++) {
-          ((unsigned int *)target)[i] *= ((unsigned int *)src)[i];
-      }
-    }
-    else if (*dtype == MPI_SHORT) {
-      for (i=0;i<*count;i++) {
-          ((short *)target)[i] *= ((short *)src)[i];
-      }
-    }
-    else if (*dtype == MPI_UNSIGNED_SHORT) { 
-      for (i=0;i<*count;i++) {
-          ((unsigned short *)target)[i] *= ((unsigned short *)src)[i];
-      }
-    }
-
-    else if (*dtype == MPI_DOUBLE) {
-      for (i=0;i<*count;i++) {
-          ((double *)target)[i] *= ((double *)src)[i];
-      }
-    }
-    else if (*dtype == MPI_FLOAT) {
-      for (i=0;i<*count;i++) {
-          ((float *)target)[i] *= ((float *)src)[i];
-      }
-    }
-    else {
-      printf("reduction operation not supported\n");
-    }
-  }
-
-  else {
-    printf("reduction operation not supported\n");
-  }
-}
-
-void star_reduction(MPI_Op op, void *src, void *target, int *count, MPI_Datatype *dtype){
-
-#ifdef MPICH2_REDUCTION
-MPI_User_function * uop = MPIR_Op_table[op % 16 - 1];
- return (*uop) (src,target,count,dtype);
-#elif defined MVAPICH_REDUCTION
-MPI_User_function *uop;
-struct MPIR_OP *op_ptr;
-op_ptr = MPIR_ToPointer(op);
-uop  = op_ptr->op;
- return (*uop) (src,target,count,dtype);
-#else
- return star_generic_reduction(op,src,target,count,dtype);
-#endif
-
-
-
-}
-
-
-#endif