Skip to content

incorrect computation of build parallelism #74691

Closed

Description

@RobertHenry6bev

Description

When running on Linux,

__NumProc=$(nproc --all)
computes the amount of available parallelism by running nproc -all. However, when nproc -all returns all available parallelism, not the parallelism clamps done by /usr/bin/taskset $cpu_mask ...job invocation. Arguably, just nproc should be used here, not nproc -all since nproc returns the number of processors asked for by the parent /usr/bin/taskset

/usr/bin/taskset 0xf nproc -all

Returns 36 (that's what the hardware on my workstation has), but

/usr/bin/taskset 0xf nproc

returns 4, eg the popcount(0xf).

Reproduction Steps

See above

Expected behavior

There's a reason I clamp the number of cores I give to the build process tree. I wish the build process followed my wishes.

Actual behavior

uses number of hardware cores, not the number of cores I clamped it to

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

Introduced in commit bad6ea0 by /cc @glebBalyk

Activity

  1. ghost added
    untriaged
    on Aug 27, 2022
  2. RobertHenry6bev commented on Aug 27, 2022

    @RobertHenry6bev
    ContributorAuthor
  3. jkotas commented on Aug 27, 2022

    @jkotas
    Member
  4. jkotas commented on Aug 27, 2022

    @jkotas
    Member

    nproc -all was introduced in dotnet/coreclr#13909

  5. am11 commented on Aug 27, 2022

    @am11
    Member

    This is a good point, and that's how brotli's build uses it

    make -j$(nproc) brotlidec-static

    Lets update all three places:

    eng/native/build-commons.sh  (used in dotnet/diagnostics as well)
    src/tests/Common/scripts/bringup_runtest.sh
    src/tests/build.sh
    
  6. ghost added
    in-pr
    on Aug 27, 2022
  7. ghost removed
    in-pr
    on Aug 30, 2022
  8. ghost removed
    untriaged
    on Aug 30, 2022
  9. ghost locked as resolved and limited conversation to collaborators on Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions