This source file includes following definitions.
- mmap_runtime_query
- mmap_register
- mmap_open
- mmap_query
- mmap_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
27
28
29
30 #include "opal_config.h"
31
32 #include "opal/constants.h"
33 #include "opal/mca/shmem/shmem.h"
34 #include "shmem_mmap.h"
35
36
37
38
39 const char *opal_shmem_mmap_component_version_string =
40 "OPAL mmap shmem MCA component version " OPAL_VERSION;
41
42 int opal_shmem_mmap_relocate_backing_file = 0;
43 char *opal_shmem_mmap_backing_file_base_dir = NULL;
44 bool opal_shmem_mmap_nfs_warning = true;
45
46
47
48
49 static int mmap_register(void);
50 static int mmap_open(void);
51 static int mmap_close(void);
52 static int mmap_query(mca_base_module_t **module, int *priority);
53 static int mmap_runtime_query(mca_base_module_t **module,
54 int *priority,
55 const char *hint);
56
57
58
59
60
61 opal_shmem_mmap_component_t mca_shmem_mmap_component = {
62 .super = {
63 .base_version = {
64 OPAL_SHMEM_BASE_VERSION_2_0_0,
65
66
67 .mca_component_name = "mmap",
68 MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
69 OPAL_RELEASE_VERSION),
70
71 .mca_open_component = mmap_open,
72 .mca_close_component = mmap_close,
73 .mca_query_component = mmap_query,
74 .mca_register_component_params = mmap_register,
75 },
76
77 .base_data = {
78
79 MCA_BASE_METADATA_PARAM_CHECKPOINT
80 },
81 .runtime_query = mmap_runtime_query,
82 },
83 };
84
85
86 static int
87 mmap_runtime_query(mca_base_module_t **module,
88 int *priority,
89 const char *hint)
90 {
91
92 *priority = mca_shmem_mmap_component.priority;
93 *module = (mca_base_module_t *)&opal_shmem_mmap_module.super;
94 return OPAL_SUCCESS;
95 }
96
97 static int
98 mmap_register(void)
99 {
100 int ret;
101
102
103
104
105 mca_shmem_mmap_component.priority = 50;
106 ret = mca_base_component_var_register (&mca_shmem_mmap_component.super.base_version,
107 "priority", "Priority for shmem mmap "
108 "component (default: 50)", MCA_BASE_VAR_TYPE_INT,
109 NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
110 OPAL_INFO_LVL_3,
111 MCA_BASE_VAR_SCOPE_ALL_EQ,
112 &mca_shmem_mmap_component.priority);
113
114
115
116
117
118
119
120
121
122
123
124 opal_shmem_mmap_nfs_warning = true;
125 ret = mca_base_component_var_register (&mca_shmem_mmap_component.super.base_version,
126 "enable_nfs_warning",
127 "Enable the warning emitted when Open MPI detects "
128 "that its shared memory backing file is located on "
129 "a network filesystem (1 = enabled, 0 = disabled).",
130 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
131 OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL,
132 &opal_shmem_mmap_nfs_warning);
133 if (0 > ret) {
134 return ret;
135 }
136
137 opal_shmem_mmap_relocate_backing_file = 0;
138 ret = mca_base_component_var_register (&mca_shmem_mmap_component.super.base_version,
139 "relocate_backing_file",
140 "Whether to change the default placement of backing files or not "
141 "(Negative = try to relocate backing files to an area rooted at "
142 "the path specified by "
143 "shmem_mmap_backing_file_base_dir, but continue "
144 "with the default path if the relocation fails, 0 = do not relocate, "
145 "Positive = same as the negative option, but will fail if the "
146 "relocation fails.", MCA_BASE_VAR_TYPE_INT, NULL, 0,
147 MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_9,
148 MCA_BASE_VAR_SCOPE_ALL_EQ, &opal_shmem_mmap_relocate_backing_file);
149 if (0 > ret) {
150 return ret;
151 }
152
153 opal_shmem_mmap_backing_file_base_dir = "/dev/shm";
154 ret = mca_base_component_var_register (&mca_shmem_mmap_component.super.base_version,
155 "backing_file_base_dir",
156 "Specifies where backing files will be created when "
157 "shmem_mmap_relocate_backing_file is in use.", MCA_BASE_VAR_TYPE_STRING,
158 NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_9,
159 MCA_BASE_VAR_SCOPE_ALL_EQ,
160 &opal_shmem_mmap_backing_file_base_dir);
161 if (0 > ret) {
162 return ret;
163 }
164
165 return OPAL_SUCCESS;
166 }
167
168
169 static int
170 mmap_open(void)
171 {
172 return OPAL_SUCCESS;
173 }
174
175
176 static int
177 mmap_query(mca_base_module_t **module, int *priority)
178 {
179 *priority = mca_shmem_mmap_component.priority;
180 *module = (mca_base_module_t *)&opal_shmem_mmap_module.super;
181 return OPAL_SUCCESS;
182 }
183
184
185 static int
186 mmap_close(void)
187 {
188 return OPAL_SUCCESS;
189 }
190