我试图将gpu内存的使用限制在gpu内存的10%,但根据nvidia-smi的说法,以下程序使用了大约13%的gpu内存。这是预期的行为吗?如果这是预期行为,那么其他大约3-4%的数据来自于什么?
from time import sleep
i = tf.constant(0)
x = tf.constant(10)
r = tf.add(i,x)
# Use at most 10% of gpu memory, I expect this to set a hard limit
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=.1)
# sleep is used to see what nvidia-smi says for gpu memory usage,
# I expect that it will be at most 10% of gpu memory (which is 1616.0 mib for my gpu)
# but instead I see the process using up to 2120 mib
with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options)) as sess:
sess.run(r);
sleep(10) 有关我的环境和gpu的更多详细信息,请参阅此github问题:https://github.com/tensorflow/tensorflow/issues/22158
发布于 2019-02-21 07:36:13
从我的实验来看,cudnn和cublas上下文初始化占用了大约228MB的内存。此外,cuda上下文可以占用50到118MB。
https://stackoverflow.com/questions/52264238
复制相似问题