Skip to content

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

Open
Divinesoumyadip wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Divinesoumyadip:fix/macos-nproc-dependencyinstaller
Open

setup: fix macOS thread count using hw.logicalcpu instead of hw.ncpu#4030
Divinesoumyadip wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Divinesoumyadip:fix/macos-nproc-dependencyinstaller

Conversation

@Divinesoumyadip
Copy link

@Divinesoumyadip Divinesoumyadip commented Mar 22, 2026

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.

@Divinesoumyadip
Copy link
Author

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

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

2 participants