未验证 提交 6e58ccfb 编写于 作者: B Bo Zhou 提交者: GitHub

fix issue#101 (#102)

* fix issue#101

* yapf
上级 564a3742
......@@ -16,6 +16,7 @@ import os
import platform
import subprocess
from parl.utils import logger
from parl.utils import utils
__all__ = ['get_gpu_count', 'get_ip_address', 'is_gpu_available']
......@@ -95,4 +96,11 @@ def is_gpu_available():
Returns:
True if a gpu device can be found.
"""
return get_gpu_count() > 0
ret = get_gpu_count() > 0
if utils._HAS_FLUID:
from paddle import fluid
if ret is True and not fluid.is_compiled_with_cuda():
logger.warn("Found non-empty CUDA_VISIBLE_DEVICES. \
But PARL found that Paddle was not complied with CUDA, which may cause issues."
)
return ret
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册