machinelearning
machinelearning copied to clipboard
FastForest multithreading
System Information (please complete the following information):
- OS & Version: Windows 10 19044.1706
- ML.NET Version: 1.7.1 x64
- .NET Version: v4.8 x64
Describe the bug I'm running tests with FastForest on machine with 2 processors with 12 cores each with a total of 48 threads, the program running the test is using 48 threads, but the highest CPU the program gets is 14%, which 7 maybe 8 threads. This leads me to believe the FastForest training algo is doing some locking.
To Reproduce Steps to reproduce the behavior:
- Create as many threads as the machine has
- var trainer = context.BinaryClassification.Trainers.FastForest(label, numberOfTrees: trees);
- var trained = trainer.Fit(inputs);
- look at CPU usage
Expected behavior CPU usage at 100% not significantly less
Screenshots, Code, Sample Projects

Additional context
how many trees are you using? Is there anything else you are doing in your code besides what you listed here?
I am using 2 through 21 trees.
Here is what I'm doing on the thread.

It is possible to be the lock https://github.com/dotnet/machinelearning/blob/9652e59c5d639cd30390fcfd47b525eb0bd8665e/src/Microsoft.ML.FastTree/FastTree.cs#L217