We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have a simple class which has the member cl::device, cl::context, cl::command_queue. This class is implemented as a singleton. When program finish, its destructor is called. At this time, it causes segment fault. I find this crash produced by clreleasecontext. Example code likes as follows and I test in Mali-G76
class CLSingleton
{
static CLSingleton & get()
}
~CLSingleton() = default;
private:
CLSingleton();
cl::Device _device;
cl::Context _context;
cl::CommandQueue _command_queue;
int main()
CLSingleton().get();
return 0;
Was the context created successfully in the first place?
I suspect the context is being destroyed from a global destructor. Whether this is supported or not is implementation-defined in the OpenCL specification. The Mali implementation doesn't currently allow it.