Manages an OpenCL context and provides the respective convenience functions for creating buffers, etc.
More...
|
| context () |
|
vcl_size_t | default_device_num () const |
| Returns the maximum number of devices to be set up for the context. More...
|
|
void | default_device_num (vcl_size_t new_num) |
| Sets the maximum number of devices to be set up for the context. More...
|
|
cl_device_type | default_device_type () |
| Returns the default device type for the context. More...
|
|
void | default_device_type (cl_device_type dtype) |
| Sets the device type for this context. More...
|
|
std::vector
< viennacl::ocl::device >
const & | devices () const |
| Returns a vector with all devices in this context. More...
|
|
viennacl::ocl::device const & | current_device () const |
| Returns the current device. More...
|
|
void | switch_device (vcl_size_t i) |
| Switches the current device to the i-th device in this context. More...
|
|
void | switch_device (viennacl::ocl::device const &d) |
| If the supplied device is used within the context, it becomes the current active device. More...
|
|
void | add_device (viennacl::ocl::device const &d) |
| Add a device to the context. Must be done before the context is initialized. More...
|
|
void | add_device (cl_device_id d) |
| Add a device to the context. Must be done before the context is initialized. More...
|
|
void | init () |
| Initializes a new context. More...
|
|
void | init (cl_context c) |
| Initializes the context from an existing, user-supplied context. More...
|
|
cl_mem | create_memory_without_smart_handle (cl_mem_flags flags, unsigned int size, void *ptr=NULL) const |
| Creates a memory buffer within the context. Does not wrap the OpenCL handle into the smart-pointer-like viennacl::ocl::handle, which saves an OpenCL backend call, yet the user has to ensure that the OpenCL memory handle is free'd or passed to a viennacl::ocl::handle later on. More...
|
|
viennacl::ocl::handle< cl_mem > | create_memory (cl_mem_flags flags, unsigned int size, void *ptr=NULL) const |
| Creates a memory buffer within the context. More...
|
|
template<typename SCALARTYPE , typename A , template< typename, typename > class VectorType> |
viennacl::ocl::handle< cl_mem > | create_memory (cl_mem_flags flags, const VectorType< SCALARTYPE, A > &buffer) const |
| Creates a memory buffer within the context initialized from the supplied data. More...
|
|
void | add_queue (cl_device_id dev, cl_command_queue q) |
| Adds an existing queue for the given device to the context. More...
|
|
void | add_queue (cl_device_id dev) |
| Adds a queue for the given device to the context. More...
|
|
void | add_queue (viennacl::ocl::device d) |
| Adds a queue for the given device to the context. More...
|
|
viennacl::ocl::command_queue & | get_queue () |
|
viennacl::ocl::command_queue
const & | get_queue () const |
|
viennacl::ocl::command_queue & | get_queue (cl_device_id dev, vcl_size_t i=0) |
| Returns the queue with the provided index for the given device. More...
|
|
viennacl::ocl::command_queue
const & | current_queue () |
| Returns the current device. More...
|
|
void | switch_queue (vcl_size_t i) |
| Switches the current device to the i-th device in this context. More...
|
|
void | switch_queue (viennacl::ocl::command_queue const &q) |
| If the supplied command_queue is used within the context, it becomes the current active command_queue, the command_queue's device becomes current active device. More...
|
|
viennacl::ocl::program & | add_program (cl_program p, std::string const &prog_name) |
| Adds a program to the context. More...
|
|
viennacl::ocl::program & | add_program (std::string const &source, std::string const &prog_name) |
| Adds a new program with the provided source to the context. Compiles the program and extracts all kernels from it. More...
|
|
void | delete_program (std::string const &name) |
| Delete the program with the provided name. More...
|
|
viennacl::ocl::program & | get_program (std::string const &name) |
| Returns the program with the provided name. More...
|
|
viennacl::ocl::program const & | get_program (std::string const &name) const |
|
bool | has_program (std::string const &name) |
| Returns whether the program with the provided name exists or not. More...
|
|
viennacl::ocl::program & | get_program (vcl_size_t id) |
| Returns the program with the provided id. More...
|
|
vcl_size_t | program_num () |
| Returns the number of programs within this context. More...
|
|
viennacl::ocl::kernel & | get_kernel (std::string const &program_name, std::string const &kernel_name) |
| Convenience function for retrieving the kernel of a program directly from the context. More...
|
|
vcl_size_t | device_num () |
| Returns the number of devices within this context. More...
|
|
const viennacl::ocl::handle
< cl_context > & | handle () const |
| Returns the context handle. More...
|
|
std::string | build_options () const |
| Returns the current build option string. More...
|
|
void | build_options (std::string op) |
| Sets the build option string, which is passed to the OpenCL compiler in subsequent compilations. Does not effect programs already compiled previously. More...
|
|
vcl_size_t | platform_index () const |
| Returns the platform ID of the platform to be used for the context. More...
|
|
void | platform_index (vcl_size_t new_index) |
| Sets the platform ID of the platform to be used for the context. More...
|
|
bool | operator< (context const &other) const |
| Less-than comparable for compatibility with std:map. More...
|
|
bool | operator== (context const &other) const |
|
Manages an OpenCL context and provides the respective convenience functions for creating buffers, etc.
This class was originally written before the OpenCL C++ bindings were standardized. Regardless, it provides a couple of convience functionality which is not covered by the OpenCL C++ bindings.