【问题标题】:Tensorflow 2.2 does not find GPU on my Microsoft Windows Surface book 3-- no CUDA-capable device is detectedTensorflow 2.2 在我的 Microsoft Windows Surface book 3 上找不到 GPU——没有检测到支持 CUDA 的设备
【发布时间】:2020-11-09 03:27:17
【问题描述】:

deviceQuery confirms Computer has Cuda capable device 在似乎加载 cuda 文件后出现此错误:

2020-07-19 17:18:41.922056: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2020-07-19 17:18:56.392936: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-07-19 17:18:56.969124: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
  2020-07-19 17:18:56.976577: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: SURFACE-
2020-07-19 17:18:56.980572: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-07-19 17:18:57.018199: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x25fbcf00ee0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-19 17:18:57.018616: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version

我签入了我的 Python 代码:tf.test.gpu_device_name(),但什么也没返回。 另外,print(device_lib.list_local_devices())中没有列出GPU

要测试的代码是:

from tensorflow.python.client import device_lib
    with tf.device('/gpu:0'):
        a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
        b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
        c = tf.matmul(a, b)
    tf.print(c)
    print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
    if tf.test.is_built_with_cuda():
        print("Built with cuda")
    if tf.test.is_built_with_gpu_support():
        print('Built with GPU support')
    if tf.test.gpu_device_name():
        print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
    else:
        print("No Installed GPU version of TF")
    print(device_lib.list_local_devices())

【问题讨论】:

标签: python tensorflow deep-learning gpu


【解决方案1】:

我通过添加以下内容解决了这个问题: os.environ['CUDA_VISIBLE_DEVICES'] = "0"

【讨论】:

    猜你喜欢
    • 2019-07-01
    • 1970-01-01
    • 2021-02-04
    • 2020-05-05
    • 2012-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-04
    相关资源
    最近更新 更多