1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef MCA_OSC_MONITORING_MODULE_H
15 #define MCA_OSC_MONITORING_MODULE_H
16
17 #include <ompi/info/info.h>
18 #include <ompi/win/win.h>
19 #include <ompi/mca/osc/osc.h>
20
21
22 #define OMPI_OSC_MONITORING_MODULE_VARIABLE(template) \
23 ompi_osc_monitoring_module_## template ##_template
24
25
26
27
28 #define OSC_MONITORING_SET_TEMPLATE_FCT_NAME(template) \
29 ompi_osc_monitoring_## template ##_set_template
30
31
32
33
34 #define OMPI_OSC_MONITORING_MODULE_GENERATE(template) \
35 \
36 static ompi_osc_base_module_t OMPI_OSC_MONITORING_MODULE_VARIABLE(template);
37
38 #define OSC_MONITORING_GENERATE_TEMPLATE_MODULE(template) \
39 \
40 static int ompi_osc_monitoring_## template ##_free(ompi_win_t *win) \
41 { \
42 return OMPI_OSC_MONITORING_MODULE_VARIABLE(template).osc_free(win); \
43 }
44
45 #define MCA_OSC_MONITORING_MODULE_TEMPLATE_GENERATE(template) \
46
47
48 \
49 static inline ompi_osc_base_module_t * \
50 OSC_MONITORING_SET_TEMPLATE_FCT_NAME(template) (ompi_osc_base_module_t*module) \
51 { \
52 \
53 opal_atomic_int32_t init_done = 0; \
54
55
56
57
58 \
59 static const ompi_osc_base_module_t module_specific_interception_layer = { \
60 .osc_win_attach = ompi_osc_monitoring_## template ##_attach, \
61 .osc_win_detach = ompi_osc_monitoring_## template ##_detach, \
62 .osc_free = ompi_osc_monitoring_## template ##_free, \
63 \
64 .osc_put = ompi_osc_monitoring_## template ##_put, \
65 .osc_get = ompi_osc_monitoring_## template ##_get, \
66 .osc_accumulate = ompi_osc_monitoring_## template ##_accumulate, \
67 .osc_compare_and_swap = ompi_osc_monitoring_## template ##_compare_and_swap, \
68 .osc_fetch_and_op = ompi_osc_monitoring_## template ##_fetch_and_op, \
69 .osc_get_accumulate = ompi_osc_monitoring_## template ##_get_accumulate, \
70 \
71 .osc_rput = ompi_osc_monitoring_## template ##_rput, \
72 .osc_rget = ompi_osc_monitoring_## template ##_rget, \
73 .osc_raccumulate = ompi_osc_monitoring_## template ##_raccumulate, \
74 .osc_rget_accumulate = ompi_osc_monitoring_## template ##_rget_accumulate, \
75 \
76 .osc_fence = ompi_osc_monitoring_## template ##_fence, \
77 \
78 .osc_start = ompi_osc_monitoring_## template ##_start, \
79 .osc_complete = ompi_osc_monitoring_## template ##_complete, \
80 .osc_post = ompi_osc_monitoring_## template ##_post, \
81 .osc_wait = ompi_osc_monitoring_## template ##_wait, \
82 .osc_test = ompi_osc_monitoring_## template ##_test, \
83 \
84 .osc_lock = ompi_osc_monitoring_## template ##_lock, \
85 .osc_unlock = ompi_osc_monitoring_## template ##_unlock, \
86 .osc_lock_all = ompi_osc_monitoring_## template ##_lock_all, \
87 .osc_unlock_all = ompi_osc_monitoring_## template ##_unlock_all, \
88 \
89 .osc_sync = ompi_osc_monitoring_## template ##_sync, \
90 .osc_flush = ompi_osc_monitoring_## template ##_flush, \
91 .osc_flush_all = ompi_osc_monitoring_## template ##_flush_all, \
92 .osc_flush_local = ompi_osc_monitoring_## template ##_flush_local, \
93 .osc_flush_local_all = ompi_osc_monitoring_## template ##_flush_local_all, \
94 }; \
95 if ( 1 == opal_atomic_add_fetch_32(&init_done, 1) ) { \
96
97
98 \
99 memcpy(&OMPI_OSC_MONITORING_MODULE_VARIABLE(template), \
100 module, sizeof(ompi_osc_base_module_t)); \
101 } \
102 \
103 memcpy(module, &module_specific_interception_layer, \
104 sizeof(ompi_osc_base_module_t)); \
105 return module; \
106 }
107
108 #endif
109