BehaveRT::DeviceInterface Class Reference

Interface between c++ classes and CUDA kernels. More...

List of all members.

Public Member Functions

 DeviceInterface ()
 Default constructor: intialize the CUDA enviroment and fill the DataInfo structure.
void cudaInit (int argc, char **argv)
 Initialize the CUDA environment.
void allocateArray (void **devPtr, int size)
 Allocate devPtr on device.
void freeArray (void *devPtr)
 Deallocate devPtr on device.
void threadSync ()
 Syncronize the device threads.
void copyArrayFromDevice (void *host, const void *device, unsigned int vbo, int offset, int size)
void copyArrayToDeviceVbo (unsigned int vbo, const void *host, int offset, int size)
void copyArrayToDevice (void *device, const void *host, int offset, int size)
void copyConstantToDevice (void *device, void *host, int size)
void resetArray (void *deviceData, char value, int size)
void registerGLBufferObject (unsigned int vbo)
void unregisterGLBufferObject (unsigned int vbo)
void mapGLBufferObject (void *device, unsigned int vbo)
void unmapGLBufferObject (unsigned int vbo)
void copySimParamsToDevice ()
unsigned int createVBO (unsigned int size)
void deleteVBO (unsigned int vbo)
void kernelCall (int totalThreadNum, genericKernelFuncPointer kernelRef, kernelBoundaryFuncPointer beforeKernelRef=NULL, kernelBoundaryFuncPointer afterKenelRef=NULL)
void kernelCall (int totalThreadNum, int blockSize, genericKernelFuncPointer kernelRef, kernelBoundaryFuncPointer beforeKernelRef=NULL, kernelBoundaryFuncPointer afterKenelRef=NULL)
void DeviceInterface::kernelCallUsingFields (int *fieldList, int fieldListSize, int totalThreadNum, int blockSize, genericKernelFuncPointer kernelRef, kernelBoundaryFuncPointer beforeKernelRef=NULL, kernelBoundaryFuncPointer afterKenelRef=NULL)
DeviceInfo getDeviceInfo ()
SimParamsgetHostSimParams ()
DataInfogetDeviceDataRepository ()
DataInfogetDeviceData (unsigned int index)
DataInfogetLastDeviceData ()
void incrementDataRepositorySize ()
 Augments the DeviceDataRepository size.
unsigned int getDeviceDataRepositorySize ()


Detailed Description

Interface between c++ classes and CUDA kernels.

Member Function Documentation

void BehaveRT::DeviceInterface::copyArrayFromDevice ( void *  host,
const void *  device,
unsigned int  vbo,
int  offset,
int  size 
)

Copy data from device global memory.

Parameters:
host destination
device source
vbo if != 0, the source is the device memory region referenced by the OpenGL VBO (Vertex Buffer Object)
offset reading start point
size number of bytes to copy

void BehaveRT::DeviceInterface::copyArrayToDevice ( void *  device,
const void *  host,
int  offset,
int  size 
)

Copy data to device global memory.

Parameters:
device destination
host source
offset reading start point
size number of bytes to copy

void BehaveRT::DeviceInterface::copyArrayToDeviceVbo ( unsigned int  vbo,
const void *  host,
int  offset,
int  size 
)

Copy data to device global memory (using OpenGL VBO).

Parameters:
vbo destination: device memory region referenced by the VBO (Vertex Buffer Object)
host source
offset reading start point
size number of bytes to copy

void BehaveRT::DeviceInterface::copyConstantToDevice ( void *  device,
void *  host,
int  size 
)

Copy data to device costant memory.

Parameters:
device destination
host source
offset reading start point
size number of bytes to copy

void BehaveRT::DeviceInterface::copySimParamsToDevice (  ) 

Copy both the hostSimParams and the DeviceDataRepository to the device constant memory

uint BehaveRT::DeviceInterface::createVBO ( unsigned int  size  ) 

Allocate a region of the device global memory on OpenGL VBO (Vertex Buffer Object)

Parameters:
size allocation size

void BehaveRT::DeviceInterface::deleteVBO ( unsigned int  vbo  ) 

Deallocate the region of the device global memory associated to an OpenGL VBO (Vertex Buffer Object)

Parameters:
vbo Vertex Buffer Object index

void BehaveRT::DeviceInterface::DeviceInterface::kernelCallUsingFields ( int *  fieldList,
int  fieldListSize,
int  totalThreadNum,
int  blockSize,
genericKernelFuncPointer  kernelRef,
kernelBoundaryFuncPointer  beforeKernelRef = NULL,
kernelBoundaryFuncPointer  afterKenelRef = NULL 
)

Generic CUDA kernel call. The parameter blockSize is set to the defualt value. This function map and unmap the data referenced by the DeviceDataRepository.

Parameters:
fieldList array of indexes of the DeviceDataRepository to map/unmap
fieldListSize the size of the array fieldList
totalThreadNum number of threads you have to launch
blockSize dimension of the CUDA block. The GPU will launch exaclty totalThreadNum/blockSize blocks.
kernelRef reference (function pointer) to the kernel you have to execute
beforeKernelRef reference (function pointer) to the function you have to execute immediatly before the kernel
afterKenelRef reference (function pointer) to function you have to execute immediatly after the kernel

DataInfo* BehaveRT::DeviceInterface::getDeviceData ( unsigned int  index  )  [inline]

Returns:
an element of the DeviceDataRepository
Parameters:
index element index

DataInfo* BehaveRT::DeviceInterface::getDeviceDataRepository (  )  [inline]

Returns:
a reference to the DeviceDataRepository

unsigned int BehaveRT::DeviceInterface::getDeviceDataRepositorySize (  )  [inline]

Returns:
DeviceDataRepository size

DeviceInfo BehaveRT::DeviceInterface::getDeviceInfo (  )  [inline]

Returns:
device information

SimParams& BehaveRT::DeviceInterface::getHostSimParams (  )  [inline]

Returns:
simulation parameters

DataInfo* BehaveRT::DeviceInterface::getLastDeviceData (  )  [inline]

Returns:
the last inserted element into the DeviceDataRepository

void BehaveRT::DeviceInterface::kernelCall ( int  totalThreadNum,
int  blockSize,
genericKernelFuncPointer  kernelRef,
kernelBoundaryFuncPointer  beforeKernelRef = NULL,
kernelBoundaryFuncPointer  afterKenelRef = NULL 
)

Generic CUDA kernel call. The parameter blockSize is set to the defualt value. This function map and unmap the data referenced by the DeviceDataRepository.

Parameters:
totalThreadNum number of threads you have to launch
blockSize dimension of the CUDA block. The GPU will launch exaclty totalThreadNum/blockSize blocks.
kernelRef reference (function pointer) to the kernel you have to execute
beforeKernelRef reference (function pointer) to the function you have to execute immediatly before the kernel
afterKenelRef reference (function pointer) to function you have to execute immediatly after the kernel

void BehaveRT::DeviceInterface::kernelCall ( int  totalThreadNum,
genericKernelFuncPointer  kernelRef,
kernelBoundaryFuncPointer  beforeKernelRef = NULL,
kernelBoundaryFuncPointer  afterKenelRef = NULL 
)

Generic CUDA kernel call. The parameter blockSize is set to the defualt value. This function map and unmap the data referenced by the DeviceDataRepository.

Parameters:
totalThreadNum number of threads you have to launch
kernelRef reference (function pointer) to the kernel you have to execute
beforeKernelRef reference (function pointer) to the function you have to execute immediatly before the kernel
afterKenelRef reference (function pointer) to function you have to execute immediatly after the kernel

void BehaveRT::DeviceInterface::mapGLBufferObject ( void *  device,
unsigned int  vbo 
)

Creates an association between an OpenGL VBO (Vertex Buffer Object) and an array on device global memory

Parameters:
device destination
vbo Vertex Buffer Object index

void BehaveRT::DeviceInterface::registerGLBufferObject ( unsigned int  vbo  ) 

Initializes the OpenGL VBO (Vertex Buffer Object) memory region on device

Parameters:
vbo Vertex Buffer Object index

void BehaveRT::DeviceInterface::resetArray ( void *  deviceData,
char  value,
int  size 
)

Initialize an array on device global memory

Parameters:
deviceData array reference
value constant valut to put into the array
size number of bytes to write

void BehaveRT::DeviceInterface::unmapGLBufferObject ( unsigned int  vbo  ) 

Deletes an association between an OpenGL VBO (Vertex Buffer Object) and an array on device global memory

Parameters:
vbo Vertex Buffer Object index

void BehaveRT::DeviceInterface::unregisterGLBufferObject ( unsigned int  vbo  ) 

Finalizes the OpenGL VBO (Vertex Buffer Object) memory region on device

Parameters:
vbo Vertex Buffer Object index


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

Generated on Mon Oct 19 13:19:44 2009 for BehaveRT by  doxygen 1.5.7.1