-
Hi! In the situation where we cache all deterministic transforms in GPU memory and then use ThreadDataloader to perform lightweight non-deterministic GPU transforms, does the separate thread used by ThreadDataloader release GIL so that it doesn't blocker other threads which are running training? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @ericspod , Could you please help share some comments here? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
The
ThreadDataLoader
class is using Python threads which still need to have the GIL locked to execute. If all your transforms are pure Python then this will interfere with the main (training) thread, however typically transforms are using Numpy, Pytorch, or some other library using compiled code which releases the GIL. The purpose of this class is to take advantage of this and of the fact that training is mostly done in compiled code, despite the GIL it will in certain situations allow overlapping of training and batch queuing. If either training time or batch queue time a much longer than the other there will be less benefit however.