#include <context.hpp>
Public Member Functions | |
context () | |
std::size_t | default_device_num () const |
Returns the maximum number of devices to be set up for the context. | |
void | default_device_num (std::size_t new_num) |
Sets the maximum number of devices to be set up for the context. | |
cl_device_type | default_device_type () |
Returns the default device type for the context. | |
void | default_device_type (cl_device_type dtype) |
Sets the device type for this context. | |
std::vector < viennacl::ocl::device > const & | devices () const |
Returns a vector with all devices in this context. | |
viennacl::ocl::device const & | current_device () const |
Returns the current device. | |
void | switch_device (size_t i) |
Switches the current device to the i-th device in this context. | |
void | switch_device (viennacl::ocl::device const &d) |
If the supplied device is used within the context, it becomes the current active device. | |
void | add_device (viennacl::ocl::device const &d) |
Add a device to the context. Must be done before the context is initialized. | |
void | add_device (cl_device_id d) |
Add a device to the context. Must be done before the context is initialized. | |
void | init () |
Initializes a new context. | |
void | init (cl_context c) |
Initializes the context from an existing, user-supplied context. | |
viennacl::ocl::handle< cl_mem > | create_memory (cl_mem_flags flags, unsigned int size, void *ptr=NULL) |
Creates a memory buffer within the context. | |
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) |
Creates a memory buffer within the context initialized from the supplied data. | |
void | add_queue (cl_device_id dev, cl_command_queue q) |
Adds an existing queue for the given device to the context. | |
void | add_queue (cl_device_id dev) |
Adds a queue for the given device to the context. | |
void | add_queue (viennacl::ocl::device d) |
Adds a queue for the given device to the context. | |
viennacl::ocl::command_queue & | get_queue () |
viennacl::ocl::command_queue & | get_queue (cl_device_id dev, size_t i=0) |
Returns the queue with the provided index for the given device. | |
viennacl::ocl::program & | add_program (cl_program p, std::string const &prog_name) |
Adds a program to the context. | |
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. | |
viennacl::ocl::program & | get_program (std::string const &name) |
Returns the program with the provided name. | |
viennacl::ocl::program & | get_program (size_t id) |
Returns the program with the provided id. | |
size_t | program_num () |
Returns the number of programs within this context. | |
size_t | device_num () |
Returns the number of devices within this context. | |
const viennacl::ocl::handle < cl_context > & | handle () const |
Returns the context handle. | |
bool | operator< (context const &other) const |
Less-than comparable for compatibility with std:map. |
context | ( | ) | [inline] |
void add_device | ( | viennacl::ocl::device const & | d | ) | [inline] |
Add a device to the context. Must be done before the context is initialized.
void add_device | ( | cl_device_id | d | ) | [inline] |
Add a device to the context. Must be done before the context is initialized.
viennacl::ocl::program& add_program | ( | cl_program | p, | |
std::string const & | prog_name | |||
) | [inline] |
Adds a program to the context.
viennacl::ocl::program& add_program | ( | std::string const & | source, | |
std::string const & | prog_name | |||
) | [inline] |
Adds a new program with the provided source to the context.
void add_queue | ( | cl_device_id | dev | ) | [inline] |
Adds a queue for the given device to the context.
void add_queue | ( | viennacl::ocl::device | d | ) | [inline] |
Adds a queue for the given device to the context.
void add_queue | ( | cl_device_id | dev, | |
cl_command_queue | q | |||
) | [inline] |
Adds an existing queue for the given device to the context.
viennacl::ocl::handle<cl_mem> create_memory | ( | cl_mem_flags | flags, | |
unsigned int | size, | |||
void * | ptr = NULL | |||
) | [inline] |
Creates a memory buffer within the context.
flags | OpenCL flags for the buffer creation | |
size | Size of the memory buffer in bytes | |
ptr | Optional pointer to CPU memory, with which the OpenCL memory should be initialized |
viennacl::ocl::handle<cl_mem> create_memory | ( | cl_mem_flags | flags, | |
const VectorType< SCALARTYPE, A > & | _buffer | |||
) | [inline] |
Creates a memory buffer within the context initialized from the supplied data.
flags | OpenCL flags for the buffer creation | |
_buffer | A vector (STL vector, ublas vector, etc.) |
viennacl::ocl::device const& current_device | ( | ) | const [inline] |
Returns the current device.
void default_device_num | ( | std::size_t | new_num | ) | [inline] |
Sets the maximum number of devices to be set up for the context.
std::size_t default_device_num | ( | ) | const [inline] |
Returns the maximum number of devices to be set up for the context.
void default_device_type | ( | cl_device_type | dtype | ) | [inline] |
Sets the device type for this context.
cl_device_type default_device_type | ( | ) | [inline] |
Returns the default device type for the context.
size_t device_num | ( | ) | [inline] |
Returns the number of devices within this context.
std::vector<viennacl::ocl::device> const& devices | ( | ) | const [inline] |
Returns a vector with all devices in this context.
viennacl::ocl::program& get_program | ( | size_t | id | ) | [inline] |
Returns the program with the provided id.
viennacl::ocl::program& get_program | ( | std::string const & | name | ) | [inline] |
Returns the program with the provided name.
viennacl::ocl::command_queue& get_queue | ( | ) | [inline] |
viennacl::ocl::command_queue& get_queue | ( | cl_device_id | dev, | |
size_t | i = 0 | |||
) | [inline] |
Returns the queue with the provided index for the given device.
const viennacl::ocl::handle<cl_context>& handle | ( | ) | const [inline] |
Returns the context handle.
void init | ( | cl_context | c | ) | [inline] |
Initializes the context from an existing, user-supplied context.
void init | ( | ) | [inline] |
Initializes a new context.
bool operator< | ( | context const & | other | ) | const [inline] |
Less-than comparable for compatibility with std:map.
size_t program_num | ( | ) | [inline] |
Returns the number of programs within this context.
void switch_device | ( | viennacl::ocl::device const & | d | ) | [inline] |
If the supplied device is used within the context, it becomes the current active device.
void switch_device | ( | size_t | i | ) | [inline] |
Switches the current device to the i-th device in this context.