【问题标题】:TX2 GPU not allocating memory properlyTX2 GPU 未正确分配内存
【发布时间】:2019-04-29 10:49:51
【问题描述】:

我正在尝试在 TX2 上运行代码,但分配 GPU 内存使用的 tensorflow 代码似乎以一种奇怪的方式工作。

这是我必须分配内存的代码:

config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.0
config.gpu_options.visible_device_list = "0"
set_session(tf.Session(config=config))

奇怪的是,当我使用0.0 而不是0.5 时,处理速度更快。当我使用0.9 时,出现以下错误:

tensorflow.python.framework.errors_impl.InternalError: GPU 同步失败

这里发生了什么?

【问题讨论】:

    标签: python-3.x tensorflow deep-learning nvidia-jetson


    【解决方案1】:

    首先要检查是否正确安装了兼容的 CUDA、cuDNN 版本并重新启动系统。
    然后,允许 GPU 内存增长会有所帮助。 https://www.tensorflow.org/guide/using_gpu#allowing_gpu_memory_growth
    或许,你可以试试:

    import tensorflow as tf       
    config = tf.ConfigProto()
    config.gpu_options.allow_growth = True
    sess = tf.Session(config=config) 
    set_session(sess)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-27
      • 2017-11-13
      • 1970-01-01
      • 2019-03-05
      • 2011-06-24
      • 1970-01-01
      • 2021-04-21
      • 2012-07-03
      相关资源
      最近更新 更多