限制Tensorflow CPU和内存使用率 [英] Limit Tensorflow CPU and Memory usage

查看:357
本文介绍了限制Tensorflow CPU和内存使用率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到一些有关使用Tensorflow的GPU内存的问题,但是我已经将其安装在不支持GPU的Pine64上.

I've seen several questions about GPU Memory with Tensorflow but I've installed it on a Pine64 with no GPU support.

这意味着我正在使用非常有限的资源(仅CPU和RAM)运行它,而Tensorflow似乎想要全部,从而完全冻结了我的机器.

That means I'm running it with very limited resources (CPU and RAM only) and Tensorflow seems to want it all, completely freezing my machine.


是否有办法限制分配给Tensorflow的处理能力和内存量?类似于bazel自己的-local_resources 标志吗?

Is there a way to limit the amount of processing power and memory allocated to Tensorflow? Something similar to bazel's own --local_resources flag?

推荐答案

这将创建一个会话,一次运行一个op,每个op只能运行一个线程

This will create a session that runs one op at a time, and only one thread per op

sess = tf.Session(config=
    tf.ConfigProto(inter_op_parallelism_threads=1,
                   intra_op_parallelism_threads=1))

不确定是否要限制内存,它似乎是按需分配的,当我的网络需要100GB的RAM时,我让TensorFlow冻结了我的机器,所以我的解决方案是使网络需要更少的RAM.

Not sure about limiting memory, it seems to be allocated on demand, I've had TensorFlow freeze my machine when my network wanted 100GB of RAM, so my solution was to make networks that need less RAM

这篇关于限制Tensorflow CPU和内存使用率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆