This source file includes following definitions.
- mca_coll_inter_scatter_inter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "ompi_config.h"
23 #include "coll_inter.h"
24
25 #include "mpi.h"
26 #include "ompi/constants.h"
27 #include "ompi/datatype/ompi_datatype.h"
28 #include "ompi/mca/coll/coll.h"
29 #include "ompi/mca/coll/base/coll_tags.h"
30 #include "ompi/mca/pml/pml.h"
31
32
33
34
35
36
37
38
39 int
40 mca_coll_inter_scatter_inter(const void *sbuf, int scount,
41 struct ompi_datatype_t *sdtype,
42 void *rbuf, int rcount,
43 struct ompi_datatype_t *rdtype,
44 int root, struct ompi_communicator_t *comm,
45 mca_coll_base_module_t *module)
46 {
47 int rank, size, err;
48
49
50
51 rank = ompi_comm_rank(comm);
52 size = ompi_comm_remote_size(comm);
53
54 if (MPI_PROC_NULL == root) {
55
56 err = OMPI_SUCCESS;
57 } else if (MPI_ROOT != root) {
58
59 char *ptmp_free = NULL, *ptmp = NULL;
60 if(0 == rank) {
61 int size_local;
62 ptrdiff_t gap, span;
63
64 size_local = ompi_comm_size(comm->c_local_comm);
65 span = opal_datatype_span(&rdtype->super, (int64_t)rcount*(int64_t)size_local, &gap);
66 ptmp_free = malloc(span);
67 if (NULL == ptmp_free) {
68 return OMPI_ERR_OUT_OF_RESOURCE;
69 }
70 ptmp = ptmp_free - gap;
71
72 err = MCA_PML_CALL(recv(ptmp, rcount*size_local, rdtype,
73 root, MCA_COLL_BASE_TAG_SCATTER,
74 comm, MPI_STATUS_IGNORE));
75 if (OMPI_SUCCESS != err) {
76 return err;
77 }
78 }
79
80 err = comm->c_local_comm->c_coll->coll_scatter(ptmp, rcount, rdtype,
81 rbuf, rcount, rdtype,
82 0, comm->c_local_comm,
83 comm->c_local_comm->c_coll->coll_scatter_module);
84 if (NULL != ptmp_free) {
85 free(ptmp_free);
86 }
87 } else {
88
89 err = MCA_PML_CALL(send(sbuf, scount*size, sdtype, 0,
90 MCA_COLL_BASE_TAG_SCATTER,
91 MCA_PML_BASE_SEND_STANDARD, comm));
92 if (OMPI_SUCCESS != err) {
93 return err;
94 }
95 }
96
97 return err;
98 }