OpenCL destructor may cause a segmentation fault
There is a race condition during the Nanos++ finalization phase invoking OpenCLAdapter::~OpenCLAdapter()
that may cause a segmentation fault.
Particularly, the line:
OpenCLAdapter::~OpenCLAdapter()
{
...
errCode = clReleaseContext( _ctx );
...
}
invokes the OpenCL runtime and tries to release the context pointed by _ctx
. In some cases, the pointer has already been released and causes a segfault inside the OpenCL runtime.