forked from openshmem-org/specification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatomics_intro.tex
111 lines (102 loc) · 4.51 KB
/
atomics_intro.tex
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
An \ac{AMO} is a one-sided communication mechanism that combines memory update
operations with atomicity guarantees described in Section
\ref{subsec:amo_guarantees}. Similar to the \ac{RMA} routines, described in
Section \ref{sec:rma}, the \acp{AMO} are performed only on symmetric objects.
\openshmem{} defines the two types of \ac{AMO} routines:
\begin{itemize}
\item
The \textit{fetching} routines return the original value of, and optionally
update, the remote data object in a single atomic operation. The routines
return after the data has been fetched and delivered to the local \ac{PE}.
The fetching operations include:
\FUNC{shmem\_atomic\_\{fetch, compare\_swap, swap\}} and
\FUNC{shmem\_atomic\_fetch\_\{inc, add, and, or, xor\}}.
\item
The \textit{non-fetching} atomic routines update the remote memory in a single
atomic operation. A call to a non-fetching atomic routine issues the atomic
operation and may return before the operation executes on the remote \ac{PE}.
To force completion for these non-fetching atomic routines,
\FUNC{shmem\_quiet}, \FUNC{shmem\_barrier}, or \FUNC{shmem\_barrier\_all} can
be used by an \openshmem{} program.
The non-fetching operations include:
\FUNC{shmem\_atomic\_\{set, inc, add, and, or, xor\}}.
\end{itemize}
Where appropriate compiler support is available, \openshmem{} provides
type-generic \ac{AMO} interfaces via \Cstd[11] generic selection.
The type-generic support for the \ac{AMO} routines is as follows:
\begin{itemize}
\item \FUNC{shmem\_atomic\_\{compare\_swap, fetch\_inc, inc, fetch\_add, add\}} support
the ``standard \ac{AMO} types'' listed in Table~\ref{stdamotypes},
\item \FUNC{shmem\_atomic\_\{fetch, set, swap\}} support
the ``extended \ac{AMO} types'' listed in Table~\ref{extamotypes}, and
\item \FUNC{shmem\_atomic\_\{fetch\_and, and, fetch\_or, or, fetch\_xor, xor\}}
support the ``bitwise \ac{AMO} types'' listed in Table~\ref{bitamotypes}.
\end{itemize}
The standard and extended \ac{AMO} types include some of the exact-width
integer types defined in \HEADER{stdint.h} by \Cstd[99]~\S7.18.1.1 and
\Cstd[11]~\S7.20.1.1. When the \Cstd translation environment
does not provide exact-width integer types with \HEADER{stdint.h}, an
\openshmem implemementation is not required to provide support for these types.
\begin{table}[h]
\begin{center}
\begin{tabular}{|l|l|}
\hline
\TYPE & \TYPENAME \\ \hline
int & int \\ \hline
long & long \\ \hline
long long & longlong \\ \hline
unsigned int & uint \\ \hline
unsigned long & ulong \\ \hline
unsigned long long & ulonglong \\ \hline
int32\_t & int32 \\ \hline
int64\_t & int64 \\ \hline
uint32\_t & uint32 \\ \hline
uint64\_t & uint64 \\ \hline
size\_t & size \\ \hline
ptrdiff\_t & ptrdiff \\ \hline
\end{tabular}
\caption{Standard \ac{AMO} Types and Names}
\label{stdamotypes}
\end{center}
\end{table}
\begin{table}[h]
\begin{center}
\begin{tabular}{|l|l|}
\hline
\TYPE & \TYPENAME \\ \hline
float & float \\ \hline
double & double \\ \hline
int & int \\ \hline
long & long \\ \hline
long long & longlong \\ \hline
unsigned int & uint \\ \hline
unsigned long & ulong \\ \hline
unsigned long long & ulonglong \\ \hline
int32\_t & int32 \\ \hline
int64\_t & int64 \\ \hline
uint32\_t & uint32 \\ \hline
uint64\_t & uint64 \\ \hline
size\_t & size \\ \hline
ptrdiff\_t & ptrdiff \\ \hline
\end{tabular}
\caption{Extended \ac{AMO} Types and Names}
\label{extamotypes}
\end{center}
\end{table}
\begin{table}[h]
\begin{center}
\begin{tabular}{|l|l|}
\hline
\TYPE & \TYPENAME \\ \hline
unsigned int & uint \\ \hline
unsigned long & ulong \\ \hline
unsigned long long & ulonglong \\ \hline
int32\_t & int32 \\ \hline
int64\_t & int64 \\ \hline
uint32\_t & uint32 \\ \hline
uint64\_t & uint64 \\ \hline
\end{tabular}
\caption{Bitwise \ac{AMO} Types and Names}
\label{bitamotypes}
\end{center}
\end{table}