SampleRNN_torch icon indicating copy to clipboard operation
SampleRNN_torch copied to clipboard

Reason for big number of threads?

Open Quasimondo opened this issue 8 years ago • 3 comments

I frequently ran into the issue that the training does not start but gets stuck in the create_thread_pool() method. Looking at the number of threads it tries to allocate I got 128. This seems to be quite a lot. It looks like the thread count is equal to the number of Mini-Batches:

local minibatch_size = args.minibatch_size
local n_threads = minibatch_size

So when I manually set the thread count to 8 (based on the number of cores in my cpu) I do not notice any slowdown in training and the script does not get stuck in initialization anymore.

So I wonder what the reason for this high thread count is - maybe I am missing something important here?

Quasimondo avatar Oct 12 '17 13:10 Quasimondo

Thanks for that. Yes, I noticed this myself.

There's very little need to run more than a couple of threads here, so I'll change the default and resolve this issue.

I'm going to be pushing some other changes so will get to this after.

In the mean time I'm glad you got it running, please post links to results if you generate anything interesting.

On 12 Oct 2017 14:47, "Mario Klingemann" [email protected] wrote:

I frequently ran into the issue that the training does not start but gets stuck in the create_thread_pool() method. Looking at the number of threads it tries to allocate I got 128. This seems to be quite a lot. It looks like the thread count is equal to the number of Mini-Batches:

local minibatch_size = args.minibatch_size local n_threads = minibatch_size

So when I manually set the thread count to 8 (based on the number of cores in my cpu) I do not notice any slowdown in training and the script does not get stuck in initialization anymore.

So I wonder what the reason for this high thread count is - maybe I am missing something important here?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/richardassar/SampleRNN_torch/issues/8, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1ALHIQc6_csvE_MQDLAkYMiNdDn18Rks5srhh7gaJpZM4P3CJa .

richardassar avatar Oct 12 '17 13:10 richardassar

And actually 128 is not that many, the reason was to try and speed up minibatch creation as much as possible (high number of threads to hide latency, for example).

Anyway it seems even 2 threads is sufficient here.

Happy training.

On 12 Oct 2017 14:47, "Mario Klingemann" [email protected] wrote:

I frequently ran into the issue that the training does not start but gets stuck in the create_thread_pool() method. Looking at the number of threads it tries to allocate I got 128. This seems to be quite a lot. It looks like the thread count is equal to the number of Mini-Batches:

local minibatch_size = args.minibatch_size local n_threads = minibatch_size

So when I manually set the thread count to 8 (based on the number of cores in my cpu) I do not notice any slowdown in training and the script does not get stuck in initialization anymore.

So I wonder what the reason for this high thread count is - maybe I am missing something important here?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/richardassar/SampleRNN_torch/issues/8, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1ALHIQc6_csvE_MQDLAkYMiNdDn18Rks5srhh7gaJpZM4P3CJa .

richardassar avatar Oct 12 '17 13:10 richardassar

Ah thanks for the clarification! Right now I am only dealing with a few hundred training examples, so maybe that's why I didn't notice any speed difference. And yes, if I manage to produce anything good I'll share.

Quasimondo avatar Oct 12 '17 13:10 Quasimondo