* the number of datatype to the original count (original_count)
*
* Note that for non-commutative operations we cannot save memory copy
* the number of datatype to the original count (original_count)
*
* Note that for non-commutative operations we cannot save memory copy
* to keep the optimized loop happy.
*/
int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int original_count,
* to keep the optimized loop happy.
*/
int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int original_count,
num_segments = (original_count + count_by_segment - 1) / count_by_segment;
segment_increment = count_by_segment * extent;
num_segments = (original_count + count_by_segment - 1) / count_by_segment;
segment_increment = count_by_segment * extent;
- sendtmpbuf = (char*) sendbuf;
- if( sendbuf == MPI_IN_PLACE ) {
- sendtmpbuf = (char *)recvbuf;
+ sendtmpbuf = (char*) sendbuf;
+ if( sendbuf == MPI_IN_PLACE ) {
+ sendtmpbuf = (char *)recvbuf;
- XBT_DEBUG( "coll:tuned:reduce_generic count %d, msg size %ld, segsize %ld, max_requests %d", original_count, (unsigned long)(num_segments * segment_increment), (unsigned long)segment_increment, max_outstanding_reqs);
+ XBT_DEBUG("coll:tuned:reduce_generic count %d, msg size %lu, segsize %lu, max_requests %d", original_count,
+ (unsigned long)(num_segments * segment_increment), (unsigned long)segment_increment,
+ max_outstanding_reqs);
(if needed) */
if( tree->tree_nextsize > 0 ) {
ptrdiff_t true_extent, real_segment_size;
true_extent=datatype->get_extent();
(if needed) */
if( tree->tree_nextsize > 0 ) {
ptrdiff_t true_extent, real_segment_size;
true_extent=datatype->get_extent();
protect the recv buffer on non-root nodes */
accumbuf = (char*)recvbuf;
if( (NULL == accumbuf) || (root != rank) ) {
/* Allocate temporary accumulator buffer. */
accumbuf_free = (char*)smpi_get_tmp_sendbuffer(true_extent +
(original_count - 1) * extent);
protect the recv buffer on non-root nodes */
accumbuf = (char*)recvbuf;
if( (NULL == accumbuf) || (root != rank) ) {
/* Allocate temporary accumulator buffer. */
accumbuf_free = (char*)smpi_get_tmp_sendbuffer(true_extent +
(original_count - 1) * extent);
/* If this is a non-commutative operation we must copy
sendbuf to the accumbuf, in order to simplfy the loops */
/* If this is a non-commutative operation we must copy
sendbuf to the accumbuf, in order to simplfy the loops */
- if ( (op!=MPI_OP_NULL && !op->is_commutative())) {
- Datatype::copy(
- (char*)sendtmpbuf, original_count, datatype,
- (char*)accumbuf, original_count, datatype);
+ if ((op != MPI_OP_NULL && not op->is_commutative())) {
+ Datatype::copy((char*)sendtmpbuf, original_count, datatype, (char*)accumbuf, original_count, datatype);
}
/* Allocate two buffers for incoming segments */
real_segment_size = true_extent + (count_by_segment - 1) * extent;
inbuf_free[0] = (char*) smpi_get_tmp_recvbuffer(real_segment_size);
}
/* Allocate two buffers for incoming segments */
real_segment_size = true_extent + (count_by_segment - 1) * extent;
inbuf_free[0] = (char*) smpi_get_tmp_recvbuffer(real_segment_size);
}
inbuf[0] = inbuf_free[0] - lower_bound;
/* if there is chance to overlap communication -
allocate second buffer */
if( (num_segments > 1) || (tree->tree_nextsize > 1) ) {
inbuf_free[1] = (char*) smpi_get_tmp_recvbuffer(real_segment_size);
}
inbuf[0] = inbuf_free[0] - lower_bound;
/* if there is chance to overlap communication -
allocate second buffer */
if( (num_segments > 1) || (tree->tree_nextsize > 1) ) {
inbuf_free[1] = (char*) smpi_get_tmp_recvbuffer(real_segment_size);
- /* for the first step (1st child per segment) and
- * commutative operations we might be able to irecv
- * directly into the accumulate buffer so that we can
- * reduce(op) this with our sendbuf in one step as
- * ompi_op_reduce only has two buffer pointers,
+ /* for the first step (1st child per segment) and
+ * commutative operations we might be able to irecv
+ * directly into the accumulate buffer so that we can
+ * reduce(op) this with our sendbuf in one step as
+ * ompi_op_reduce only has two buffer pointers,
* we are root and are USING MPI_IN_PLACE this is wrong!
*/
if( (op==MPI_OP_NULL || op->is_commutative()) &&
* we are root and are USING MPI_IN_PLACE this is wrong!
*/
if( (op==MPI_OP_NULL || op->is_commutative()) &&
}
reqs[inbi]=Request::irecv(local_recvbuf, recvcount, datatype,
}
reqs[inbi]=Request::irecv(local_recvbuf, recvcount, datatype,
- /* our first operation is to combine our own [sendbuf] data
- * with the data we recvd from down stream (but only
- * the operation is commutative and if we are not root and
+ /* our first operation is to combine our own [sendbuf] data
+ * with the data we recvd from down stream (but only
+ * the operation is commutative and if we are not root and
!((MPI_IN_PLACE == sendbuf) && (rank == tree->tree_root)) ) {
local_op_buffer = sendtmpbuf + segindex * segment_increment;
}
}
/* apply operation */
!((MPI_IN_PLACE == sendbuf) && (rank == tree->tree_root)) ) {
local_op_buffer = sendtmpbuf + segindex * segment_increment;
}
}
/* apply operation */
- if(op!=MPI_OP_NULL) op->apply( local_op_buffer,
- accumbuf + segindex * segment_increment,
+ if(op!=MPI_OP_NULL) op->apply( local_op_buffer,
+ accumbuf + segindex * segment_increment,
- if(op!=MPI_OP_NULL) op->apply( local_op_buffer, accumulator, &prevcount,
+ if(op!=MPI_OP_NULL) op->apply( local_op_buffer, accumulator, &prevcount,
* pass to the next process unless you are the root.
*/
if (rank != tree->tree_root) {
/* send combined/accumulated data to parent */
* pass to the next process unless you are the root.
*/
if (rank != tree->tree_root) {
/* send combined/accumulated data to parent */
- Request::send( accumulator, prevcount,
- datatype, tree->tree_prev,
+ Request::send( accumulator, prevcount,
+ datatype, tree->tree_prev,
the number of segments we have two options:
- send all segments using blocking send to the parent, or
the number of segments we have two options:
- send all segments using blocking send to the parent, or
- TODO/POSSIBLE IMPROVEMENT: If there is a way to determine the eager size
- for the current communication, synchronization should be used only
+ TODO/POSSIBLE IMPROVEMENT: If there is a way to determine the eager size
+ for the current communication, synchronization should be used only
when the message/segment size is smaller than the eager size.
*/
else {
/* If the number of segments is less than a maximum number of oustanding
when the message/segment size is smaller than the eager size.
*/
else {
/* If the number of segments is less than a maximum number of oustanding
segindex = 0;
while ( original_count > 0) {
if (original_count < count_by_segment) {
count_by_segment = original_count;
}
segindex = 0;
while ( original_count > 0) {
if (original_count < count_by_segment) {
count_by_segment = original_count;
}
segindex * segment_increment,
count_by_segment, datatype,
segindex * segment_increment,
count_by_segment, datatype,
- MPI_Request* sreq = NULL;
-
- sreq = (MPI_Request*) calloc( max_outstanding_reqs,
- sizeof(MPI_Request ) );
+ MPI_Request* sreq = new (std::nothrow) MPI_Request[max_outstanding_reqs];
sreq[segindex]=Request::isend((char*)sendbuf +
segindex * segment_increment,
count_by_segment, datatype,
sreq[segindex]=Request::isend((char*)sendbuf +
segindex * segment_increment,
count_by_segment, datatype,
- sreq[creq]=Request::isend((char*)sendbuf +
- segindex * segment_increment,
- count_by_segment, datatype,
- tree->tree_prev,
+ sreq[creq]=Request::isend((char*)sendbuf +
+ segindex * segment_increment,
+ count_by_segment, datatype,
+ tree->tree_prev,
rank, __FILE__, line, ret );
if( inbuf_free[0] != NULL ) free(inbuf_free[0]);
if( inbuf_free[1] != NULL ) free(inbuf_free[1]);
rank, __FILE__, line, ret );
if( inbuf_free[0] != NULL ) free(inbuf_free[0]);
if( inbuf_free[1] != NULL ) free(inbuf_free[1]);
int Coll_reduce_ompi_chain::reduce( void *sendbuf, void *recvbuf, int count,
int Coll_reduce_ompi_chain::reduce( void *sendbuf, void *recvbuf, int count,
- XBT_DEBUG("coll:tuned:reduce_intra_chain rank %d fo %d ss %5d", comm->rank(), fanout, segsize);
+ XBT_DEBUG("coll:tuned:reduce_intra_chain rank %d fo %d ss %5u", comm->rank(), fanout, segsize);
- return smpi_coll_tuned_ompi_reduce_generic( sendbuf, recvbuf, count, datatype,
+ return smpi_coll_tuned_ompi_reduce_generic( sendbuf, recvbuf, count, datatype,
- ompi_coll_tuned_topo_build_chain(fanout, comm, root),
+ ompi_coll_tuned_topo_build_chain(fanout, comm, root),
const double b4 = 1.6761;
typelng= datatype->size();
int communicator_size = comm->size();
const double b4 = 1.6761;
typelng= datatype->size();
int communicator_size = comm->size();
- XBT_DEBUG("coll:tuned:reduce_intra_pipeline rank %d ss %5d",
- comm->rank(), segsize);
+ XBT_DEBUG("coll:tuned:reduce_intra_pipeline rank %d ss %5u", comm->rank(), segsize);
- return smpi_coll_tuned_ompi_reduce_generic( sendbuf, recvbuf, count, datatype,
+ return smpi_coll_tuned_ompi_reduce_generic( sendbuf, recvbuf, count, datatype,
- ompi_coll_tuned_topo_build_chain( 1, comm, root),
+ ompi_coll_tuned_topo_build_chain( 1, comm, root),
- XBT_DEBUG("coll:tuned:reduce_intra_binary rank %d ss %5d",
- comm->rank(), segsize);
+ XBT_DEBUG("coll:tuned:reduce_intra_binary rank %d ss %5u", comm->rank(), segsize);
- return smpi_coll_tuned_ompi_reduce_generic( sendbuf, recvbuf, count, datatype,
- op, root, comm,
- ompi_coll_tuned_topo_build_tree(2, comm, root),
+ return smpi_coll_tuned_ompi_reduce_generic( sendbuf, recvbuf, count, datatype,
+ op, root, comm,
+ ompi_coll_tuned_topo_build_tree(2, comm, root),
if (((communicator_size < 8) && (message_size < 20480)) ||
(message_size < 2048) || (count <= 1)) {
/* Binomial_0K */
segsize = 0;
} else if (communicator_size > (a1 * message_size + b1)) {
if (((communicator_size < 8) && (message_size < 20480)) ||
(message_size < 2048) || (count <= 1)) {
/* Binomial_0K */
segsize = 0;
} else if (communicator_size > (a1 * message_size + b1)) {
- XBT_DEBUG("coll:tuned:reduce_intra_binomial rank %d ss %5d",
- comm->rank(), segsize);
+ XBT_DEBUG("coll:tuned:reduce_intra_binomial rank %d ss %5u", comm->rank(), segsize);
- return smpi_coll_tuned_ompi_reduce_generic( sendbuf, recvbuf, count, datatype,
- op, root, comm,
- ompi_coll_tuned_topo_build_in_order_bmtree(comm, root),
+ return smpi_coll_tuned_ompi_reduce_generic( sendbuf, recvbuf, count, datatype,
+ op, root, comm,
+ ompi_coll_tuned_topo_build_in_order_bmtree(comm, root),
* Function: Logarithmic reduce operation for non-commutative operations.
* Acecpts: same as MPI_Reduce()
* Returns: MPI_SUCCESS or error code
*/
int Coll_reduce_ompi_in_order_binary::reduce( void *sendbuf, void *recvbuf,
* Function: Logarithmic reduce operation for non-commutative operations.
* Acecpts: same as MPI_Reduce()
* Returns: MPI_SUCCESS or error code
*/
int Coll_reduce_ompi_in_order_binary::reduce( void *sendbuf, void *recvbuf,
/* An in-order binary tree must use root (size-1) to preserve the order of
operations. Thus, if root is not rank (size - 1), then we must handle
/* An in-order binary tree must use root (size-1) to preserve the order of
operations. Thus, if root is not rank (size - 1), then we must handle
/* Use generic reduce with in-order binary tree topology and io_root */
ret = smpi_coll_tuned_ompi_reduce_generic( use_this_sendbuf, use_this_recvbuf, count, datatype,
/* Use generic reduce with in-order binary tree topology and io_root */
ret = smpi_coll_tuned_ompi_reduce_generic( use_this_sendbuf, use_this_recvbuf, count, datatype,
} else if (io_root == rank) {
/* Send result from use_this_recvbuf to root */
Request::send(use_this_recvbuf, count, datatype, root,
} else if (io_root == rank) {
/* Send result from use_this_recvbuf to root */
Request::send(use_this_recvbuf, count, datatype, root,
/*
* Linear functions are copied from the BASIC coll module
* they do not segment the message and are simple implementations
/*
* Linear functions are copied from the BASIC coll module
* they do not segment the message and are simple implementations
- * but for some small number of nodes and/or small data sizes they
- * are just as fast as tuned/tree based segmenting operations
+ * but for some small number of nodes and/or small data sizes they
+ * are just as fast as tuned/tree based segmenting operations
* and as such may be selected by the decision functions
* These are copied into this module due to the way we select modules
* in V1. i.e. in V2 we will handle this differently and so will not
* and as such may be selected by the decision functions
* These are copied into this module due to the way we select modules
* in V1. i.e. in V2 we will handle this differently and so will not