限制Tensorflow CPU和内存使用率

编程入门 行业动态 更新时间:2024-10-28 12:26:05
本文介绍了限制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和内存使用率

本文发布于:2023-11-16 16:48:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1606080.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:使用率   内存   Tensorflow   CPU

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!