I need to use the opencl context and its associated command queues across several classes and therefore i am planning to encapsulate the opencl context creation into a single class and make a singleton instance of it. That instance will be used by several other class objects in the application.
Is my plan in the right direction ?
Is it necessary to use the clRetainContext() some where here ?
Your approach seems correct. clRetainContext() can be useful to verify whether the context is valid across functions.