【问题标题】:Unpredictable CUDNN_STATUS_NOT_INITIALIZED on WindowsWindows 上不可预测的 CUDNN_STATUS_NOT_INITIALIZED
【发布时间】:2017-12-15 20:19:07
【问题描述】:

我在 Windows 10 上的 GTX 1070 上运行 keras 神经网络训练和预测。大多数时候它都在工作,但有时它会抱怨

E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:359] could not create cudnn handle: CUDNN_STATUS_NOT_INITIALIZED
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:366] error retrieving driver version: Unimplemented: kernel reported driver version not implemented on Windows
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:326] could not destroy cudnn handle: CUDNN_STATUS_BAD_PARAM
F c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\kernels\conv_ops.cc:659] Check failed: stream->parent()->GetConvolveAlgorithms(&algorithms)

既不能用字面的错误意思也不能用OOM错误来解释。

如何解决?

【问题讨论】:

标签: windows tensorflow keras cudnn


【解决方案1】:

尝试使用 set gpu option per_process_gpu_memory_fraction 限制您的 gpu 使用。

摆弄它,看看哪些有效,哪些无效。

我建议使用 .7 作为起始基线。

【讨论】:

【解决方案2】:

我有时在 Windows10 和 Keras 上遇到了这个问题。 重启解决了一小会儿问题,但又出现了。

我指的是https://github.com/fchollet/keras/issues/1538

import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.3
set_session(tf.Session(config=config))

这些设置解决了停机问题。

【讨论】:

    【解决方案3】:

    找到了这个问题的解决方案。 我在使用 Nvidia GEforce 920M 的 Windows 10 上遇到了同样的问题。 搜索正确版本的 cudnn 库。如果版本与 CUDA 版本不兼容,安装 tensorflow 时不会抛出错误,但会干扰 GPU 中的内存分配。 请检查您的 CUDA 和 CUDNN 版本。还请按照上述有关创建会话的说明进行操作。

    【讨论】:

      【解决方案4】:

      终于为我解决了这个问题,我花了很多时间来解决这个问题。

      我建议按照中提到的正确执行所有安装步骤 链接

      TensorFlow- https://www.tensorflow.org/install/install_windows

      对于 CuDNN -

      https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#install-windows

      对我来说,这还不够,我尝试从 GeForce Experience 窗口更新我的 GeForce Game Ready 驱动程序,重启后它开始为我工作。

      GeForce Experience

      驱动也可以从链接https://www.geforce.com/drivers下载

      【讨论】:

        【解决方案5】:

        与其他人所说的类似,为您的 GPU 启用内存增长可以解决此问题。

        通过添加到训练脚本的开头,以下对我有用:

        # Using Tensorflow-2.4.x
        import tensorflow as tf
        try:
            tf_gpus = tf.config.list_physical_devices('GPU')
            for gpu in tf_gpus:
                tf.config.experimental.set_memory_growth(gpu, True)
        except:
            pass 
        

        【讨论】:

        • 这对我有用,谢谢。我有带有 RTX 2060、Cuda 版本 11.2 和 cunn 8.1 的 Windows 10
        【解决方案6】:

        tf doku 帮了我很多Allowing GPU memory growth

        第一个是 allow_growth 选项,它尝试根据运行时分配只分配尽可能多的 GPU 内存:它开始分配非常少的内存,随着会话开始运行并且需要更多 GPU 内存,我们扩展 GPU 内存区域TensorFlow 过程所需的。请注意,我们不会释放内存,因为这会导致更严重的内存碎片。要打开此选项,请通过以下方式在 ConfigProto 中设置选项:

        config = tf.ConfigProto()
        config.gpu_options.allow_growth = True
        session = tf.Session(config=config, ...)
        

        with tf.Session(graph=graph_node, config=config) as sess:
             ...
        

        第二种方法是 per_process_gpu_memory_fraction 选项,它决定了每个可见 GPU 应该分配的内存总量的比例。例如,您可以通过以下方式告诉 TensorFlow 仅分配每个 GPU 总内存的 40%:

        config = tf.ConfigProto()
        config.gpu_options.per_process_gpu_memory_fraction = 0.4
        session = tf.Session(config=config, ...)
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2011-06-26
          • 1970-01-01
          • 1970-01-01
          • 2021-01-05
          • 2012-07-10
          • 1970-01-01
          • 1970-01-01
          • 2012-03-26
          相关资源
          最近更新 更多