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
|
|
|
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "constants.h"
|
2004-01-12 00:26:55 +03:00
|
|
|
#include "mpi.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "mca/coll/coll.h"
|
|
|
|
#include "mca/coll/base/coll_tags.h"
|
2004-01-12 00:26:55 +03:00
|
|
|
#include "coll_basic.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* scatterv
|
|
|
|
*
|
|
|
|
* Function: - scatterv operation
|
|
|
|
* Accepts: - same arguments as MPI_Scatter()
|
|
|
|
* Returns: - MPI_SUCCESS or error code
|
|
|
|
*/
|
|
|
|
int mca_coll_basic_scatterv(void *sbuf, int *scounts,
|
|
|
|
int *disps, MPI_Datatype sdtype,
|
|
|
|
void *rbuf, int rcount,
|
|
|
|
MPI_Datatype rdtype, int root,
|
|
|
|
MPI_Comm comm)
|
|
|
|
{
|
2004-02-10 22:34:26 +03:00
|
|
|
#if 1
|
2004-06-07 19:33:53 +04:00
|
|
|
return OMPI_ERR_NOT_IMPLEMENTED;
|
2004-02-10 22:34:26 +03:00
|
|
|
#else
|
2004-01-12 00:26:55 +03:00
|
|
|
int i;
|
|
|
|
int rank;
|
|
|
|
int size;
|
|
|
|
int err;
|
|
|
|
char *ptmp;
|
|
|
|
MPI_Aint extent;
|
|
|
|
|
|
|
|
MPI_Comm_rank(comm, &rank);
|
|
|
|
MPI_Comm_size(comm, &size);
|
|
|
|
|
|
|
|
/* If not root, receive data. */
|
|
|
|
|
|
|
|
if (rank != root) {
|
|
|
|
#if 0
|
|
|
|
/* JMS Need to replace this with negative tags and direct PML calls */
|
|
|
|
err = MPI_Recv(rbuf, rcount, rdtype,
|
|
|
|
root, BLKMPISCATTERV, comm, MPI_STATUS_IGNORE);
|
|
|
|
#endif
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* I am the root, loop sending data. */
|
|
|
|
|
|
|
|
MPI_Type_extent(sdtype, &extent);
|
|
|
|
for (i = 0; i < size; ++i) {
|
|
|
|
ptmp = ((char *) sbuf) + (extent * disps[i]);
|
|
|
|
|
|
|
|
/* simple optimization */
|
|
|
|
|
|
|
|
if (i == rank) {
|
|
|
|
#if 0
|
2004-06-07 19:33:53 +04:00
|
|
|
/* JMS Need to replace this with ompi_datatype_*() functions */
|
|
|
|
err = ompi_dtsndrcv(ptmp, scounts[i], sdtype, rbuf,
|
2004-01-12 00:26:55 +03:00
|
|
|
rcount, rdtype, BLKMPISCATTERV, comm);
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
#if 0
|
|
|
|
/* JMS Need to replace this with negative tags and direct PML calls */
|
|
|
|
err = MPI_Send(ptmp, scounts[i], sdtype, i, BLKMPISCATTERV, comm);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
if (MPI_SUCCESS != err) {
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* All done */
|
|
|
|
|
|
|
|
return MPI_SUCCESS;
|
2004-02-10 22:34:26 +03:00
|
|
|
#endif
|
2004-01-12 00:26:55 +03:00
|
|
|
}
|