Bolt
1.1
C++ template library with support for OpenCL
|
#include <control.h>
Classes | |
struct | debug |
Public Types | |
enum | e_UseHostMode { NoUseHost, UseHost } |
enum | e_RunMode { Automatic, SerialCpu, MultiCoreCpu, OpenCL } |
enum | e_AutoTuneMode { NoAutoTune =0x0, AutoTuneDevice =0x1, AutoTuneWorkShape =0x2, AutoTuneAll =0x3 } |
enum | e_WaitMode { BalancedWait, NiceWait, BusyWait, ClFinish } |
typedef boost::shared_ptr < ::cl::Buffer > | buffPointer |
Buffer pool support functions. | |
Public Member Functions | |
control (const ::cl::CommandQueue &commandQueue=getDefault().getCommandQueue(), e_UseHostMode useHost=getDefault().getUseHost(), unsigned debug=getDefault().getDebugMode()) | |
control (const control &ref) | |
void | setCommandQueue (::cl::CommandQueue commandQueue) |
void | setUseHost (e_UseHostMode useHost) |
void | setForceRunMode (e_RunMode forceRunMode) |
void | setDebugMode (unsigned debug) |
void | setWGPerComputeUnit (int wgPerComputeUnit) |
void | setWaitMode (e_WaitMode waitMode) |
void | setUnroll (int unroll) |
void | setCompileOptions (std::string &compileOptions) |
::cl::CommandQueue & | getCommandQueue () |
const ::cl::CommandQueue & | getCommandQueue () const |
::cl::Context | getContext () const |
::cl::Device | getDevice () const |
e_UseHostMode | getUseHost () const |
e_RunMode | getForceRunMode () const |
e_RunMode | getDefaultPathToRun () const |
unsigned | getDebugMode () const |
int const | getWGPerComputeUnit () const |
const ::std::string | getCompileOptions () const |
e_WaitMode | getWaitMode () const |
int | getUnroll () const |
bool | getCompileForAllDevices () const |
size_t | totalBufferSize () |
buffPointer | acquireBuffer (size_t reqSize, cl_mem_flags flags=CL_MEM_READ_WRITE, const void *host_ptr=NULL) |
void | freeBuffers () |
Static Public Member Functions | |
static control & | getDefault () |
static void | printPlatforms (bool printDevices=true, cl_device_type deviceType=CL_DEVICE_TYPE_ALL) |
static void | printPlatformsRange (std::vector< ::cl::Platform >::iterator begin, std::vector< ::cl::Platform >::iterator end, bool printDevices=true, cl_device_type deviceType=CL_DEVICE_TYPE_ALL) |
::cl::CommandQueue | getDefaultCommandQueue () |
Convenience method to help users create and initialize an OpenCL CommandQueue. | |
Friends | |
class | UnlockBuffer |
The control
class lets you control the parameters of a specific Bolt algorithm call, such as the command-queue where GPU kernels run, debug information, load-balancing with the host, and more. Each Bolt Algorithm call accepts the control
class as an optional first argument. Additionally, Bolt contains a global default control
structure that is used in cases where the control
argument is not specified; also, developers can modify this structure. Some examples:
Developers also can inialize and save control structures to avoid the cost of copying the default on each function call. An example:
Sometimes, it can be useful to set the global default control
structure used by Bolt algorithms calls that do not explicitly specify a control parameter as the first argument. For example, the application initialization routine can examine all the available GPU devices and select the one to be used for all subsequent Bolt calls. This can be done by writing the global default control
structure, i.e.: