未验证 提交 b0b0d628 编写于 作者: W Wilber 提交者: GitHub

fix cpu machine run paddle in gpu lib test=release/1.6 (#20548)

cpu机器在gpu库上运行paddle出core,原因是由于缺失显卡driver,显卡driver与cuda driver不匹配

加上driver check解决该问题
上级 d376f4b8
......@@ -39,6 +39,14 @@ inline std::string CudaErrorWebsite() {
}
static int GetCUDADeviceCountImpl() {
int driverVersion = 0;
cudaError_t status = cudaDriverGetVersion(&driverVersion);
if (!(status == cudaSuccess && driverVersion != 0)) {
// No GPU driver
return 0;
}
const auto *cuda_visible_devices = std::getenv("CUDA_VISIBLE_DEVICES");
if (cuda_visible_devices != nullptr) {
std::string cuda_visible_devices_str(cuda_visible_devices);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册