-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multithreading for TNeuralDataLoadingFit.FitLoading #119
Comments
I have compiled the HypotenuseFitLoading example and the output ('Threads') suggests that multithreading is enabled and it looks like 'batchsize' controls the number of threads. This is not the common meaning of 'batchsize' in the context of NN training. How are the 'batchsize' and the number of threads related? |
@gwiesenekker , regarding "I see from the HypotenuseFitLoading example that GetTrainingPair supports a ThreadId argument. How do you add multi-threading support to the HypotenuseFitLoading example?", this example already explores parallel processing. The class |
In this API, the batch is distributed to parallel threads using the principle of data parallelism: https://www.telesens.co/2017/12/25/understanding-data-parallelism-in-machine-learning/ . I tested this API with up to 64 CPU cores with 64 parallel threads. It should support more threads but I tested with up to 64 CPU cores. In this API, your batch size should be bigger than the number of cores. |
Thanks. So where do you specify the number of threads? Looking at the source code it looks like the default number of threads is GetSystemThreadCount, correct? Why does changing 'batch size' in HypotenuseFitLoading to 8 change 'Threads' in the output to 8? Perhaps because the 'batch size' is 1 (one X, Y pair)? |
"Looking at the source code it looks like the default number of threads is GetSystemThreadCount, correct?" "Why does changing 'batch size' in HypotenuseFitLoading to 8 change 'Threads' in the output to 8? Perhaps because the 'batch size' is 1 (one X, Y pair)?" This is a limitation in CAI. The number of threads needs to be equal or smaller than the batch size. In this API, larger batch sizes lead to better hardware usage (more efficient). Larger batch sizes tend to lead to smaller over fitting but may also make the learning harder. My own default value for problems that I have never touched before is 64 elements for batch size. I recommend 64 as a starting point. Some papers report batch sizes of up to 256 and even 512. There are some experiments with batch size in this link: https://medium.com/mini-distill/effect-of-batch-size-on-training-dynamics-21c14f7a716e . In this API, just to start "feeling" a new problem, I would try 64 for batch size, 0,001 or smaller for LR and 0.9 for inertia. |
I see from the HypotenuseFitLoading example that GetTrainingPair supports a ThreadId argument. How do you add multi-threading support to the HypotenuseFitLoading example?
The text was updated successfully, but these errors were encountered: