DLPrimitives
|
This is main object that represent the pair of OpenCL platform and device all other objects use it. More...
#include <include/dlprim/context.hpp>
Public Types | |
enum | ContextType { cpu = 0, ocl = 1 } |
Device used with the context, CPU or OpenCL device. More... | |
Public Member Functions | |
Context (std::string const &dev_id) | |
Create new context from textual ID. It can be "cpu" or "P:D" were P is integer representing platform and D is device number on this platform starting from 0, for example "0:1" is second device on 1st platform. | |
Context (ContextType dt=cpu, int platform=0, int device=0) | |
Create context from numerical platform and device number, of it is CPU context, platform and device are ignored. | |
Context (cl::Context const &c, cl::Platform const &p, cl::Device const &d) | |
Create the object from OpenCL context, platform and device.. | |
Context (ExecutionContext const &ec) | |
Create the object from queue. | |
Context (Context const &)=default | |
Context & | operator= (Context const &)=default |
Context (Context &&)=default | |
Context & | operator= (Context &&)=default |
std::string | name () const |
Human readable name for the context, for example: "GeForce GTX 960 on NVIDIA CUDA". | |
ContextType | context_type () const |
return context type either cpu or ocl | |
bool | is_cpu_context () const |
Returns true if the context was created as CPU context. | |
bool | is_opencl_context () const |
Returns true if the context was created as OpenCL context. | |
cl::Platform & | platform () |
Get OpenCL platform object. | |
cl::Device & | device () |
Get OpenCL device object. | |
bool | check_device_extension (std::string const &name) |
Check if specific device extension is present. | |
std::string const & | device_extensions () |
get all device extensions as a string | |
int | estimated_core_count () |
Get estimated number of cores. Note since it is not something defined for OpenCL in general it returns number of cuda cores for NVidia devices and similar values for AMD and Intel GPU devices. For Nvidia it is 128 * cu, for AMD it is 64 * cu and for Intel it is 8 * cu where cu is number of compute units reported by CL_DEVICE_MAX_COMPUTE_UNITS query. | |
bool | is_amd () |
checks if the device is AMD GPU | |
bool | is_nvidia () |
checks if the device is NVidia GPU | |
bool | is_intel () |
checks if the device is Intel GPU | |
cl::Context & | context () |
Get OpenCL context object. | |
cl::CommandQueue | make_queue (cl_command_queue_properties props=0) |
Creates a new Command queue for the context with optional properties. | |
ExecutionContext | make_execution_context (cl_command_queue_properties props=0) |
Generate ExecutionContext (queue + events) | |
This is main object that represent the pair of OpenCL platform and device all other objects use it.
It can be CPU context - meaning that it represents no OpenCL platform/device/context