-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhamr_openmp_copy.h
164 lines (148 loc) · 6.01 KB
/
hamr_openmp_copy.h
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
#ifndef hamr_openmp_copy_h
#define hamr_openmp_copy_h
#include "hamr_config.h"
#include "hamr_copier_traits.h"
#include <stddef.h>
/// heterogeneous accelerator memory resource
namespace hamr
{
#if !defined(HAMR_ENABLE_OBJECTS)
/** Copies an array to the active OpenMP device.
*
* @param[in] dest an array of n elements accessible in OpenMP
* @param[in] src an array of n elements accessible on the host
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_openmp_from_host(T *dest, const U *src, size_t n_elem,
hamr::use_object_copier_t<T,U> * = nullptr);
#endif
/** Copies an array to the active OpenMP device (fast path for arrays of
* arithmetic types of the same type).
*
* @param[in] dest an array of n elements accessible in OpenMP
* @param[in] src an array of n elements accessible on the host
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_openmp_from_host(T *dest, const U *src, size_t n_elem,
hamr::use_bytes_copier_t<T,U> * = nullptr);
/** Copies an array to the active OpenMP device.
*
* @param[in] dest an array of n elements accessible in OpenMP
* @param[in] src an array of n elements accessible on the host
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_openmp_from_host(T *dest, const U *src, size_t n_elem,
hamr::use_cons_copier_t<T,U> * = nullptr);
#if !defined(HAMR_ENABLE_OBJECTS)
/** Copies an array on the active OpenMP device.
*
* @param[in] dest an array of n elements accessible in OpenMP
* @param[in] src an array of n elements accessible in OpenMP
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_openmp_from_openmp(T *dest, const U *src, size_t n_elem,
hamr::use_object_copier_t<T,U> * = nullptr);
#endif
/** Copies an array on the active OpenMP device (fast path for arrays of
* arithmetic types of the same type).
*
* @param[in] dest an array of n elements accessible in OpenMP
* @param[in] src an array of n elements accessible on the host
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_openmp_from_openmp(T *dest, const U *src, size_t n_elem,
hamr::use_bytes_copier_t<T,U> * = nullptr);
/** Copies an array on the active OpenMP device.
*
* @param[in] dest an array of n elements accessible in OpenMP
* @param[in] src an array of n elements accessible in OpenMP
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_openmp_from_openmp(T *dest, const U *src, size_t n_elem,
hamr::use_cons_copier_t<T,U> * = nullptr);
#if !defined(HAMR_ENABLE_OBJECTS)
/** Copies an array to the active OpenMP device from the named OpenMP device,
*
* @param[in] dest an array of n elements accessible in OpenMP
* @param[in] src an array of n elements accessible in OpenMP
* @param[in] src_device the OpenMP device on which src is allocated
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_openmp_from_openmp(T *dest, const U *src, int src_device, size_t n_elem,
hamr::use_object_copier_t<T,U> * = nullptr);
#endif
/** Copies an array to the active OpenMP device from the named OpenMP device,
* (fast path for arrays of arithmetic types of the same type).
*
* @param[in] dest an array of n elements accessible in OpenMP
* @param[in] src an array of n elements accessible in OpenMP
* @param[in] src_device the OpenMP device on which src is allocated
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_openmp_from_openmp(T *dest, const U *src, int src_device, size_t n_elem,
hamr::use_bytes_copier_t<T,U> * = nullptr);
/** Copies an array on the active OpenMP device.
*
* @param[in] dest an array of n elements accessible in OpenMP
* @param[in] src an array of n elements accessible in OpenMP
* @param[in] src_device the OpenMP device on which src is allocated
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_openmp_from_openmp(T *dest, const U *src, int src_device, size_t n_elem,
hamr::use_cons_copier_t<T,U> * = nullptr);
#if !defined(HAMR_ENABLE_OBJECTS)
/** Copies an array from the active OpenMP device.
*
* @param[in] dest an array of n elements accessible on the host
* @param[in] src an array of n elements accessible in OpenMP
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_host_from_openmp(T *dest, const U *src, size_t n_elem,
hamr::use_object_copier_t<T,U> * = nullptr);
#endif
/** Copies an array from the active OpenMP device (fast path for arrays of
* arithmetic types of the same type).
*
* @param[in] dest an array of n elements accessible in OpenMP
* @param[in] src an array of n elements accessible on the host
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_host_from_openmp(T *dest, const U *src, size_t n_elem,
hamr::use_bytes_copier_t<T,U> * = nullptr);
/** Copies an array from the active OpenMP device.
*
* @param[in] dest an array of n elements accessible on the host
* @param[in] src an array of n elements accessible in OpenMP
* @param[in] n_elem the number of elements in the array
* @returns 0 if there were no errors
*/
template <typename T, typename U>
int copy_to_host_from_openmp(T *dest, const U *src, size_t n_elem,
hamr::use_cons_copier_t<T,U> * = nullptr);
}
#if !defined(HAMR_SEPARATE_IMPL)
#include "hamr_openmp_copy_impl.h"
#endif
#endif