File: shmem_p.c

package info (click to toggle)
openmpi 5.0.8-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,692 kB
  • sloc: ansic: 613,078; makefile: 42,353; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,179; python: 1,859; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (171 lines) | stat: -rw-r--r-- 7,647 bytes parent folder | download | duplicates (5)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
 * Copyright (c) 2013      Mellanox Technologies, Inc.
 *                         All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */
#include "oshmem_config.h"

#include "oshmem/constants.h"
#include "oshmem/include/shmem.h"
#include "oshmem/include/shmemx.h"

#include "oshmem/runtime/runtime.h"

#include "oshmem/mca/spml/spml.h"

/*
 * These routines provide a low latency mechanism to write basic types (short,
 * int, float, double, long) to symmetric data objects on remote PEs.
 * The shmem_TYPE_p() routines write value to a symmetric array element or scalar
 * data object of the remote PE indicated by the parameter pe. These routines start the remote
 * transfer and may return before the data is delivered to the remote PE.
 */

#define DO_SHMEM_TYPE_P(ctx, type, addr, value, pe) do {            \
        int rc = OSHMEM_SUCCESS;                                    \
        size_t size = 0;                                            \
                                                                    \
        RUNTIME_CHECK_INIT();                                       \
        RUNTIME_CHECK_PE(pe);                                       \
        RUNTIME_CHECK_ADDR(addr);                                   \
                                                                    \
        size = sizeof(type);                                        \
        rc = MCA_SPML_CALL(put(                                     \
            ctx,                                                    \
            (void*)addr,                                            \
            size,                                                   \
            (void*)&value,                                          \
            pe));                                                   \
        RUNTIME_CHECK_RC(rc);                                       \
    } while(0)

#define SHMEM_CTX_TYPE_P(type_name, type, prefix)                   \
    void prefix##_ctx##type_name##_p(shmem_ctx_t ctx, type *addr, type value, int pe) \
    {                                                               \
        DO_SHMEM_TYPE_P(ctx, type, addr, value, pe);                \
        return ;                                                    \
    }

#define SHMEM_TYPE_P(type_name, type, prefix)                       \
    void prefix##type_name##_p(type *addr, type value, int pe)      \
    {                                                               \
        DO_SHMEM_TYPE_P(oshmem_ctx_default, type, addr, value, pe);  \
        return ;                                                    \
    }

#if OSHMEM_PROFILING
#include "oshmem/include/pshmem.h"
#pragma weak shmem_ctx_char_p       = pshmem_ctx_char_p
#pragma weak shmem_ctx_short_p      = pshmem_ctx_short_p
#pragma weak shmem_ctx_int_p        = pshmem_ctx_int_p
#pragma weak shmem_ctx_long_p       = pshmem_ctx_long_p
#pragma weak shmem_ctx_float_p      = pshmem_ctx_float_p
#pragma weak shmem_ctx_double_p     = pshmem_ctx_double_p
#pragma weak shmem_ctx_longlong_p   = pshmem_ctx_longlong_p
#pragma weak shmem_ctx_schar_p      = pshmem_ctx_schar_p
#pragma weak shmem_ctx_uchar_p      = pshmem_ctx_uchar_p
#pragma weak shmem_ctx_ushort_p     = pshmem_ctx_ushort_p
#pragma weak shmem_ctx_uint_p       = pshmem_ctx_uint_p
#pragma weak shmem_ctx_ulong_p      = pshmem_ctx_ulong_p
#pragma weak shmem_ctx_ulonglong_p  = pshmem_ctx_ulonglong_p
#pragma weak shmem_ctx_longdouble_p = pshmem_ctx_longdouble_p
#pragma weak shmem_ctx_int8_p       = pshmem_ctx_int8_p
#pragma weak shmem_ctx_int16_p      = pshmem_ctx_int16_p
#pragma weak shmem_ctx_int32_p      = pshmem_ctx_int32_p
#pragma weak shmem_ctx_int64_p      = pshmem_ctx_int64_p
#pragma weak shmem_ctx_uint8_p      = pshmem_ctx_uint8_p
#pragma weak shmem_ctx_uint16_p     = pshmem_ctx_uint16_p
#pragma weak shmem_ctx_uint32_p     = pshmem_ctx_uint32_p
#pragma weak shmem_ctx_uint64_p     = pshmem_ctx_uint64_p
#pragma weak shmem_ctx_size_p       = pshmem_ctx_size_p
#pragma weak shmem_ctx_ptrdiff_p    = pshmem_ctx_ptrdiff_p

#pragma weak shmem_char_p           = pshmem_char_p
#pragma weak shmem_short_p          = pshmem_short_p
#pragma weak shmem_int_p            = pshmem_int_p
#pragma weak shmem_long_p           = pshmem_long_p
#pragma weak shmem_float_p          = pshmem_float_p
#pragma weak shmem_double_p         = pshmem_double_p
#pragma weak shmem_longlong_p       = pshmem_longlong_p
#pragma weak shmem_schar_p          = pshmem_schar_p
#pragma weak shmem_uchar_p          = pshmem_uchar_p
#pragma weak shmem_ushort_p         = pshmem_ushort_p
#pragma weak shmem_uint_p           = pshmem_uint_p
#pragma weak shmem_ulong_p          = pshmem_ulong_p
#pragma weak shmem_ulonglong_p      = pshmem_ulonglong_p
#pragma weak shmem_longdouble_p     = pshmem_longdouble_p
#pragma weak shmem_int8_p           = pshmem_int8_p
#pragma weak shmem_int16_p          = pshmem_int16_p
#pragma weak shmem_int32_p          = pshmem_int32_p
#pragma weak shmem_int64_p          = pshmem_int64_p
#pragma weak shmem_uint8_p          = pshmem_uint8_p
#pragma weak shmem_uint16_p         = pshmem_uint16_p
#pragma weak shmem_uint32_p         = pshmem_uint32_p
#pragma weak shmem_uint64_p         = pshmem_uint64_p
#pragma weak shmem_size_p           = pshmem_size_p
#pragma weak shmem_ptrdiff_p        = pshmem_ptrdiff_p

#pragma weak shmemx_int16_p = pshmemx_int16_p
#pragma weak shmemx_int32_p = pshmemx_int32_p
#pragma weak shmemx_int64_p = pshmemx_int64_p

#include "oshmem/shmem/c/profile-defines.h"
#endif

SHMEM_CTX_TYPE_P(_char, char, shmem)
SHMEM_CTX_TYPE_P(_short, short, shmem)
SHMEM_CTX_TYPE_P(_int, int, shmem)
SHMEM_CTX_TYPE_P(_long, long, shmem)
SHMEM_CTX_TYPE_P(_longlong, long long, shmem)
SHMEM_CTX_TYPE_P(_schar, signed char, shmem)
SHMEM_CTX_TYPE_P(_uchar, unsigned char, shmem)
SHMEM_CTX_TYPE_P(_ushort, unsigned short, shmem)
SHMEM_CTX_TYPE_P(_uint, unsigned int, shmem)
SHMEM_CTX_TYPE_P(_ulong, unsigned long, shmem)
SHMEM_CTX_TYPE_P(_ulonglong, unsigned long long, shmem)
SHMEM_CTX_TYPE_P(_float, float, shmem)
SHMEM_CTX_TYPE_P(_double, double, shmem)
SHMEM_CTX_TYPE_P(_longdouble, long double, shmem)
SHMEM_CTX_TYPE_P(_int8, int8_t, shmem)
SHMEM_CTX_TYPE_P(_int16, int16_t, shmem)
SHMEM_CTX_TYPE_P(_int32, int32_t, shmem)
SHMEM_CTX_TYPE_P(_int64, int64_t, shmem)
SHMEM_CTX_TYPE_P(_uint8, uint8_t, shmem)
SHMEM_CTX_TYPE_P(_uint16, uint16_t, shmem)
SHMEM_CTX_TYPE_P(_uint32, uint32_t, shmem)
SHMEM_CTX_TYPE_P(_uint64, uint64_t, shmem)
SHMEM_CTX_TYPE_P(_size, size_t, shmem)
SHMEM_CTX_TYPE_P(_ptrdiff, ptrdiff_t, shmem)

SHMEM_TYPE_P(_char, char, shmem)
SHMEM_TYPE_P(_short, short, shmem)
SHMEM_TYPE_P(_int, int, shmem)
SHMEM_TYPE_P(_long, long, shmem)
SHMEM_TYPE_P(_longlong, long long, shmem)
SHMEM_TYPE_P(_schar, signed char, shmem)
SHMEM_TYPE_P(_uchar, unsigned char, shmem)
SHMEM_TYPE_P(_ushort, unsigned short, shmem)
SHMEM_TYPE_P(_uint, unsigned int, shmem)
SHMEM_TYPE_P(_ulong, unsigned long, shmem)
SHMEM_TYPE_P(_ulonglong, unsigned long long, shmem)
SHMEM_TYPE_P(_float, float, shmem)
SHMEM_TYPE_P(_double, double, shmem)
SHMEM_TYPE_P(_longdouble, long double, shmem)
SHMEM_TYPE_P(_int8, int8_t, shmem)
SHMEM_TYPE_P(_int16, int16_t, shmem)
SHMEM_TYPE_P(_int32, int32_t, shmem)
SHMEM_TYPE_P(_int64, int64_t, shmem)
SHMEM_TYPE_P(_uint8, uint8_t, shmem)
SHMEM_TYPE_P(_uint16, uint16_t, shmem)
SHMEM_TYPE_P(_uint32, uint32_t, shmem)
SHMEM_TYPE_P(_uint64, uint64_t, shmem)
SHMEM_TYPE_P(_size, size_t, shmem)
SHMEM_TYPE_P(_ptrdiff, ptrdiff_t, shmem)

SHMEM_TYPE_P(_int16, int16_t, shmemx)
SHMEM_TYPE_P(_int32, int32_t, shmemx)
SHMEM_TYPE_P(_int64, int64_t, shmemx)