OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

memory.h
1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
13 * $COPYRIGHT$
14 *
15 * Additional copyrights may follow
16 *
17 * $HEADER$
18 */
19
20 /* NOTE: This framework accomodates two kinds of memory hooks systems:
21
22 1. Those that only require being setup once and then will
23 automatically call back to internal component/module functions
24 as required (e.g., the ptmalloc2 component). It is expected
25 that such components will have a NULL value for memoryc_process
26 and empty (base) implementations of memoryc_register and
27 memoryc_deregister.
28
29 2. Those that must be queried periodically to find out if something
30 has happened to the registered memory mappings (e.g., the
31 ummunot component). It is expected that such components will
32 have complete implementations for memoryc_process,
33 memoryc_register, and memoryc_deregister.
34
35 There will only be one of these components compiled in to Open MPI
36 (it will be compiled in libopen-pal; it will never be a DSO). so
37 the componente will rule "yes, I can run" or "no, I cannot run".
38 If it elects not to run, then there is no memory manager support in
39 this process.
40
41 Because there will only be one memory manager component in the
42 process, there is no need for a separate module structure --
43 everything is in the component for simplicity.
44
45 Note that there is an interface relevant to this framework that is
46 not described in this file: the opal_memory_changed() macro. This
47 macro should return 1 if an asynchronous agent has noticed that
48 memory mappings have changed. The macro should be as cheap/fast as
49 possible (which is why it's a macro). If it returns 1, the
50 memoryc_process() function pointer (below), will be invoked. If
51 the component does not provide this macro, then a default macro is
52 used that always returns 0 and therefore memoryc_process() will
53 never be invoked (and can legally be NULL).
54 */
55
56 #ifndef OPAL_MCA_MEMORY_MEMORY_H
57 #define OPAL_MCA_MEMORY_MEMORY_H
58
59 #include "opal_config.h"
60
61 #include "opal/mca/mca.h"
62 #include "opal/mca/base/base.h"
63
64 BEGIN_C_DECLS
65
66 /**
67 * Prototype for doing something once memory changes have been
68 * detected. This function is assumed to do whatever is necessary to
69 * a) figured out what has changed, and b) adjust OMPI as relevant
70 * (e.g., call opal_mem_hooks_release_hook). It only needs to be
71 * supplied for components that provide opal_memory_changed() macros
72 * that can return non-zero.
73 */
74 typedef int (*opal_memory_base_component_process_fn_t)(void);
75
76 /**
77 * Prototype for a function that is invoked when Open MPI starts to
78 * "care" about a specific memory region. That is, Open MPI declares
79 * that it wants to be notified if the memory mapping for this region
80 * changes.
81 *
82 * If a component does not want/need to provide this functionality, it
83 * can use the value opal_memory_base_register_empty (an empty
84 * implementation of this function).
85 */
86 typedef int (*opal_memory_base_component_register_fn_t)(void *base,
87 size_t len,
88 uint64_t cookie);
89
90
91 /**
92 * Prototype for a function that is the opposite of
93 * opal_memory_base_component_register_fn_t: this function is invoked
94 * when Open MPI stops to "caring" about a specific memory region.
95 * That is, Open MPI declares that it no longer wants to be notified
96 * if the memory mapping for this region changes.
97 *
98 * The parameters of this function will exactly match parameters that
99 * were previously passed to the call to
100 * opal_memory_base_component_register_fn_t.
101 *
102 * If a component does not want/need to provide this functionality, it
103 * can use the value opal_memory_base_deregister_empty (an empty
104 * implementation of this function).
105 */
106 typedef int (*opal_memory_base_component_deregister_fn_t)(void *base,
107 size_t len,
108 uint64_t cookie);
109
110
111 /**
112 * Structure for memory components.
113 */
114 typedef struct opal_memory_base_component_2_0_0_t {
115 /** MCA base component */
116 mca_base_component_t memoryc_version;
117 /** MCA base data */
118 mca_base_component_data_t memoryc_data;
119
120 /** Function to call when something has changed, as indicated by
121 opal_memory_changed(). Will be ignored if the component does
122 not provide an opal_memory_changed() macro that returns
123 nonzero. */
124 opal_memory_base_component_process_fn_t memoryc_process;
125
126 /** Function invoked when Open MPI starts "caring" about a
127 specific memory region */
128 opal_memory_base_component_register_fn_t memoryc_register;
129 /** Function invoked when Open MPI stops "caring" about a
130 specific memory region */
131 opal_memory_base_component_deregister_fn_t memoryc_deregister;
132 } opal_memory_base_component_2_0_0_t;
133
134 OPAL_DECLSPEC extern opal_memory_base_component_2_0_0_t *opal_memory;
135
136 END_C_DECLS
137
138 /*
139 * Macro for use in components that are of type memory
140 */
141 #define OPAL_MEMORY_BASE_VERSION_2_0_0 \
142 MCA_BASE_VERSION_2_0_0, \
143 "memory", 2, 0, 0
144
145 #endif /* OPAL_MCA_MEMORY_MEMORY_H */
mca_base_component_2_0_0_t
Common type for all MCA components.
Definition: mca.h:250
opal_memory_base_component_2_0_0_t::memoryc_process
opal_memory_base_component_process_fn_t memoryc_process
Function to call when something has changed, as indicated by opal_memory_changed().
Definition: memory.h:124
opal_memory_base_component_2_0_0_t
Structure for memory components.
Definition: memory.h:114
mca.h
Top-level interface for all MCA components.
opal_memory_base_component_2_0_0_t::memoryc_data
mca_base_component_data_t memoryc_data
MCA base data.
Definition: memory.h:118
opal_memory_base_component_2_0_0_t::memoryc_deregister
opal_memory_base_component_deregister_fn_t memoryc_deregister
Function invoked when Open MPI stops "caring" about a specific memory region.
Definition: memory.h:131
mca_base_component_data_2_0_0_t
Meta data for MCA v2.0.0 components.
Definition: mca.h:309
opal_memory_base_component_2_0_0_t::memoryc_register
opal_memory_base_component_register_fn_t memoryc_register
Function invoked when Open MPI starts "caring" about a specific memory region.
Definition: memory.h:128
opal_memory_base_component_2_0_0_t::memoryc_version
mca_base_component_t memoryc_version
MCA base component.
Definition: memory.h:116