Neargye / hello_tf_c_api

Neural Network TensorFlow C API
MIT License
468 stars 134 forks source link

how to turn off verbose and idle threads? #42

Closed joytsay closed 3 years ago

joytsay commented 4 years ago

hi, we are using this for the NIST frvt submission and have the following issues:

  1. Need to run on single thread (Tensorflow spins-up multi-threads according to CPU number)
  2. Need to turn off all debugging message (i.e.to run quietly, it should not write messages to “standard output”)

for issue 1. we already tried: std::array<std::uint8_t, 13> config = {{ 0x0a ,0x07, 0x0a, 0x03, 0x43, 0x50, 0x55, 0x10, 0x01, 0x10, 0x01, 0x28, 0x01}}; TF_SetConfig(options, config.data(), config.size(), status); But still we get 9 threads (7 idle 2 running), and NIST only permit 2 threads: [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 uses the command: "top -H -b -n1 | grep validate11" to monitor thread usage, validate11 is the program task's name): [joytsay@localhost ~]$ top -H -b -n1 | grep validate11 30300 joytsay 20 0 600744 233972 11060 R 70.6 1.5 3:51.85 validate11 30469 joytsay 20 0 600744 233972 11060 S 35.3 1.5 0:09.37 validate11 30220 joytsay 20 0 480640 240168 30444 S 0.0 1.5 0:00.78 validate11 30266 joytsay 20 0 480640 240168 30444 S 0.0 1.5 0:00.00 validate11 30463 joytsay 20 0 600744 233972 11060 S 0.0 1.5 0:00.00 validate11 30466 joytsay 20 0 600744 233972 11060 S 0.0 1.5 0:00.00 validate11 30467 joytsay 20 0 600744 233972 11060 S 0.0 1.5 0:00.00 validate11 30468 joytsay 20 0 600744 233972 11060 S 0.0 1.5 0:00.00 validate11

as for issue 2. we can't find where to turn off messages produced by Tensorflow: 2020-03-02 17:25:32.458659: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3600000000 Hz 2020-03-02 17:25:32.458815: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1c27740 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2020-03-02 17:25:32.458846: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version Any suggestions will help, thank you!