1
1

the temporary buffer is not needed for the MPI_IN_PLACE cases if the underlying Gather is implemented correctly

This commit was SVN r13740.
Этот коммит содержится в:
Li-Ta Lo 2007-02-21 20:39:56 +00:00
родитель 36156f39c2
Коммит 049921a5ec
2 изменённых файлов: 10 добавлений и 46 удалений

Просмотреть файл

@ -49,24 +49,14 @@ mca_coll_basic_allgather_intra(void *sbuf, int scount,
/* Handle MPI_IN_PLACE (see explanantion in reduce.c for how to
allocate temp buffer) -- note that rank 0 can use IN_PLACE
natively, and we'll be ok (actually saves a little bit of
copying around) */
natively, and we can just alias the right position in rbuf
as sbuf and avoid using a temporary buffer if gather is
implemented correctly */
if (MPI_IN_PLACE == sbuf && 0 != ompi_comm_rank(comm)) {
ompi_ddt_get_extent(rdtype, &lb, &extent);
ompi_ddt_get_true_extent(rdtype, &true_lb, &true_extent);
rbuf_original = (char*)rbuf;
sbuf = ((char*) rbuf) + (ompi_comm_rank(comm) * extent * rcount);
sdtype = rdtype;
scount = rcount;
inplace_temp = (char*)malloc((true_extent + (rcount - 1) * extent) *
ompi_comm_size(comm));
if (NULL == inplace_temp) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
rbuf = inplace_temp - lb;
}
/* Gather and broadcast. */
@ -78,14 +68,6 @@ mca_coll_basic_allgather_intra(void *sbuf, int scount,
rdtype, 0, comm);
}
/* If we've got a temp buffer, copy back out */
if (MPI_SUCCESS == err && NULL != inplace_temp) {
ompi_ddt_copy_content_same_ddt(rdtype, rcount * ompi_comm_size(comm),
rbuf_original, (char*)rbuf);
free(inplace_temp);
}
/* All done */
return err;

Просмотреть файл

@ -702,24 +702,14 @@ ompi_coll_tuned_allgather_intra_basic_linear(void *sbuf, int scount,
/* Handle MPI_IN_PLACE (see explanantion in reduce.c for how to
allocate temp buffer) -- note that rank 0 can use IN_PLACE
natively, and we'll be ok (actually saves a little bit of
copying around) */
natively, and we can just alias the right position in rbuf
as sbuf and avoid using a temporary buffer if gather is
implemented correctly */
if (MPI_IN_PLACE == sbuf && 0 != ompi_comm_rank(comm)) {
ompi_ddt_get_extent(rdtype, &lb, &extent);
ompi_ddt_get_true_extent(rdtype, &true_lb, &true_extent);
rbuf_original = (char*)rbuf;
sbuf = ((char*) rbuf) + (ompi_comm_rank(comm) * extent * rcount);
sdtype = rdtype;
scount = rcount;
inplace_temp = (char*)malloc((true_extent + (rcount - 1) * extent) *
ompi_comm_size(comm));
if (NULL == inplace_temp) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
rbuf = inplace_temp - lb;
}
/* Gather and broadcast. */
@ -731,14 +721,6 @@ ompi_coll_tuned_allgather_intra_basic_linear(void *sbuf, int scount,
rdtype, 0, comm);
}
/* If we've got a temp buffer, copy back out */
if (MPI_SUCCESS == err && NULL != inplace_temp) {
ompi_ddt_copy_content_same_ddt(rdtype, rcount * ompi_comm_size(comm),
rbuf_original, (char*)rbuf);
free(inplace_temp);
}
/* All done */
return err;