This source file includes following definitions.
- grdma_open
- grdma_register
- grdma_close
- grdma_init
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 #define OPAL_DISABLE_ENABLE_MEM_DEBUG 1
26 #include "opal_config.h"
27 #include "opal/mca/base/base.h"
28 #include "opal/runtime/opal_params.h"
29 #include "rcache_grdma.h"
30 #ifdef HAVE_UNISTD_H
31 #include <unistd.h>
32 #endif
33 #include <stdlib.h>
34 #include <fcntl.h>
35
36
37
38
39 static int grdma_open(void);
40 static int grdma_close(void);
41 static int grdma_register(void);
42 static mca_rcache_base_module_t* grdma_init(
43 struct mca_rcache_base_resources_t* resources);
44
45 mca_rcache_grdma_component_t mca_rcache_grdma_component = {
46 {
47
48
49
50 .rcache_version = {
51 MCA_RCACHE_BASE_VERSION_3_0_0,
52
53 .mca_component_name = "grdma",
54 MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
55 OPAL_RELEASE_VERSION),
56 .mca_open_component = grdma_open,
57 .mca_close_component = grdma_close,
58 .mca_register_component_params = grdma_register,
59 },
60 .rcache_data = {
61
62 MCA_BASE_METADATA_PARAM_CHECKPOINT
63 },
64
65 .rcache_init = grdma_init,
66 }
67 };
68
69
70
71
72 static int grdma_open(void)
73 {
74 OBJ_CONSTRUCT(&mca_rcache_grdma_component.caches, opal_list_t);
75
76 return OPAL_SUCCESS;
77 }
78
79
80 static int grdma_register(void)
81 {
82 mca_rcache_grdma_component.print_stats = false;
83 (void) mca_base_component_var_register(&mca_rcache_grdma_component.super.rcache_version,
84 "print_stats", "print registration cache usage statistics at the end of the run",
85 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
86 OPAL_INFO_LVL_9,
87 MCA_BASE_VAR_SCOPE_READONLY,
88 &mca_rcache_grdma_component.print_stats);
89
90 return OPAL_SUCCESS;
91 }
92
93
94 static int grdma_close(void)
95 {
96 OPAL_LIST_DESTRUCT(&mca_rcache_grdma_component.caches);
97 return OPAL_SUCCESS;
98 }
99
100
101 static mca_rcache_base_module_t *
102 grdma_init(struct mca_rcache_base_resources_t *resources)
103 {
104 mca_rcache_grdma_module_t *rcache_module;
105 mca_rcache_grdma_cache_t *cache = NULL, *item;
106
107
108
109
110 mca_rcache_grdma_component.leave_pinned = (int)
111 (1 == opal_leave_pinned || opal_leave_pinned_pipeline);
112
113
114 OPAL_LIST_FOREACH(item, &mca_rcache_grdma_component.caches, mca_rcache_grdma_cache_t) {
115 if (0 == strcmp (item->cache_name, resources->cache_name)) {
116 cache = item;
117 break;
118 }
119 }
120
121 if (NULL == cache) {
122
123 cache = OBJ_NEW(mca_rcache_grdma_cache_t);
124 if (NULL == cache) {
125 return NULL;
126 }
127
128 cache->cache_name = strdup (resources->cache_name);
129
130 opal_list_append (&mca_rcache_grdma_component.caches, &cache->super);
131 }
132
133 rcache_module = (mca_rcache_grdma_module_t *) malloc (sizeof (*rcache_module));
134
135 rcache_module->resources = *resources;
136
137 mca_rcache_grdma_module_init (rcache_module, cache);
138
139 return &rcache_module->super;
140 }