- Correct to use the right offsets
- Copy back to the right location in the non-rank-0-IN_PLACE case This commit was SVN r7384.
Этот коммит содержится в:
родитель
406f0575eb
Коммит
7ca22d9416
@ -17,6 +17,8 @@
|
|||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
#include "coll_basic.h"
|
#include "coll_basic.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "ompi/include/constants.h"
|
#include "ompi/include/constants.h"
|
||||||
#include "ompi/datatype/datatype.h"
|
#include "ompi/datatype/datatype.h"
|
||||||
@ -40,24 +42,30 @@ mca_coll_basic_allgather_intra(void *sbuf, int scount,
|
|||||||
struct ompi_communicator_t *comm)
|
struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
char *inplace_temp = NULL;
|
char *rbuf_original, *inplace_temp = NULL;
|
||||||
long true_lb, true_extent, lb, extent;
|
long true_lb, true_extent, lb, extent;
|
||||||
|
|
||||||
/* Handle MPI_IN_PLACE (see explanantion in reduce.c for how to
|
/* Handle MPI_IN_PLACE (see explanantion in reduce.c for how to
|
||||||
allocate temp buffer) */
|
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) */
|
||||||
|
|
||||||
if (MPI_IN_PLACE == sbuf) {
|
if (MPI_IN_PLACE == sbuf && 0 != ompi_comm_rank(comm)) {
|
||||||
sbuf = rbuf;
|
ompi_ddt_get_extent(rdtype, &lb, &extent);
|
||||||
|
ompi_ddt_get_true_extent(rdtype, &true_lb, &true_extent);
|
||||||
|
|
||||||
|
rbuf_original = rbuf;
|
||||||
|
sbuf = ((char*) rbuf) + (ompi_comm_rank(comm) * extent * rcount);
|
||||||
sdtype = rdtype;
|
sdtype = rdtype;
|
||||||
scount = rcount;
|
scount = rcount;
|
||||||
|
|
||||||
ompi_ddt_get_extent(rdtype, &lb, &extent);
|
inplace_temp = malloc((true_extent + (rcount - 1) * extent) *
|
||||||
ompi_ddt_get_true_extent(rdtype, &true_lb, &true_extent);
|
ompi_comm_size(comm));
|
||||||
inplace_temp = malloc(true_extent + (rcount - 1) * extent);
|
|
||||||
if (NULL == inplace_temp) {
|
if (NULL == inplace_temp) {
|
||||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||||
}
|
}
|
||||||
rbuf = inplace_temp - lb;
|
rbuf = inplace_temp - lb;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gather and broadcast. */
|
/* Gather and broadcast. */
|
||||||
@ -74,11 +82,11 @@ mca_coll_basic_allgather_intra(void *sbuf, int scount,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're IN_PLACE, copy back out (sendcount and sendtype are
|
/* If we're IN_PLACE and not the root, copy back out (sendcount
|
||||||
ignored) */
|
and sendtype are ignored) */
|
||||||
|
|
||||||
if (NULL != inplace_temp) {
|
if (NULL != inplace_temp) {
|
||||||
ompi_ddt_copy_content_same_ddt(rdtype, rcount, rbuf, sbuf);
|
ompi_ddt_copy_content_same_ddt(rdtype, rcount, rbuf_original, rbuf);
|
||||||
free(inplace_temp);
|
free(inplace_temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user