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

enable cpu machine to run paddle in gpu lib

enable cpu machine to run paddle model in gpu lib
上级 5219efb1
......@@ -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.
先完成此消息的编辑!
想要评论请 注册