未验证 提交 75953096 编写于 作者: L liuwei1031 提交者: GitHub

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

上级 71d883b8
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册