diff --git a/parl/utils/machine_info.py b/parl/utils/machine_info.py index 881a793a253eda2b1125949a2e8d55142b14c7f1..754af8b93e7c49650e248e2883d03b790188cbea 100644 --- a/parl/utils/machine_info.py +++ b/parl/utils/machine_info.py @@ -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