Skip to content

incorrect computation of build parallelism #74691

@RobertHenry6bev

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

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