ViennaCL - The Vienna Computing Library  1.5.0
Namespaces | Data Structures | Enumerations | Functions
viennacl::ocl Namespace Reference

OpenCL backend. Manages platforms, contexts, buffers, kernels, etc. More...

Namespaces

namespace  detail
 

Implementation details for the OpenCL managment layer in ViennaCL.


Data Structures

class  backend
 A backend that provides contexts for ViennaCL objects (vector, matrix, etc.) More...
class  command_queue
 A class representing a command queue. More...
class  context
 Manages an OpenCL context and provides the respective convenience functions for creating buffers, etc. More...
class  device
 A class representing a compute device (e.g. a GPU) More...
class  device_not_found
 Exception thrown in the case that a requested compute device was not found. More...
class  device_not_available
 Exception thrown if the selected compute device is not available (maybe locked by another process). More...
class  compiler_not_available
 Exception thrown if the OpenCL just-in-time compiler is not available. More...
class  mem_object_allocation_failure
 Exception thrown if a memory object cannot be allocated. Usually the requested memory buffer is simply too large. More...
class  out_of_resources
 Exception thrown if the compute device is out of resources (either global memory, registers, etc.) for the requested operation. More...
class  out_of_host_memory
 Exception thrown if the host cannot provide enough memory for the datastructures in the OpenCL backend (temporary arrays, etc.) to perform the requested operation. More...
class  profiling_info_not_available
 Exception thrown if the OpenCL context does not have CL_QUEUE_PROFILING_ENABLE set, if the execution is not complete, or the event object is a user event object. More...
class  mem_copy_overlap
 Exception thrown if the source buffer overlaps the destination buffer when copying from device memory to device memory. More...
class  image_format_mismatch
 Exception thrown if there is a mismatch in image formats for the operands. More...
class  image_format_not_supported
 Exception thrown if the requested image format is not supported. More...
class  build_program_failure
 Exception thrown if the OpenCL program cannot be built, usually due to a syntax error in the OpenCL code. More...
class  map_failure
 Exception thrown if the mapping of device memory to the host memory space failed. More...
class  invalid_value
 Exception thrown is an invalid value is provided to an OpenCL function. More...
class  invalid_device_type
 Exception thrown if an invalid device type is specified. More...
class  invalid_platform
 Exception thrown if an invalid OpenCL platform is provided to an OpenCL function. More...
class  invalid_device
 Exception thrown if an invalid OpenCL device is provided to an OpenCL function. More...
class  invalid_context
 Exception thrown if an invalid OpenCL context is provided to an OpenCL function. More...
class  invalid_queue_properties
 Exception thrown if invalid OpenCL command queue properties are provided when creating a command queue. More...
class  invalid_command_queue
 Exception thrown if an invalid OpenCL command queue is provided to an OpenCL function. More...
class  invalid_host_ptr
 Exception thrown if the provided pointer to host memory is invalid. More...
class  invalid_mem_object
 Exception thrown if an invalid OpenCL memory object (of type cl_mem) is passed to an OpenCL funciton. More...
class  invalid_image_format_descriptor
 Exception thrown if an invalid image format descriptor is provided. More...
class  invalid_image_size
 Exception thrown if the image size provided is invalid (e.g. zero). More...
class  invalid_sampler
 Exception thrown if an invalid sampler is provided for an image. More...
class  invalid_binary
 Exception thrown if the OpenCL binary (generated from the jit-compiler or loaded from some other location) won't work on the device (e.g. due to a lack of double precision support). More...
class  invalid_build_options
 Exception thrown if invalid build options are passed to the OpenCL just-in-time compiler. More...
class  invalid_program
 Exception thrown if an OpenCL program object handle is invalid (e.g. not initialized). More...
class  invalid_program_executable
 Exception thrown if there is no built program exectuable available for the device. More...
class  invalid_kernel_name
 Exception thrown if the provided kernel name is invalid (e.g. not part of the program provided). More...
class  invalid_kernel_definition
 Exception thrown if the kernel definition (number of arguments, argument types, etc.) is not the same for all devices for which the program has been built. More...
class  invalid_kernel
 Exception thrown if the provided kernel object (of type cl_kernel) is invalid (e.g. not initialized, from different context, or corrupted). More...
class  invalid_arg_index
 Exception thrown if the kernel argument index is invalid, e.g. an arg index larger than the number of kernel arguments was provided. More...
class  invalid_arg_value
 Exception thrown if the kernel argument provided has an invalid value. More...
class  invalid_arg_size
 Exception thrown if the arguments to an OpenCL kernel have an invalid size e.g. not sizeof(cl_mem)). More...
class  invalid_kernel_args
 Exception thrown if the kernel arguments are invalid and/or do not fit the kernel parameter list. More...
class  invalid_work_dimension
 Exception thrown if the work dimension is invalid (usually this means that the work dimension was set to be larger than three. More...
class  invalid_work_group_size
 Exception thrown if the number of work groups is invalid (usually this means that more than 256/512/768/1024 work groups have been specified, but the device(s) cannot support this. More...
class  invalid_work_item_size
 Exception thrown if the number of work items per work group invalid (usually this means that more than 256/512/768/1024 work items have been specified, but the device(s) cannot support this. More...
class  invalid_global_offset
 Exception thrown if the provided offset for get_global_id() in OpenCL kernels is invalid. More...
class  invalid_event_wait_list
 Exception thrown if the provided event wait list is invalid. More...
class  invalid_event
 Exception thrown if the provided event object (of type cl_event) is invalid. More...
class  invalid_operation
 Exception thrown if interoperability of OpenCL with other frameworks collide. More...
class  invalid_gl_object
 Exception thrown if the provided OpenGL (not OpenCL) object is invalid. More...
class  invalid_buffer_size
 Exception thrown if the provided buffer size is invalid (e.g. zero) More...
class  invalid_mip_level
 Exception thrown if the provided miplevel is greater than zero, but the OpenGL implementation does not support creating from non-zero mipmap levels. More...
class  invalid_global_work_size
 Exception thrown if the total number of work items is invalid (for example, not divisible by the number of work items per work group). More...
class  invalid_property
 Exception thrown if an invalid property is provided to a function (vague value). More...
class  unknown_error
 Exception thrown if the returned error cannot be resolved to some defined error constant. Might result from invalid sources, invalid memory operations, etc. More...
class  double_precision_not_provided_error
 Exception thrown if the user wants to use double precision arithmetics, but the device does not support double precision. More...
struct  error_checker
 An error reporting class. Template argument is used to avoid problems with external linkage. More...
struct  gpu_tag
 A tag identifying OpenCL devices as GPUs. More...
struct  cpu_tag
 A tag identifying OpenCL devices as CPUs. More...
struct  accelerator_tag
 A tag identifying OpenCL devices as accelerators (e.g. Intel Xeon Phi) More...
struct  default_tag
 A tag denoting the default OpenCL device type (SDK-specific) More...
class  handle_inc_dec_helper
 Helper for OpenCL reference counting used by class handle. More...
class  handle
 Handle class the effectively represents a smart pointer for OpenCL handles. More...
struct  packed_cl_uint
 Helper class for packing four cl_uint numbers into a uint4 type for access inside an OpenCL kernel. More...
class  kernel
 Represents an OpenCL kernel within ViennaCL. More...
class  local_mem
 A class representing local (shared) OpenCL memory. Typically used as kernel argument. More...
class  platform
 Wrapper class for an OpenCL platform. More...
class  program
 Wrapper class for an OpenCL program. More...
struct  DOUBLE_PRECISION_CHECKER
 Ensures that double precision types are only allocated if it is supported by the device. If double precision is requested for a device not capable of providing that, a double_precision_not_provided_error is thrown. More...

Enumerations

enum  device_architecture_family {
  Tesla, Fermi, Kepler, Evergreen,
  NorthernIslands, SouthernIslands, UNKNOWN
}

Functions

viennacl::ocl::contextcurrent_context ()
 Convenience function for returning the current context.
void switch_context (long i)
 Convenience function for switching the current context.
viennacl::ocl::contextget_context (long i)
 Convenience function for returning the current context.
void setup_context (long i, std::vector< cl_device_id > const &devices)
 Convenience function for setting devices for a context.
void setup_context (long i, viennacl::ocl::device const &device)
 Convenience function for setting devices for a context.
void setup_context (long i, cl_context c, std::vector< cl_device_id > const &devices, std::map< cl_device_id, std::vector< cl_command_queue > > const &queues)
 Convenience function for setting up a context in ViennaCL from an existing OpenCL context.
void setup_context (long i, cl_context c, std::vector< cl_device_id > const &devices, std::vector< cl_command_queue > const &queues)
 Convenience function for setting up a context in ViennaCL from an existing OpenCL context.
void setup_context (long i, cl_context c, cl_device_id d, cl_command_queue q)
 Convenience function for setting up a context in ViennaCL from an existing OpenCL context.
void set_context_device_type (long i, cl_device_type dev_type)
 Convenience function for setting the default device type for a context.
void set_context_device_type (long i, viennacl::ocl::gpu_tag)
 Convenience function for setting the default device type for a context to GPUs.
void set_context_device_type (long i, viennacl::ocl::cpu_tag)
 Convenience function for setting the default device type for a context to CPUs.
void set_context_device_type (long i, viennacl::ocl::default_tag)
 Convenience function for setting the default device type for a context to the default OpenCL device type.
void set_context_device_type (long i, viennacl::ocl::accelerator_tag)
 Convenience function for setting the default device type for a context to accelerators.
void set_context_device_num (long i, vcl_size_t num)
 Convenience function for setting the number of default devices per context.
void set_context_platform_index (long i, vcl_size_t pf_index)
 Convenience function for setting the platform index.
viennacl::ocl::command_queueget_queue ()
 Convenience function for getting the default queue for the currently active device in the active context.
viennacl::ocl::command_queueget_queue (viennacl::ocl::device d, unsigned int queue_id=0)
 Convenience function for getting the queue for a particular device in the current active context.
viennacl::ocl::command_queueget_queue (cl_device_id dev_id, unsigned int queue_id=0)
 Convenience function for getting the queue for a particular device in the current active context.
viennacl::ocl::kernelget_kernel (std::string const &prog_name, std::string const &kernel_name)
 Convenience function for getting the kernel for a particular program from the current active context.
void switch_device (viennacl::ocl::device &d)
 Convenience function for switching the active device in the current context.
viennacl::ocl::device const & current_device ()
 Convenience function for returning the active device in the current context.
template<typename KernelType >
void enqueue (KernelType &k, viennacl::ocl::command_queue const &queue)
 Enqueues a kernel in the provided queue.
template<typename KernelType >
void enqueue (KernelType &k)
 Convenience function that enqueues the provided kernel into the first queue of the currently active device in the currently active context.
void enqueue (viennacl::generator::custom_operation &op, viennacl::ocl::command_queue const &queue)
void enqueue (viennacl::generator::custom_operation &op)
template<cl_device_info param>
detail::return_type
< cl_device_id, param >
::Result 
info (cl_device_id const &handle)
template<cl_mem_info param>
detail::return_type< cl_mem,
param >::Result 
info (cl_mem const &handle)
template<cl_program_info param>
detail::return_type
< cl_program, param >::Result 
info (cl_program const &handle)
template<cl_context_info param>
detail::return_type
< cl_context, param >::Result 
info (cl_context const &handle)
template<class OCL_TYPE , typename detail::info< OCL_TYPE >::type param>
detail::return_type< OCL_TYPE,
param >::Result 
info (OCL_TYPE const &handle)
template<cl_kernel_info param>
detail::return_type< cl_kernel,
param >::Result 
info (viennacl::ocl::kernel &k)
 Queries information about a kernel.
template<cl_kernel_info param>
detail::return_type< cl_kernel,
param >::Result 
info (viennacl::ocl::kernel &k, viennacl::ocl::device const &d)
 Queries information about the execution of a kernel on a particular device.
std::vector< platformget_platforms ()
template<typename T >
void append_double_precision_pragma (viennacl::ocl::context const &, std::string &)
template<>
void append_double_precision_pragma< double > (viennacl::ocl::context const &ctx, std::string &source)

Detailed Description

OpenCL backend. Manages platforms, contexts, buffers, kernels, etc.


Enumeration Type Documentation

Enumerator:
Tesla 
Fermi 
Kepler 
Evergreen 
NorthernIslands 
SouthernIslands 
UNKNOWN 

Function Documentation

void viennacl::ocl::append_double_precision_pragma< double > ( viennacl::ocl::context const &  ctx,
std::string &  source 
) [inline]

Convenience function for returning the current context.

viennacl::ocl::device const & current_device ( ) [inline]

Convenience function for returning the active device in the current context.

void enqueue ( KernelType &  k,
viennacl::ocl::command_queue const &  queue 
)

Enqueues a kernel in the provided queue.

void viennacl::ocl::enqueue ( KernelType &  k)

Convenience function that enqueues the provided kernel into the first queue of the currently active device in the currently active context.

void viennacl::ocl::enqueue ( viennacl::generator::custom_operation &  op,
viennacl::ocl::command_queue const &  queue 
) [inline]
void viennacl::ocl::enqueue ( viennacl::generator::custom_operation &  op) [inline]

Convenience function for returning the current context.

viennacl::ocl::kernel& viennacl::ocl::get_kernel ( std::string const &  prog_name,
std::string const &  kernel_name 
) [inline]

Convenience function for getting the kernel for a particular program from the current active context.

std::vector< platform > viennacl::ocl::get_platforms ( ) [inline]

Convenience function for getting the default queue for the currently active device in the active context.

viennacl::ocl::command_queue& viennacl::ocl::get_queue ( viennacl::ocl::device  d,
unsigned int  queue_id = 0 
) [inline]

Convenience function for getting the queue for a particular device in the current active context.

viennacl::ocl::command_queue& viennacl::ocl::get_queue ( cl_device_id  dev_id,
unsigned int  queue_id = 0 
) [inline]

Convenience function for getting the queue for a particular device in the current active context.

detail::return_type<cl_device_id, param>::Result viennacl::ocl::info ( cl_device_id const &  handle)
detail::return_type<cl_mem, param>::Result viennacl::ocl::info ( cl_mem const &  handle)
detail::return_type<cl_program, param>::Result viennacl::ocl::info ( cl_program const &  handle)
detail::return_type<cl_context, param>::Result viennacl::ocl::info ( cl_context const &  handle)
detail::return_type<OCL_TYPE, param>::Result viennacl::ocl::info ( OCL_TYPE const &  handle)
detail::return_type<cl_kernel, param>::Result viennacl::ocl::info ( viennacl::ocl::kernel k)

Queries information about a kernel.

Parameters:
kCorresponding kernel
detail::return_type<cl_kernel, param>::Result viennacl::ocl::info ( viennacl::ocl::kernel k,
viennacl::ocl::device const &  d 
)

Queries information about the execution of a kernel on a particular device.

Parameters:
kCorresponding kernel
dCorresponding device
void viennacl::ocl::set_context_device_num ( long  i,
vcl_size_t  num 
) [inline]

Convenience function for setting the number of default devices per context.

void viennacl::ocl::set_context_device_type ( long  i,
cl_device_type  dev_type 
) [inline]

Convenience function for setting the default device type for a context.

Convenience function for setting the default device type for a context to GPUs.

Convenience function for setting the default device type for a context to CPUs.

Convenience function for setting the default device type for a context to the default OpenCL device type.

Convenience function for setting the default device type for a context to accelerators.

void viennacl::ocl::set_context_platform_index ( long  i,
vcl_size_t  pf_index 
) [inline]

Convenience function for setting the platform index.

Parameters:
iContext ID
pf_indexThe platform index as returned by clGetPlatformIDs(). This is not the ID of type cl_platform_id!
void viennacl::ocl::setup_context ( long  i,
std::vector< cl_device_id > const &  devices 
) [inline]

Convenience function for setting devices for a context.

void viennacl::ocl::setup_context ( long  i,
viennacl::ocl::device const &  device 
) [inline]

Convenience function for setting devices for a context.

void viennacl::ocl::setup_context ( long  i,
cl_context  c,
std::vector< cl_device_id > const &  devices,
std::map< cl_device_id, std::vector< cl_command_queue > > const &  queues 
) [inline]

Convenience function for setting up a context in ViennaCL from an existing OpenCL context.

void viennacl::ocl::setup_context ( long  i,
cl_context  c,
std::vector< cl_device_id > const &  devices,
std::vector< cl_command_queue > const &  queues 
) [inline]

Convenience function for setting up a context in ViennaCL from an existing OpenCL context.

void viennacl::ocl::setup_context ( long  i,
cl_context  c,
cl_device_id  d,
cl_command_queue  q 
) [inline]

Convenience function for setting up a context in ViennaCL from an existing OpenCL context.

void viennacl::ocl::switch_context ( long  i) [inline]

Convenience function for switching the current context.

Convenience function for switching the active device in the current context.