machinelearning icon indicating copy to clipboard operation
machinelearning copied to clipboard

FastForest multithreading

Open sretz opened this issue 3 years ago • 3 comments

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:

  1. Create as many threads as the machine has
  2. var trainer = context.BinaryClassification.Trainers.FastForest(label, numberOfTrees: trees);
  3. var trained = trainer.Fit(inputs);
  4. look at CPU usage

Expected behavior CPU usage at 100% not significantly less

Screenshots, Code, Sample Projects image image

Additional context

sretz avatar Jun 05 '22 21:06 sretz

how many trees are you using? Is there anything else you are doing in your code besides what you listed here?

michaelgsharp avatar Jun 13 '22 18:06 michaelgsharp

I am using 2 through 21 trees. Here is what I'm doing on the thread. image

sretz avatar Jun 14 '22 14:06 sretz

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

tarekgh avatar Aug 26 '22 17:08 tarekgh