mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
Print an error message to stderr when the initialization of the CUDA runtime fails. This helps debugging setup issues.
This commit is contained in:
parent
670db7988d
commit
46fc23f91c
@ -34,13 +34,24 @@ static void initializeDeviceProp() {
|
||||
if (!m_devicePropInitialized) {
|
||||
int num_devices;
|
||||
cudaError_t status = cudaGetDeviceCount(&num_devices);
|
||||
EIGEN_UNUSED_VARIABLE(status)
|
||||
if (status != cudaSuccess) {
|
||||
std::cerr << "Failed to get the number of CUDA devices: "
|
||||
<< cudaGetErrorString(status)
|
||||
<< std::endl;
|
||||
assert(status == cudaSuccess);
|
||||
}
|
||||
m_deviceProperties = new cudaDeviceProp[num_devices];
|
||||
for (int i = 0; i < num_devices; ++i) {
|
||||
status = cudaGetDeviceProperties(&m_deviceProperties[i], i);
|
||||
if (status != cudaSuccess) {
|
||||
std::cerr << "Failed to initialize CUDA device #"
|
||||
<< i
|
||||
<< ": "
|
||||
<< cudaGetErrorString(status)
|
||||
<< std::endl;
|
||||
assert(status == cudaSuccess);
|
||||
}
|
||||
}
|
||||
m_devicePropInitialized = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user