27 :
data_mgr_(data_mgr), device_id_(device_id), cuda_stream_(cuda_stream) {
32 cuda_mgr->setContext(device_id);
45 const size_t num_bytes,
46 const int device_id) {
72 const size_t num_bytes)
const {
75 cuda_mgr->copyHostToDevice(
80 const void* device_src,
81 const size_t num_bytes)
const {
84 cuda_mgr->copyDeviceToHost(
85 (int8_t*)host_dst, (int8_t*)device_src, num_bytes,
cuda_stream_);
96 const size_t num_bytes)
const {
CudaMgr_Namespace::CudaMgr * getCudaMgr() const
void zeroDeviceMem(int8_t *device_ptr, const size_t num_bytes) const override
CudaAllocator(Data_Namespace::DataMgr *data_mgr, const int device_id, CUstream cuda_stream)
Data_Namespace::DataMgr * data_mgr_
An AbstractBuffer is a unit of data management for a data manager.
void free(Data_Namespace::AbstractBuffer *ab) const override
void copyToDevice(void *device_dst, const void *host_src, const size_t num_bytes) const override
int8_t * alloc(const size_t num_bytes) override
std::vector< Data_Namespace::AbstractBuffer * > owned_buffers_
static void freeGpuAbstractBuffer(Data_Namespace::DataMgr *data_mgr, Data_Namespace::AbstractBuffer *ab)
void setDeviceMem(int8_t *device_ptr, unsigned char uc, const size_t num_bytes) const override
~CudaAllocator() override
static Data_Namespace::AbstractBuffer * allocGpuAbstractBuffer(Data_Namespace::DataMgr *data_mgr, const size_t num_bytes, const int device_id)
Allocate GPU memory using GpuBuffers via DataMgr.
void free(AbstractBuffer *buffer)
void copyFromDevice(void *host_dst, const void *device_src, const size_t num_bytes) const override
AbstractBuffer * alloc(const MemoryLevel memoryLevel, const int deviceId, const size_t numBytes)