print out error code of cudaGetDeviceProperties if failed (#18643)

DDDivano-patch-1
liuwei1031 6 years ago committed by GitHub
parent 71d883b8ef
commit 759530966c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -106,9 +106,11 @@ int GetCUDADeviceCount() {
int GetCUDAComputeCapability(int id) {
PADDLE_ENFORCE_LT(id, GetCUDADeviceCount(), "id must less than GPU count");
cudaDeviceProp device_prop;
PADDLE_ENFORCE(cudaGetDeviceProperties(&device_prop, id),
auto error_code = cudaGetDeviceProperties(&device_prop, id);
PADDLE_ENFORCE(error_code,
"cudaGetDeviceProperties failed in "
"paddle::platform::GetCUDAComputeCapability");
"paddle::platform::GetCUDAComputeCapability, error code : %d",
error_code);
return device_prop.major * 10 + device_prop.minor;
}

Loading…
Cancel
Save