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