Driver: now ignore CUDA_ERROR_DEINITIALIZED in the destructor of CUDA C++ object.
This should be harmless. ISAAC deinitializes CUDA at the very end, but external libraries may deinitialize it beforehands.
This commit is contained in:
@@ -118,6 +118,7 @@ namespace cuda
|
|||||||
}
|
}
|
||||||
|
|
||||||
void check(CUresult);
|
void check(CUresult);
|
||||||
|
void check_destruction(CUresult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -47,7 +47,6 @@ private:
|
|||||||
int cuGetInfo() const;
|
int cuGetInfo() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Device(int ordinal);
|
|
||||||
explicit Device(CUdevice const & device, bool take_ownership = true);
|
explicit Device(CUdevice const & device, bool take_ownership = true);
|
||||||
explicit Device(cl_device_id const & device, bool take_ownership = true);
|
explicit Device(cl_device_id const & device, bool take_ownership = true);
|
||||||
|
|
||||||
|
@@ -97,6 +97,13 @@ void check(CUresult err)
|
|||||||
default : throw unknown();
|
default : throw unknown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void check_destruction(CUresult result)
|
||||||
|
{
|
||||||
|
if(result!=CUDA_ERROR_DEINITIALIZED)
|
||||||
|
cuda::check(result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ocl
|
namespace ocl
|
||||||
|
@@ -21,11 +21,6 @@ int Device::cuGetInfo() const
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Device::Device(int ordinal): backend_(CUDA), h_(backend_, true)
|
|
||||||
//{
|
|
||||||
// cuda::check(dispatch::cuDeviceGet(&h_.cu(), ordinal));
|
|
||||||
//}
|
|
||||||
|
|
||||||
Device::Device(CUdevice const & device, bool take_ownership): backend_(CUDA), h_(backend_, take_ownership)
|
Device::Device(CUdevice const & device, bool take_ownership): backend_(CUDA), h_(backend_, take_ownership)
|
||||||
{
|
{
|
||||||
h_.cu() = device;
|
h_.cu() = device;
|
||||||
|
@@ -9,27 +9,29 @@ namespace isaac
|
|||||||
namespace driver
|
namespace driver
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//CUDA
|
//CUDA
|
||||||
template<class CLType, class CUType>
|
template<class CLType, class CUType>
|
||||||
void Handle<CLType, CUType>::_delete(CUcontext x) { cuda::check(dispatch::cuCtxDestroy(x)); }
|
void Handle<CLType, CUType>::_delete(CUcontext x) { cuda::check_destruction(dispatch::cuCtxDestroy(x)); }
|
||||||
|
|
||||||
template<class CLType, class CUType>
|
template<class CLType, class CUType>
|
||||||
void Handle<CLType, CUType>::_delete(CUdeviceptr x) { cuda::check(dispatch::dispatch::cuMemFree(x)); }
|
void Handle<CLType, CUType>::_delete(CUdeviceptr x) { cuda::check_destruction(dispatch::dispatch::cuMemFree(x)); }
|
||||||
|
|
||||||
template<class CLType, class CUType>
|
template<class CLType, class CUType>
|
||||||
void Handle<CLType, CUType>::_delete(CUstream x) { cuda::check(dispatch::cuStreamDestroy(x)); }
|
void Handle<CLType, CUType>::_delete(CUstream x) { cuda::check_destruction(dispatch::cuStreamDestroy(x)); }
|
||||||
|
|
||||||
template<class CLType, class CUType>
|
template<class CLType, class CUType>
|
||||||
void Handle<CLType, CUType>::_delete(CUdevice) { }
|
void Handle<CLType, CUType>::_delete(CUdevice) { }
|
||||||
|
|
||||||
template<class CLType, class CUType>
|
template<class CLType, class CUType>
|
||||||
void Handle<CLType, CUType>::_delete(CUevent x) { cuda::check(dispatch::dispatch::cuEventDestroy(x)); }
|
void Handle<CLType, CUType>::_delete(CUevent x) { cuda::check_destruction(dispatch::dispatch::cuEventDestroy(x)); }
|
||||||
|
|
||||||
template<class CLType, class CUType>
|
template<class CLType, class CUType>
|
||||||
void Handle<CLType, CUType>::_delete(CUfunction) { }
|
void Handle<CLType, CUType>::_delete(CUfunction) { }
|
||||||
|
|
||||||
template<class CLType, class CUType>
|
template<class CLType, class CUType>
|
||||||
void Handle<CLType, CUType>::_delete(CUmodule x) { cuda::check(dispatch::dispatch::cuModuleUnload(x)); }
|
void Handle<CLType, CUType>::_delete(CUmodule x) { cuda::check_destruction(dispatch::dispatch::cuModuleUnload(x)); }
|
||||||
|
|
||||||
template<class CLType, class CUType>
|
template<class CLType, class CUType>
|
||||||
void Handle<CLType, CUType>::_delete(cu_event_t x) { _delete(x.first); _delete(x.second); }
|
void Handle<CLType, CUType>::_delete(cu_event_t x) { _delete(x.first); _delete(x.second); }
|
||||||
|
@@ -30,8 +30,7 @@ extern "C"
|
|||||||
cublasStatus_t cublasDestroy_v2 (cublasHandle_t handle)
|
cublasStatus_t cublasDestroy_v2 (cublasHandle_t handle)
|
||||||
{
|
{
|
||||||
delete handle;
|
delete handle;
|
||||||
cublasShutdown();
|
return cublasShutdown();
|
||||||
return CUBLAS_STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cublasStatus cublasInit()
|
cublasStatus cublasInit()
|
||||||
|
Reference in New Issue
Block a user