0

I have a quick question. I noticed that each time tensorflow.train.SummaryWriter is called, a new thread is created. Calling close() method of summarywriter will not kill the thread.

I am wondering if there is a way to kill the threads created by summarywriters?

Thank you for your help!

Best

yxw
  • 133
  • 1
  • 8
  • Sounds like a potential bug. But these threads are fairly lightweight so it shouldn't affect your performance – Yaroslav Bulatov Oct 05 '16 at 15:40
  • Hi, the issue is when I train a large number of networks at the same time (or one after another), the number of threads will exceed the system capacity and the program will crash, as mentioned here: http://stackoverflow.com/questions/10589766/cant-start-a-new-thread-error-in-python – yxw Oct 05 '16 at 16:05
  • Actually are you sure that thread is created by SummaryWriter? Threads are usually created by queue runners and supervisor – Yaroslav Bulatov Oct 05 '16 at 18:30
  • you can stop summary writer thread by calling stop on supervisor -- https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/training/supervisor.py#L776 – Yaroslav Bulatov Oct 05 '16 at 18:31
  • @YaroslavBulatov Thank you for your reply. I used treading.active_count() before and after the tf.train.SummaryWriter was called. And the number of threads increased by 1. Would you please give me more details about how to kill the threads by supervisor? I tried but it didn't work. (From the definition I think the stop method only calls the close method of SummaryWriter, which does not work for me for some reason) – yxw Oct 05 '16 at 18:44
  • Sorry, that's limit of my knowledge right now -- I would debug it by looking at thread name and trying to figure out where it is created. It seems summarywriter doesn't need its own thread, in the official HowTo, you use write summaries using .add_summary in main thread – Yaroslav Bulatov Oct 05 '16 at 18:48
  • @YaroslavBulatov Thanks. So this can be done on Python API level or we need to check the C++ implementation? – yxw Oct 05 '16 at 18:55
  • Python since it's Python threads – Yaroslav Bulatov Oct 05 '16 at 18:56
  • @YaroslavBulatov Thanks! – yxw Oct 05 '16 at 20:07

0 Answers0