1 #ifndef hamr_cuda_malloc_allocator_h
2 #define hamr_cuda_malloc_allocator_h
4 #include "hamr_config.h"
13 template <
typename T,
typename E =
void>
18 class HAMR_EXPORT
cuda_malloc_deleter<T, typename std::enable_if<!std::is_arithmetic<T>::value>::type>
31 void operator()(T *ptr);
58 void operator()(T *ptr);
73 template <
typename T,
typename E =
void>
90 static std::shared_ptr<T> allocate(
size_t n) HAMR_EXPORT;
98 static std::shared_ptr<T> allocate(
size_t n,
const T &val) HAMR_EXPORT;
108 template <
typename U>
109 static std::shared_ptr<T> allocate(
size_t n,
const U *vals,
bool cudaVals =
false) HAMR_EXPORT;
125 static std::shared_ptr<T> allocate(cudaStream_t str,
size_t n) HAMR_EXPORT;
135 static std::shared_ptr<T> allocate(cudaStream_t str,
size_t n,
const T &val) HAMR_EXPORT;
147 template <
typename U>
148 static std::shared_ptr<T> allocate(cudaStream_t str,
size_t n,
const U *vals,
bool cudaVals =
false) HAMR_EXPORT;
160 template <
typename T>
170 static std::shared_ptr<T> allocate(
size_t n) HAMR_EXPORT;
178 static std::shared_ptr<T> allocate(
size_t n,
const T &val) HAMR_EXPORT;
188 template <
typename U>
189 static std::shared_ptr<T> allocate(
size_t n,
const U *vals,
bool cudaVals =
false) HAMR_EXPORT;
205 static std::shared_ptr<T> allocate(cudaStream_t str,
size_t n) HAMR_EXPORT;
215 static std::shared_ptr<T> allocate(cudaStream_t str,
size_t n,
const T &val) HAMR_EXPORT;
227 template <
typename U>
228 static std::shared_ptr<T> allocate(cudaStream_t str,
size_t n,
const U *vals,
bool cudaVals =
false) HAMR_EXPORT;
233 #if !defined(HAMR_SEPARATE_IMPL)
234 #include "hamr_cuda_malloc_allocator_impl.h"