fix for reduce and allreduce for an unsymmetric case
This commit was SVN r7802.
Этот коммит содержится в:
родитель
76d1a808e9
Коммит
3a7efaf4d9
@ -171,8 +171,8 @@ mca_coll_hierarch_comm_query(struct ompi_communicator_t *comm, int *priority,
|
||||
|
||||
size = ompi_comm_size(comm);
|
||||
|
||||
if ( size == 1 ) {
|
||||
/* No need for hierarchical collectives . */
|
||||
if ( size < 3 ) {
|
||||
/* No need for hierarchical collectives for 1 or 2 procs. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -550,10 +550,18 @@ struct ompi_communicator_t* mca_coll_hierarch_get_llcomm (int root,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (llead->offset >= offset ) {
|
||||
if (llead->offset == offset ) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
else if () {
|
||||
/* the offset of root = maxoffset of this color and
|
||||
* the offset on llead is larger then offset of root.
|
||||
* then we can also use this llead structure
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( !found ) {
|
||||
|
@ -61,35 +61,38 @@ int mca_coll_hierarch_allreduce_intra(void *sbuf, void *rbuf, int count,
|
||||
llcomm = mca_coll_hierarch_get_llcomm ( root, data, &llroot, &lroot);
|
||||
|
||||
if ( MPI_COMM_NULL != lcomm ) {
|
||||
lrank = ompi_comm_rank (lcomm);
|
||||
if ( lrank == lroot ) {
|
||||
ompi_ddt_get_extent(dtype, &lb, &extent);
|
||||
ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent);
|
||||
|
||||
tbuf = malloc(true_extent + (count - 1) * extent);
|
||||
if (NULL == tbuf) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
tmpbuf = tbuf - lb;
|
||||
}
|
||||
|
||||
if ( MPI_IN_PLACE != sbuf ) {
|
||||
ret = lcomm->c_coll.coll_reduce (sbuf, tmpbuf, count, dtype,
|
||||
op, lroot, lcomm);
|
||||
}
|
||||
else {
|
||||
ret = lcomm->c_coll.coll_reduce (rbuf, tmpbuf, count, dtype,
|
||||
op, lroot, lcomm);
|
||||
}
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
goto exit;
|
||||
}
|
||||
ompi_ddt_get_extent(dtype, &lb, &extent);
|
||||
ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent);
|
||||
|
||||
tbuf = malloc(true_extent + (count - 1) * extent);
|
||||
if (NULL == tbuf) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
tmpbuf = tbuf - lb;
|
||||
|
||||
if ( MPI_IN_PLACE != sbuf ) {
|
||||
ret = lcomm->c_coll.coll_reduce (sbuf, tmpbuf, count, dtype,
|
||||
op, lroot, lcomm);
|
||||
}
|
||||
else {
|
||||
ret = lcomm->c_coll.coll_reduce (rbuf, tmpbuf, count, dtype,
|
||||
op, lroot, lcomm);
|
||||
}
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ( MPI_UNDEFINED != llroot ) {
|
||||
if ( MPI_COMM_NULL != lcomm ) {
|
||||
ret = llcomm->c_coll.coll_allreduce (tmpbuf, rbuf, count, dtype,
|
||||
op, llcomm);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ret = llcomm->c_coll.coll_allreduce (sbuf, rbuf, count, dtype,
|
||||
op, llcomm);
|
||||
}
|
||||
}
|
||||
|
||||
if ( MPI_COMM_NULL != lcomm ) {
|
||||
ret = lcomm->c_coll.coll_bcast(rbuf, count, dtype, lroot, lcomm );
|
||||
|
@ -60,34 +60,38 @@ int mca_coll_hierarch_reduce_intra(void *sbuf, void *rbuf, int count,
|
||||
llcomm = mca_coll_hierarch_get_llcomm ( root, data, &llroot, &lroot);
|
||||
|
||||
if ( MPI_COMM_NULL != lcomm ) {
|
||||
lrank = ompi_comm_rank (lcomm);
|
||||
if ( lrank == lroot ) {
|
||||
ompi_ddt_get_extent(dtype, &lb, &extent);
|
||||
ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent);
|
||||
ompi_ddt_get_extent(dtype, &lb, &extent);
|
||||
ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent);
|
||||
|
||||
tbuf = malloc(true_extent + (count - 1) * extent);
|
||||
if (NULL == tbuf) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
tmpbuf = tbuf - lb;
|
||||
|
||||
|
||||
tbuf = malloc(true_extent + (count - 1) * extent);
|
||||
if (NULL == tbuf) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
tmpbuf = tbuf - lb;
|
||||
}
|
||||
|
||||
if ( MPI_IN_PLACE != sbuf ) {
|
||||
ret = lcomm->c_coll.coll_reduce (sbuf, tmpbuf, count, dtype,
|
||||
op, lroot, lcomm);
|
||||
}
|
||||
else {
|
||||
ret = lcomm->c_coll.coll_reduce (rbuf, tmpbuf, count, dtype,
|
||||
op, lroot, lcomm);
|
||||
}
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
goto exit;
|
||||
}
|
||||
if ( MPI_IN_PLACE != sbuf ) {
|
||||
ret = lcomm->c_coll.coll_reduce (sbuf, tmpbuf, count, dtype,
|
||||
op, lroot, lcomm);
|
||||
}
|
||||
else {
|
||||
ret = lcomm->c_coll.coll_reduce (rbuf, tmpbuf, count, dtype,
|
||||
op, lroot, lcomm);
|
||||
}
|
||||
if ( OMPI_SUCCESS != ret ) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ( MPI_UNDEFINED != llroot ) {
|
||||
if ( MPI_COMM_NULL != lcomm ) {
|
||||
ret = llcomm->c_coll.coll_reduce (tmpbuf, rbuf, count, dtype,
|
||||
op, llroot, llcomm);
|
||||
}
|
||||
else {
|
||||
ret = llcomm->c_coll.coll_reduce (sbuf, rbuf, count, dtype,
|
||||
op, llroot, llcomm);
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user