yacx-YetAnotherCudaExecutor  0.6.2
wrapper to easily compile and execute cuda kernels
Public Member Functions | Protected Attributes | Friends | List of all members
yacx::KernelArg Class Reference
Inheritance diagram for yacx::KernelArg:
yacx::JNIHandle yacx::KernelArgMatrixPadding

Public Member Functions

 KernelArg (void *data, size_t size, bool download=false, bool copy=true, bool upload=true)
 A constructor. More...
 
 KernelArg (void *data)
 
const void * content () const
 
CUdeviceptr deviceptr ()
 
void malloc ()
 mallocs data on device
 
void uploadAsync (CUstream stream)
 
void downloadAsync (CUstream stream)
 
void downloadAsync (void *hdata, CUstream stream)
 
void free ()
 frees allocated data on device
 
size_t size () const
 
bool isDownload () const
 
void setDownload (bool download)
 
bool isCopy () const
 
void setCopy (bool copy)
 

Protected Attributes

const void * m_hdata
 
CUdeviceptr m_ddata
 
std::shared_ptr< detail::DataCopym_dataCopy
 

Friends

class KernelArgs
 

Detailed Description

Examples
docs/kernel_args.cpp, docs/kernel_launch.cpp, example_gauss.cpp, example_matrix_multiply.cpp, example_program.cpp, example_saxpy.cpp, and example_template.cpp.

Constructor & Destructor Documentation

◆ KernelArg() [1/2]

KernelArg::KernelArg ( void *  data,
size_t  size,
bool  download = false,
bool  copy = true,
bool  upload = true 
)

A constructor.

Parameters
datapointer to argument for kernel function
sizesize of argument in bytes
downloadcopy the results from device to host after kernel execution
copycopy the results to the device
uploadallocate the argument on the device (not necessary for basic types, e.g. int)

◆ KernelArg() [2/2]

yacx::KernelArg::KernelArg ( void *  data)
inlineexplicit

A constructor for basic types, e.g. int

Parameters
datapointer to argument for kernel function

Member Function Documentation

◆ content()

const void * KernelArg::content ( ) const
Returns
pointer to host data

◆ deviceptr()

CUdeviceptr yacx::KernelArg::deviceptr ( )
inline
Returns
pointer to device data

◆ downloadAsync() [1/2]

void yacx::KernelArg::downloadAsync ( CUstream  stream)
inline

downloads data to host

Parameters
streamto enqueue operations

◆ downloadAsync() [2/2]

void KernelArg::downloadAsync ( void *  hdata,
CUstream  stream 
)

downloads data to host

Parameters
hdatapointer to host memory for the downloaded data
streamto enqueue operations

◆ uploadAsync()

void KernelArg::uploadAsync ( CUstream  stream)

uploads data to device

Parameters
streamto enqueue operations

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