如何从多线程停止TensorFlow [英] How to stop TensorFlow from multi-threading

查看:54
本文介绍了如何从多线程停止TensorFlow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为NIST FRVT编写代码.NIST希望程序最多运行2个线程(仅CPU,无GPU).我在代码中使用TensorFlow,但它总是产生超过2个线程.我尝试了此解决方案.它减少了线程数,但最多减少了2

I am writing code for NIST FRVT. NIST wants the program to run at max 2 threads(Only CPU, No GPU). I am using TensorFlow in my code but it always spawns much more than 2 threads. I tried this solution. It decreased the number of threads, but not up to 2

我收到此警告

[警告]我们检测到您的软件在模板创建过程中可能正在使用线程或使用其他多处理技术.检测到的线程数为9,应该为2.根据API文档,实现必须运行单线程.在测试环境中,线程化没有任何优势,因为NIST将在多个刀片和多个进程之间分配工作负载.我们强烈建议您在提交之前解决此问题.

[WARNING] We've detected that your software may be threading or using other multiprocessing techniques during template creation. The number of threads detected was 9 and it should be 2. Per the API document, implementations must run single-threaded. In the test environment, there is no advantage to threading, because NIST will distribute workload across multiple blades and multiple processes. We highly recommend that you fix this issue prior to submission.

NIST正在按 top -H -b -n1 |计算线程.grep validate11 |wc -l <​​/code>

NIST is calculating threads by top -H -b -n1 | grep validate11 | wc -l

有没有办法强制TensorFlow最多使用2个线程?

Is there any way to force TensorFlow to use at max 2 threads?

是否有可以在2个线程上运行的TensorFlow版本?

Is there any TensorFlow version that will run on 2 threads?

(由于TensorFlow,我通过从代码中删除TensorFlow部分进行了检查)

(It is because of TensorFlow, I checked by removing TensorFlow part from the code)

tensorflow版本1.8.0

tensorflow version 1.8.0

opencv版本3.4.1

opencv version 3.4.1

g ++版本4.8.5

g++ version 4.8.5

g ++ -std = c ++ 11

g++ -std=c++11

推荐答案

参考以下资源,看来不可能在1个或2个线程上运行TensorFlow.

With reference to the following sources, it looks like there is no possibility to run TensorFlow on 1 or 2 threads.

这篇关于如何从多线程停止TensorFlow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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