This source file includes following definitions.
- coll_base_module_construct
- coll_base_module_destruct
- coll_base_comm_construct
- coll_base_comm_destruct
- ompi_coll_base_comm_get_reqs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #include "ompi_config.h"
27 #include <stdio.h>
28
29 #include "ompi/constants.h"
30 #include "ompi/mca/mca.h"
31 #include "opal/util/output.h"
32 #include "opal/mca/base/base.h"
33
34
35 #include "ompi/mca/coll/coll.h"
36 #include "ompi/mca/coll/base/base.h"
37 #include "ompi/mca/coll/base/coll_base_functions.h"
38
39
40
41
42
43
44 #include "ompi/mca/coll/base/static-components.h"
45
46
47
48
49 static void coll_base_module_construct(mca_coll_base_module_t *m)
50 {
51
52 memset ((char *) m + sizeof (m->super), 0, sizeof (*m) - sizeof (m->super));
53 m->coll_module_disable = NULL;
54 m->base_data = NULL;
55 }
56
57 static void
58 coll_base_module_destruct(mca_coll_base_module_t *module)
59 {
60 if (NULL != module->base_data) {
61 OBJ_RELEASE(module->base_data);
62 }
63 }
64
65 OBJ_CLASS_INSTANCE(mca_coll_base_module_t, opal_object_t,
66 coll_base_module_construct, coll_base_module_destruct);
67
68
69 static void
70 coll_base_comm_construct(mca_coll_base_comm_t *data)
71 {
72 memset ((char *) data + sizeof (data->super), 0, sizeof (*data) - sizeof (data->super));
73 }
74
75 static void
76 coll_base_comm_destruct(mca_coll_base_comm_t *data)
77 {
78 if( NULL != data->mcct_reqs ) {
79 ompi_coll_base_free_reqs( data->mcct_reqs, data->mcct_num_reqs );
80 free(data->mcct_reqs);
81 data->mcct_reqs = NULL;
82 data->mcct_num_reqs = 0;
83 }
84 assert(0 == data->mcct_num_reqs);
85
86
87 if (data->cached_ntree) {
88 ompi_coll_base_topo_destroy_tree (&data->cached_ntree);
89 }
90 if (data->cached_bintree) {
91 ompi_coll_base_topo_destroy_tree (&data->cached_bintree);
92 }
93 if (data->cached_bmtree) {
94 ompi_coll_base_topo_destroy_tree (&data->cached_bmtree);
95 }
96 if (data->cached_in_order_bmtree) {
97 ompi_coll_base_topo_destroy_tree (&data->cached_in_order_bmtree);
98 }
99 if (data->cached_kmtree) {
100 ompi_coll_base_topo_destroy_tree (&data->cached_kmtree);
101 }
102 if (data->cached_chain) {
103 ompi_coll_base_topo_destroy_tree (&data->cached_chain);
104 }
105 if (data->cached_pipeline) {
106 ompi_coll_base_topo_destroy_tree (&data->cached_pipeline);
107 }
108 if (data->cached_in_order_bintree) {
109 ompi_coll_base_topo_destroy_tree (&data->cached_in_order_bintree);
110 }
111 }
112
113 OBJ_CLASS_INSTANCE(mca_coll_base_comm_t, opal_object_t,
114 coll_base_comm_construct, coll_base_comm_destruct);
115
116 ompi_request_t** ompi_coll_base_comm_get_reqs(mca_coll_base_comm_t* data, int nreqs)
117 {
118 if( 0 == nreqs ) return NULL;
119
120 if( data->mcct_num_reqs < nreqs ) {
121 data->mcct_reqs = (ompi_request_t**)realloc(data->mcct_reqs, sizeof(ompi_request_t*) * nreqs);
122
123 if( NULL != data->mcct_reqs ) {
124 for( int i = data->mcct_num_reqs; i < nreqs; i++ )
125 data->mcct_reqs[i] = MPI_REQUEST_NULL;
126 data->mcct_num_reqs = nreqs;
127 } else
128 data->mcct_num_reqs = 0;
129 }
130 return data->mcct_reqs;
131 }
132
133 MCA_BASE_FRAMEWORK_DECLARE(ompi, coll, "Collectives", NULL, NULL, NULL,
134 mca_coll_base_static_components, 0);