-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhamr_host_copy.h
40 lines (33 loc) · 1.09 KB
/
hamr_host_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
#ifndef hamr_host_copy_h
#define hamr_host_copy_h
#include "hamr_config.h"
#include <memory>
#include <type_traits>
/// heterogeneous accelerator memory resource
namespace hamr
{
/** Copies an array on the host.
*
* @param[in] dest an array of n elements accessible on the host
* @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_host(T *dest, const U *src, size_t n_elem);
/** Copies an array on the host (fast path for arrays of arithmetic types of the
* same type).
*
* @param[in] dest an array of n elements accessible in CUDA
* @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>
int copy_to_host_from_host(T *dest, const T *src, size_t n_elem,
typename std::enable_if<std::is_arithmetic<T>::value>::type * = nullptr);
}
#if !defined(HAMR_SEPARATE_IMPL)
#include "hamr_host_copy_impl.h"
#endif
#endif