This source file includes following definitions.
- mca_mpool_base_register
- mca_mpool_base_open
- mca_mpool_base_close
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 "opal_config.h"
27
28 #include <stdio.h>
29 #include <stdlib.h>
30 #ifdef HAVE_UNISTD_H
31 #include <unistd.h>
32 #endif
33
34 #include "opal/mca/mca.h"
35 #include "opal/mca/base/base.h"
36 #include "opal/mca/mpool/base/base.h"
37 #include "opal/constants.h"
38 #include "opal/util/sys_limits.h"
39
40
41
42
43
44
45 #include "opal/mca/mpool/base/static-components.h"
46
47 #include "mpool_base_tree.h"
48
49
50
51
52 opal_list_t mca_mpool_base_modules = {{0}};
53 static char *mca_mpool_base_default_hints;
54
55 int mca_mpool_base_default_priority = 50;
56
57 OBJ_CLASS_INSTANCE(mca_mpool_base_selected_module_t, opal_list_item_t, NULL, NULL);
58
59 static int mca_mpool_base_register (mca_base_register_flag_t flags)
60 {
61 mca_mpool_base_default_hints = NULL;
62 (void) mca_base_var_register ("opal", "mpool", "base", "default_hints",
63 "Hints to use when selecting the default memory pool",
64 MCA_BASE_VAR_TYPE_STRING, NULL, 0,
65 MCA_BASE_VAR_FLAG_INTERNAL,
66 OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
67 &mca_mpool_base_default_hints);
68
69 mca_mpool_base_default_priority = 50;
70 (void) mca_base_var_register ("opal", "mpool", "base", "default_priority",
71 "Priority of the default mpool module",
72 MCA_BASE_VAR_TYPE_INT, NULL, 0,
73 MCA_BASE_VAR_FLAG_INTERNAL,
74 OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
75 &mca_mpool_base_default_priority);
76
77 return OPAL_SUCCESS;
78 }
79
80
81
82
83
84 static int mca_mpool_base_open(mca_base_open_flag_t flags)
85 {
86
87
88 if (OPAL_SUCCESS !=
89 mca_base_framework_components_open(&opal_mpool_base_framework, flags)) {
90 return OPAL_ERROR;
91 }
92
93 if (mca_mpool_base_default_hints) {
94 mca_mpool_base_default_module = mca_mpool_base_module_lookup (mca_mpool_base_default_hints);
95 }
96
97
98
99 OBJ_CONSTRUCT(&mca_mpool_base_modules, opal_list_t);
100
101
102 mca_mpool_base_tree_init();
103
104 return OPAL_SUCCESS;
105 }
106
107 static int mca_mpool_base_close(void)
108 {
109 opal_list_item_t *item;
110 mca_mpool_base_selected_module_t *sm;
111
112
113
114 while(NULL != (item = opal_list_remove_first(&mca_mpool_base_modules))) {
115 sm = (mca_mpool_base_selected_module_t *) item;
116
117
118
119
120
121
122 if (NULL != sm->mpool_module->mpool_finalize) {
123 sm->mpool_module->mpool_finalize(sm->mpool_module);
124 }
125 OBJ_RELEASE(sm);
126 }
127
128
129
130 (void) mca_base_framework_components_close(&opal_mpool_base_framework, NULL);
131
132 mca_mpool_base_tree_fini();
133
134 return OPAL_SUCCESS;
135 }
136
137 MCA_BASE_FRAMEWORK_DECLARE(opal, mpool, "Memory pools", mca_mpool_base_register, mca_mpool_base_open,
138 mca_mpool_base_close, mca_mpool_base_static_components, 0);