ThunderSVM
ThunderSVM: An Open-Source SVM Library on GPUs and CPUs
Public Types | Public Member Functions | List of all members
thunder::SyncMem Class Reference

Auto-synced memory for CPU and GPU. More...

#include <syncmem.h>

Public Types

enum  HEAD { HOST, DEVICE, UNINITIALIZED }
 to determine the where the newest data locates in
 

Public Member Functions

 SyncMem (size_t size)
 
void * host_data ()
 return raw host pointer
 
void * device_data ()
 return raw device pointer
 
void set_host_data (void *data)
 
void set_device_data (void *data)
 
void to_host ()
 transfer data to host
 
void to_device ()
 transfer data to device
 
size_t size () const
 return the size of memory
 
HEAD head () const
 

Detailed Description

Auto-synced memory for CPU and GPU.

Constructor & Destructor Documentation

◆ SyncMem()

thunder::SyncMem::SyncMem ( size_t  size)
explicit

create a piece of synced memory with given size. The GPU/CPU memory will not be allocated immediately, but allocated when it is used at first time.

Parameters
sizethe size of memory (in Bytes)

Member Function Documentation

◆ set_device_data()

void thunder::SyncMem::set_device_data ( void *  data)

set device data pointer to another device pointer, and its memory will not be managed by this class

Parameters
dataanother device pointer

◆ set_host_data()

void thunder::SyncMem::set_host_data ( void *  data)

set host data pointer to another host pointer, and its memory will not be managed by this class

Parameters
dataanother host pointer

The documentation for this class was generated from the following files: