减少控制台冗长

时间:2019-05-20 16:16:55

标签: tensorflow keras openmp

我正在使用Keras / TensorFlow进行一些训练和预测,并且得到了一些我不需要的OMP信息。

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

如何删除这种多余的言语?

1 个答案:

答案 0 :(得分:1)

编辑:Jim Cownie指出了(这个话题比我更能讨论这个话题),该输出似乎是由于用属性KMP_AFFINITY定义了verbose所致。请参见The KMP_AFFINITY Environment Variable并相应地设置环境变量(默认值为noverbose,respect,granularity=core,none,0,0)。

(以下可能是错误的信息)


我认为,如果禁用将环境变量KMP_WARNINGS设置为off0的OpenMP警告,这些消息应该消失。从外壳:

$ KMP_WARNINGS=off python program.py

或者从Python本身开始,在OpenMP初始化之前:

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