1
2
3
4
5
6
7
8
9
10 #include "oshmem_config.h"
11
12 #include "oshmem/constants.h"
13 #include "oshmem/include/shmem.h"
14 #include "oshmem/include/shmemx.h"
15
16 #include "oshmem/runtime/runtime.h"
17
18 #include "oshmem/mca/spml/spml.h"
19
20
21
22
23
24
25 #define DO_SHMEM_TYPE_G(ctx, type, addr, pe, out_value) do { \
26 int rc = OSHMEM_SUCCESS; \
27 size_t size = 0; \
28 \
29 RUNTIME_CHECK_INIT(); \
30 RUNTIME_CHECK_PE(pe); \
31 RUNTIME_CHECK_ADDR(addr); \
32 \
33 size = sizeof(out_value); \
34 rc = MCA_SPML_CALL(get( \
35 ctx, \
36 (void*)addr, \
37 size, \
38 (void*)&out_value, \
39 pe)); \
40 RUNTIME_CHECK_RC(rc); \
41 } while (0)
42
43 #define SHMEM_CTX_TYPE_G(type_name, type, prefix) \
44 type prefix##_ctx##type_name##_g(shmem_ctx_t ctx, const type *addr, int pe) \
45 { \
46 type out_value; \
47 DO_SHMEM_TYPE_G(ctx, type, addr, pe, out_value); \
48 return out_value; \
49 }
50
51 #define SHMEM_TYPE_G(type_name, type, prefix) \
52 type prefix##type_name##_g(const type *addr, int pe) \
53 { \
54 type out_value; \
55 DO_SHMEM_TYPE_G(oshmem_ctx_default, type, addr, pe, out_value); \
56 return out_value; \
57 }
58
59 #if OSHMEM_PROFILING
60 #include "oshmem/include/pshmem.h"
61 #pragma weak shmem_ctx_char_g = pshmem_ctx_char_g
62 #pragma weak shmem_ctx_short_g = pshmem_ctx_short_g
63 #pragma weak shmem_ctx_int_g = pshmem_ctx_int_g
64 #pragma weak shmem_ctx_long_g = pshmem_ctx_long_g
65 #pragma weak shmem_ctx_float_g = pshmem_ctx_float_g
66 #pragma weak shmem_ctx_double_g = pshmem_ctx_double_g
67 #pragma weak shmem_ctx_longlong_g = pshmem_ctx_longlong_g
68 #pragma weak shmem_ctx_schar_g = pshmem_ctx_schar_g
69 #pragma weak shmem_ctx_uchar_g = pshmem_ctx_uchar_g
70 #pragma weak shmem_ctx_ushort_g = pshmem_ctx_ushort_g
71 #pragma weak shmem_ctx_uint_g = pshmem_ctx_uint_g
72 #pragma weak shmem_ctx_ulong_g = pshmem_ctx_ulong_g
73 #pragma weak shmem_ctx_ulonglong_g = pshmem_ctx_ulonglong_g
74 #pragma weak shmem_ctx_longdouble_g = pshmem_ctx_longdouble_g
75 #pragma weak shmem_ctx_int8_g = pshmem_ctx_int8_g
76 #pragma weak shmem_ctx_int16_g = pshmem_ctx_int16_g
77 #pragma weak shmem_ctx_int32_g = pshmem_ctx_int32_g
78 #pragma weak shmem_ctx_int64_g = pshmem_ctx_int64_g
79 #pragma weak shmem_ctx_uint8_g = pshmem_ctx_uint8_g
80 #pragma weak shmem_ctx_uint16_g = pshmem_ctx_uint16_g
81 #pragma weak shmem_ctx_uint32_g = pshmem_ctx_uint32_g
82 #pragma weak shmem_ctx_uint64_g = pshmem_ctx_uint64_g
83 #pragma weak shmem_ctx_size_g = pshmem_ctx_size_g
84 #pragma weak shmem_ctx_ptrdiff_g = pshmem_ctx_ptrdiff_g
85
86 #pragma weak shmem_char_g = pshmem_char_g
87 #pragma weak shmem_short_g = pshmem_short_g
88 #pragma weak shmem_int_g = pshmem_int_g
89 #pragma weak shmem_long_g = pshmem_long_g
90 #pragma weak shmem_float_g = pshmem_float_g
91 #pragma weak shmem_double_g = pshmem_double_g
92 #pragma weak shmem_longlong_g = pshmem_longlong_g
93 #pragma weak shmem_schar_g = pshmem_schar_g
94 #pragma weak shmem_uchar_g = pshmem_uchar_g
95 #pragma weak shmem_ushort_g = pshmem_ushort_g
96 #pragma weak shmem_uint_g = pshmem_uint_g
97 #pragma weak shmem_ulong_g = pshmem_ulong_g
98 #pragma weak shmem_ulonglong_g = pshmem_ulonglong_g
99 #pragma weak shmem_longdouble_g = pshmem_longdouble_g
100 #pragma weak shmem_int8_g = pshmem_int8_g
101 #pragma weak shmem_int16_g = pshmem_int16_g
102 #pragma weak shmem_int32_g = pshmem_int32_g
103 #pragma weak shmem_int64_g = pshmem_int64_g
104 #pragma weak shmem_uint8_g = pshmem_uint8_g
105 #pragma weak shmem_uint16_g = pshmem_uint16_g
106 #pragma weak shmem_uint32_g = pshmem_uint32_g
107 #pragma weak shmem_uint64_g = pshmem_uint64_g
108 #pragma weak shmem_size_g = pshmem_size_g
109 #pragma weak shmem_ptrdiff_g = pshmem_ptrdiff_g
110
111 #pragma weak shmemx_int16_g = pshmemx_int16_g
112 #pragma weak shmemx_int32_g = pshmemx_int32_g
113 #pragma weak shmemx_int64_g = pshmemx_int64_g
114 #include "oshmem/shmem/c/profile/defines.h"
115 #endif
116
117 SHMEM_CTX_TYPE_G(_char, char, shmem)
118 SHMEM_CTX_TYPE_G(_short, short, shmem)
119 SHMEM_CTX_TYPE_G(_int, int, shmem)
120 SHMEM_CTX_TYPE_G(_long, long, shmem)
121 SHMEM_CTX_TYPE_G(_longlong, long long, shmem)
122 SHMEM_CTX_TYPE_G(_schar, signed char, shmem)
123 SHMEM_CTX_TYPE_G(_uchar, unsigned char, shmem)
124 SHMEM_CTX_TYPE_G(_ushort, unsigned short, shmem)
125 SHMEM_CTX_TYPE_G(_uint, unsigned int, shmem)
126 SHMEM_CTX_TYPE_G(_ulong, unsigned long, shmem)
127 SHMEM_CTX_TYPE_G(_ulonglong, unsigned long long, shmem)
128 SHMEM_CTX_TYPE_G(_float, float, shmem)
129 SHMEM_CTX_TYPE_G(_double, double, shmem)
130 SHMEM_CTX_TYPE_G(_longdouble, long double, shmem)
131 SHMEM_CTX_TYPE_G(_int8, int8_t, shmem)
132 SHMEM_CTX_TYPE_G(_int16, int16_t, shmem)
133 SHMEM_CTX_TYPE_G(_int32, int32_t, shmem)
134 SHMEM_CTX_TYPE_G(_int64, int64_t, shmem)
135 SHMEM_CTX_TYPE_G(_uint8, uint8_t, shmem)
136 SHMEM_CTX_TYPE_G(_uint16, uint16_t, shmem)
137 SHMEM_CTX_TYPE_G(_uint32, uint32_t, shmem)
138 SHMEM_CTX_TYPE_G(_uint64, uint64_t, shmem)
139 SHMEM_CTX_TYPE_G(_size, size_t, shmem)
140 SHMEM_CTX_TYPE_G(_ptrdiff, ptrdiff_t, shmem)
141
142 SHMEM_TYPE_G(_char, char, shmem)
143 SHMEM_TYPE_G(_short, short, shmem)
144 SHMEM_TYPE_G(_int, int, shmem)
145 SHMEM_TYPE_G(_long, long, shmem)
146 SHMEM_TYPE_G(_longlong, long long, shmem)
147 SHMEM_TYPE_G(_schar, signed char, shmem)
148 SHMEM_TYPE_G(_uchar, unsigned char, shmem)
149 SHMEM_TYPE_G(_ushort, unsigned short, shmem)
150 SHMEM_TYPE_G(_uint, unsigned int, shmem)
151 SHMEM_TYPE_G(_ulong, unsigned long, shmem)
152 SHMEM_TYPE_G(_ulonglong, unsigned long long, shmem)
153 SHMEM_TYPE_G(_float, float, shmem)
154 SHMEM_TYPE_G(_double, double, shmem)
155 SHMEM_TYPE_G(_longdouble, long double, shmem)
156 SHMEM_TYPE_G(_int8, int8_t, shmem)
157 SHMEM_TYPE_G(_int16, int16_t, shmem)
158 SHMEM_TYPE_G(_int32, int32_t, shmem)
159 SHMEM_TYPE_G(_int64, int64_t, shmem)
160 SHMEM_TYPE_G(_uint8, uint8_t, shmem)
161 SHMEM_TYPE_G(_uint16, uint16_t, shmem)
162 SHMEM_TYPE_G(_uint32, uint32_t, shmem)
163 SHMEM_TYPE_G(_uint64, uint64_t, shmem)
164 SHMEM_TYPE_G(_size, size_t, shmem)
165 SHMEM_TYPE_G(_ptrdiff, ptrdiff_t, shmem)
166
167 SHMEM_TYPE_G(_int16, int16_t, shmemx)
168 SHMEM_TYPE_G(_int32, int32_t, shmemx)
169 SHMEM_TYPE_G(_int64, int64_t, shmemx)