Reduce console verbosity

北城余情 提交于 2019-12-12 13:06:51

问题


I am running some training and prediction with Keras/TensorFlow and I get some OMP information that I do not need.

2019-05-20 12:11:45.625897: I tensorflow/core/common_runtime/process_util.cc:71] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best p
erformance.
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22400 thread 1 bound to OS proc set 1
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22428 thread 2 bound to OS proc set 2
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22429 thread 3 bound to OS proc set 3
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22430 thread 4 bound to OS proc set 4
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22431 thread 5 bound to OS proc set 5
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22432 thread 6 bound to OS proc set 6
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22433 thread 7 bound to OS proc set 7
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22434 thread 8 bound to OS proc set 8
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22435 thread 9 bound to OS proc set 9
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22436 thread 10 bound to OS proc set 10
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22437 thread 11 bound to OS proc set 11
OMP: Info #250: KMP_AFFINITY: pid 22357 tid 22438 thread 12 bound to OS proc set 0

How can I remove this extra verbosity?


回答1:


EDIT: As (the vastly more qualified to talk about this topic than me) Jim Cownie points out, this output appears to be due to having KMP_AFFINITY defined with the attribute verbose. See The KMP_AFFINITY Environment Variable and set the environment variable accordingly (the default value is noverbose,respect,granularity=core,none,0,0).

(likely wrong information below)


I think those messages should go away if you disable the OpenMP warnings setting the environment variable KMP_WARNINGS to off or 0. From a shell:

$ KMP_WARNINGS=off python program.py

Or from Python itself, before OpenMP is initialized:

import os
os.environ['KMP_WARNINGS'] = 'off'


来源:https://stackoverflow.com/questions/56224689/reduce-console-verbosity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!