1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2015 Research Organization for Information Science
13 * and Technology (RIST). All rights reserved.
14 * $COPYRIGHT$
15 *
16 * Additional copyrights may follow
17 *
18 * $HEADER$
19 */
20
21 #include "ompi_config.h"
22
23 #include "ompi/constants.h"
24 #include "coll_self.h"
25 #include "ompi/datatype/ompi_datatype.h"
26
27
28 /*
29 * scatterv_intra
30 *
31 * Function: - scatterv
32 * Accepts: - same arguments as MPI_Scatter()
33 * Returns: - MPI_SUCCESS or error code
34 */
35 int mca_coll_self_scatterv_intra(const void *sbuf, const int *scounts,
36 const int *disps, struct ompi_datatype_t *sdtype,
37 void *rbuf, int rcount,
38 struct ompi_datatype_t *rdtype, int root,
39 struct ompi_communicator_t *comm,
40 mca_coll_base_module_t *module)
41 {
42 if (MPI_IN_PLACE == rbuf) {
43 return MPI_SUCCESS;
44 } else {
45 int err;
46 ptrdiff_t lb, extent;
47 err = ompi_datatype_get_extent(sdtype, &lb, &extent);
48 if (OMPI_SUCCESS != err) {
49 return OMPI_ERROR;
50 }
51 return ompi_datatype_sndrcv(((char *) sbuf) + disps[0]*extent, scounts[0],
52 sdtype, rbuf, rcount, rdtype);
53 }
54 }