Skip to content

setup: fix macOS thread count using hw.logicalcpu instead of hw.ncpu - #4030

Merged
vvbandeira merged 1 commit into
The-OpenROAD-Project:masterfrom
Divinesoumyadip:fix/macos-nproc-dependencyinstaller
Mar 24, 2026
Merged

vvbandeira merged 1 commit into
The-OpenROAD-Project:masterfrom
Divinesoumyadip:fix/macos-nproc-dependencyinstaller

Conversation

@Divinesoumyadip

@Divinesoumyadip Divinesoumyadip commented Mar 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4028

Currently, etc/DependencyInstaller.sh uses sysctl -n hw.ncpu to determine the thread count on macOS. However, hw.ncpu only returns the number of physical cores. This ends up underestimating the available parallelism, particularly on Intel Macs that utilize hyperthreading.

This PR replaces hw.ncpu with hw.logicalcpu. hw.logicalcpu correctly returns all logical cores (including hyperthreaded ones), making it the exact macOS equivalent to the nproc command on Linux.

  • On an Intel Mac with 4 physical cores and hyperthreading, hw.ncpu returns 4, while hw.logicalcpu correctly returns 8.
  • On Apple Silicon (e.g., an M2 with 10 cores), both commands return 10.

This swap ensures we are fully utilizing the available CPU resources to speed up dependency installation on macOS.

Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
@Divinesoumyadip

Copy link
Copy Markdown
Contributor Author

@maliberty @luarss could you approve the workflows to run CI? Happy to address any review feedback.

@vvbandeira
vvbandeira merged commit 29b24bc into The-OpenROAD-Project:master Mar 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Build] setup: nproc command not found crashes DependencyInstaller.sh on macOS

4 participants