Merge trunk version 204345 into gupc branch.
[official-gcc.git] / libgupc / smp / upc_nb.upc
blob44d43d381c53ee437b50955a078c289444ed6eb1
1 /* Copyright (C) 2013 Free Software Foundation, Inc.
2    This file is part of the UPC runtime Library.
3    Written by Gary Funck <gary@intrepid.com>
4    and Nenad Vukicevic <nenad@intrepid.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
25 <http://www.gnu.org/licenses/>.  */
27 #include <upc.h>
28 #include <upc_nb.h>
30 /**
31  * Copy memory with non-blocking explicit handle transfer.
32  *
33  * @param[in] dst Destination shared memory pointer
34  * @param[in] src Source shared memory pointer
35  * @param[in] n Number of bytes to transfer
36  * @retval UPC non-blocking transfer handle
37  */
38 upc_handle_t
39 upc_memcpy_nb (shared void *restrict dst,
40                shared const void *restrict src, size_t n)
42   upc_memcpy (dst, src, n);
43   return UPC_COMPLETE_HANDLE;
46 /**
47  * Get memory with non-blocking explicit handle transfer.
48  *
49  * @param[in] dst Destination local memory pointer
50  * @param[in] src Source remote memory pointer
51  * @param[in] n Number of bytes to transfer
52  * @retval UPC non-blocking transfer handle
53  */
54 upc_handle_t
55 upc_memget_nb (void *restrict dst,
56                shared const void *restrict src, size_t n)
58   upc_memget (dst, src, n);
59   return UPC_COMPLETE_HANDLE;
62 /**
63  * Put memory with non-blocking explicit handle transfer.
64  *
65  * @param[in] dst Destination remote memory pointer
66  * @param[in] src Source local memory pointer
67  * @param[in] n Number of bytes to transfer
68  * @retval UPC non-blocking transfer handle
69  */
70 upc_handle_t
71 upc_memput_nb (shared void *restrict dst,
72                const void *restrict src, size_t n)
74   upc_memput (dst, src, n);
75   return UPC_COMPLETE_HANDLE;
78 /**
79  * Set memory with non-blocking implicit handle transfer.
80  *
81  * @param[in] dst Shared remote pointer
82  * @param[in] c Value for set operation
83  * @param[in] n Number of bytes to set
84  * @retval UPC non-blocking transfer handle
85  */
86 upc_handle_t
87 upc_memset_nb (shared void *dst, int c, size_t n)
89   upc_memset (dst, c, n);
90   return UPC_COMPLETE_HANDLE;
93 /**
94  * Explicit handle non-blocking transfer sync attempt.
95  *
96  * @param[in] handle Transfer explicit handle
97  * @retval UPC_NB_COMPLETED returned if transfer completed,
98  *         otherwise UPC_NB_NOT_COMPLETED
99  */
101 upc_sync_attempt (upc_handle_t ARG_UNUSED(handle))
103   return UPC_NB_COMPLETED;
107  * Explicit handle non-blocking transfer sync.
109  * @param[in] handle Non-blocking transfer explicit handle
110  */
111 void
112 upc_sync (upc_handle_t ARG_UNUSED(handle))
117  * Copy memory with non-blocking implicit handle transfer.
119  * @param[in] dst Shared remote memory pointer
120  * @param[in] src Shared remote memory pointer
121  * @param[in] n Number of bytes to transfer
122  */
123 void
124 upc_memcpy_nbi (shared void *restrict dst,
125                 shared const void *restrict src, size_t n)
127   upc_memcpy (dst, src, n);
131  * Get memory with non-blocking implicit handle transfer.
133  * @param[in] dst Local memory pointer
134  * @param[in] src Shared remote memory pointer
135  * @param[in] n Number of bytes to transfer
136  */
137 void
138 upc_memget_nbi (void *restrict dst,
139                 shared const void *restrict src, size_t n)
141   upc_memget (dst, src, n);
145  * Put memory with non-blocking implicit handle transfer.
147  * @param[in] dst Shared remote memory pointer
148  * @param[in] src Local memory pointer
149  * @param[in] n Number of bytes to transfer
150  */
151 void
152 upc_memput_nbi (shared void *restrict dst,
153                 const void *restrict src, size_t n)
155   upc_memput (dst, src, n);
159  * Set memory with non-blocking implicit handle transfer.
161  * @param[in] dst Shared remote pointer
162  * @param[in] c Value for set operation
163  * @param[in] n Number of bytes to set
164  */
165 void
166 upc_memset_nbi (shared void *dst, int c, size_t n)
168   upc_memset (dst, c, n);
172  * Check on implicit handle non-blocking transfers.
174  * @retval UPC_NB_COMPLETED if no transfers pending, otherwise
175  *         UPC_NB_NOT_COMPLETED is returned
176  */
178 upc_synci_attempt (void)
180   return UPC_NB_COMPLETED;
184  * Complete implicit handle non-blocking transfers.
185  */
186 void
187 upc_synci (void)