2004-01-12 00:26:55 +03:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-02-15 00:26:30 +03:00
|
|
|
#include "coll_basic.h"
|
2004-01-12 00:26:55 +03:00
|
|
|
|
|
|
|
#include "mpi.h"
|
2004-06-29 04:02:25 +04:00
|
|
|
#include "include/constants.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "communicator/communicator.h"
|
|
|
|
#include "mca/coll/coll.h"
|
|
|
|
#include "mca/coll/base/coll_tags.h"
|
2004-01-12 00:26:55 +03:00
|
|
|
#include "coll_basic.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2004-06-29 04:02:25 +04:00
|
|
|
* allgatherv_intra
|
2004-01-12 00:26:55 +03:00
|
|
|
*
|
|
|
|
* Function: - allgather using other MPI collectives
|
|
|
|
* Accepts: - same as MPI_Allgatherv()
|
|
|
|
* Returns: - MPI_SUCCESS or error code
|
|
|
|
*/
|
2004-06-29 04:02:25 +04:00
|
|
|
int mca_coll_basic_allgatherv_intra(void *sbuf, int scount,
|
|
|
|
struct ompi_datatype_t *sdtype,
|
|
|
|
void * rbuf, int *rcounts, int *disps,
|
|
|
|
struct ompi_datatype_t *rdtype,
|
|
|
|
struct ompi_communicator_t *comm)
|
2004-01-12 00:26:55 +03:00
|
|
|
{
|
|
|
|
int i, size;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
/* Collect all values at each process, one at a time. */
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
size = ompi_comm_size(comm);
|
2004-01-12 00:26:55 +03:00
|
|
|
for (i = 0; i < size; ++i) {
|
2004-06-29 04:02:25 +04:00
|
|
|
err = comm->c_coll.coll_gatherv(sbuf, scount, sdtype, rbuf,
|
|
|
|
rcounts, disps, rdtype, i, comm);
|
|
|
|
if (MPI_SUCCESS != err) {
|
2004-01-12 00:26:55 +03:00
|
|
|
return err;
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
2004-01-12 00:26:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return MPI_SUCCESS;
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* allgatherv_inter
|
|
|
|
*
|
|
|
|
* Function: - allgather using other MPI collectives
|
|
|
|
* Accepts: - same as MPI_Allgatherv()
|
|
|
|
* Returns: - MPI_SUCCESS or error code
|
|
|
|
*/
|
|
|
|
int mca_coll_basic_allgatherv_inter(void *sbuf, int scount,
|
|
|
|
struct ompi_datatype_t *sdtype,
|
|
|
|
void * rbuf, int *rcounts, int *disps,
|
|
|
|
struct ompi_datatype_t *rdtype,
|
|
|
|
struct ompi_communicator_t *comm)
|
|
|
|
{
|
2004-08-04 02:12:57 +04:00
|
|
|
int size, rsize;
|
2004-08-05 22:52:14 +04:00
|
|
|
int err, i;
|
2004-08-04 02:12:57 +04:00
|
|
|
int *scounts=NULL;
|
2004-08-04 21:08:29 +04:00
|
|
|
int *sdisps=NULL;
|
2004-08-04 02:12:57 +04:00
|
|
|
|
|
|
|
rsize = ompi_comm_remote_size (comm);
|
|
|
|
size = ompi_comm_size (comm);
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2004-08-05 22:52:14 +04:00
|
|
|
scounts = (int *) malloc (rsize * sizeof(int) );
|
2004-08-04 21:08:29 +04:00
|
|
|
sdisps = (int *) calloc (rsize, sizeof(int));
|
2004-08-04 02:12:57 +04:00
|
|
|
if ( NULL == scounts || NULL == sdisps ) {
|
2004-08-28 13:29:33 +04:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2004-08-04 02:12:57 +04:00
|
|
|
}
|
|
|
|
|
2004-08-05 22:52:14 +04:00
|
|
|
for ( i=0; i<rsize; i++) {
|
|
|
|
scounts[i] = scount;
|
|
|
|
}
|
2004-08-04 02:12:57 +04:00
|
|
|
|
|
|
|
err = comm->c_coll.coll_alltoallv (sbuf, scounts, sdisps, sdtype,
|
|
|
|
rbuf, rcounts, disps, rdtype,
|
|
|
|
comm );
|
|
|
|
|
|
|
|
if (NULL != sdisps ) {
|
|
|
|
free (sdisps);
|
|
|
|
}
|
|
|
|
if ( NULL != scounts ) {
|
|
|
|
free (scounts);
|
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
2004-01-12 00:26:55 +03:00
|
|
|
}
|