Manually clearing the global device vector
The vector of devices is a global object, which destruction order is undefined. In some platforms, the OpenCL library has been unloaded before this destructor is hit, which causes a segmentation fault after the program ends. By clearing the global vector of devices on destruction of the OpenCL and SYCL Stream benchmarks we avoid the problem.
This commit is contained in:
parent
54fc326097
commit
63f32fcb51
@ -186,6 +186,8 @@ OCLStream<T>::~OCLStream()
|
||||
delete mul_kernel;
|
||||
delete add_kernel;
|
||||
delete triad_kernel;
|
||||
|
||||
devices.clear();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
||||
@ -94,6 +94,7 @@ SYCLStream<T>::~SYCLStream()
|
||||
|
||||
delete p;
|
||||
delete queue;
|
||||
devices.clear();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@ -322,7 +323,6 @@ std::string getDeviceDriver(const int device)
|
||||
return driver;
|
||||
}
|
||||
|
||||
|
||||
// TODO: Fix kernel names to allow multiple template specializations
|
||||
template class SYCLStream<float>;
|
||||
template class SYCLStream<double>;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user