1 #ifndef HeterogeneousCore_CUDAUtilities_HostAllocator_h
2 #define HeterogeneousCore_CUDAUtilities_HostAllocator_h
6 #include <cuda_runtime.h>
23 template <
typename T,
unsigned int FLAGS = cudaHostAllocDefault>
36 cudaError_t
status = cudaMallocHost(&ptr,
n *
sizeof(
T), FLAGS);
37 if (status != cudaSuccess) {
41 throw std::bad_alloc();
43 return static_cast<T*
>(ptr);
47 cudaError_t
status = cudaFreeHost(p);
48 if (status != cudaSuccess) {
57 #endif // HeterogeneousCore_CUDAUtilities_HostAllocator_h
T * allocate(std::size_t n) const __attribute__((warn_unused_result)) __attribute__((malloc)) __attribute__((returns_nonnull))
void deallocate(T *p, std::size_t n) const
__attribute__((always_inline)) void countFromVector(Histo *__restrict__ h
const char * what() const noexceptoverride
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t Func __host__ __device__ V int n
bad_alloc(cudaError_t error) noexcept