viennacl/viennacl-dev — pull request #38 by bollig (2013-07-23 17:04:31+00:00)
Title: Added support for switching queues

Karl, I added support to switch queues. Review this and let me know what you think. I tested it with:

// Create new queue
int err;
viennacl::ocl::current_context().add_queue(viennacl::ocl::current_context().current_device().id() );
VIENNACL_ERR_CHECK(err);

std::cout << "ViennaCL uses context: " << viennacl::ocl::current_context().handle().get() << std::endl;
std::cout << "ViennaCL uses default queue: " << viennacl::ocl::current_context().current_queue().handle().get() << std::endl;
// Switch to new queue
viennacl::ocl::current_context().switch_queue(1);
std::cout << "ViennaCL uses new queue: " << viennacl::ocl::current_context().current_queue().handle().get() << std:: endl;
// Swap back
viennacl::ocl::current_context().switch_queue(0);
std::cout << "ViennaCL uses first queue: " << viennacl::ocl::current_context().current_queue().handle().get() << std::endl;

Results:

[0] ViennaCL uses context: 0x36932c0
[0] ViennaCL uses default queue: 0x3d82b10
[0] ViennaCL uses new queue: 0x15d30b40
[0] ViennaCL uses first queue: 0x3d82b10