// Create a context object cl::Context context(CL_DEVICE_TYPE_GPU); // Create a command queue object associated with the context cl::CommandQueue queue(context); // Get the context object associated with the command queue cl::Context queueContext = queue.get_context();
// Create a context object cl::Context context(CL_DEVICE_TYPE_CPU); // Create a command queue object associated with the context cl::CommandQueue queue(context); // Get the context object associated with the command queue cl::Context queueContext = queue.get_context();This example creates a context object for a CPU device, then creates a command queue object associated with that context. Finally, it uses the queue's get_context function to get a reference to the context object. Package/Library: OpenCL