Skip to content

Inconsistency for Num threads calculation if they don't specified #217

Open

Description

@Ivanidzo4ka

We have few places in code with code like:

_threads = Math.Max(1, args.Threads ?? (Environment.ProcessorCount / 2));

in some places it's Math.Max(2, Environment.ProcessorCount - 1)

in others it'sArgs.NumThreads ?? Environment.ProcessorCount;

which is a bit strange. It's either half of cores, all cores, or we left one core to be free.
KMeans, SdcaRegression, LinearClassifier , and BinaryLoader use half of available cores which leads to 50% CPU utilization.
@TomFinley, @GalOshri , @glebuk

Activity

  1. added this to the 1018 milestone on Oct 4, 2018
  2. modified the milestones: 1018, 1118 on Nov 7, 2018
  3. shmoradims commented on Nov 28, 2018

    @shmoradims

    @Ivanidzo4ka i think this issue still needs discussion to define what the fix should be. I added need-info tag for now (feel free to revert)

    @eerhardt @TomFinley @Zruty0 could you please discuss a concrete action path for this issue so it can be fixed? Thanks.

  4. removed this from the 1118 milestone on Dec 4, 2018
  5. added
    Priority:3Work that is nice to have
    area-CoreCore ML.NET APIs and shared functionality
    and removed on Sep 8, 2026
  6. rosebyte commented on Sep 9, 2026

    @rosebyte
    Member

    triage: we will investigate if there is a reason to have the same thread counts everywhere

  7. added this to the ML.NET 7.0 milestone on Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority:3Work that is nice to havearea-CoreCore ML.NET APIs and shared functionalityenhancementNew feature or requestgreendevelopmenttenet-performancePerformance related issueyellowmaintenance only

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions