简体   繁体   English

TX2 GPU无法正确分配内存

[英]TX2 GPU not allocating memory properly

I am trying to run a code on TX2 but the tensorflow code that allocates GPU memory usage seems to be working in a weird manner. 我正在尝试在TX2上运行代码,但是分配GPU内存使用量的Tensorflow代码似乎工作方式很奇怪。

Here's the code I have to allocate memory: 这是我必须分配内存的代码:

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))

The weird thing is, when I use 0.0 instead of 0.5 , the processing is faster. 奇怪的是,当我使用0.0而不是0.5 ,处理速度更快。 And when I use 0.9 , I get the following error: 当我使用0.9 ,出现以下错误:

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

What's happening here? 这里发生了什么事?

First thing to check will be to verify if compatible CUDA, cuDNN versions are correctly installed and to reboot the system. 首先要检查的是验证兼容的CUDA,cuDNN版本是否正确安装,然后重新启动系统。
Then, Allowing GPU memory growth can help. 然后,允许GPU内存增长可以有所帮助。 https://www.tensorflow.org/guide/using_gpu#allowing_gpu_memory_growth https://www.tensorflow.org/guide/using_gpu#allowing_gpu_memory_growth
Perhaps, you can try: 也许,您可以尝试:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM