Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: set up multi-thread build for all platforms #2336

Merged
merged 1 commit into from
Jun 4, 2021

Conversation

alexezeder
Copy link
Contributor

@alexezeder alexezeder commented Jun 3, 2021

Few points for this PR, as usual:

  • I use --parallel option of cmake --build subcommand to pass threads count in a cross-compile way, it's available with CMake 3.12+, all containers of GitHub Actions have 3.20+

  • each platform use different approaches to get the number of threads:

    • nproc for Linux, returns 2
    • sysctl -n hw.logicalcpu for macOS, since there is no nproc, returns 3
    • (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors for Windows, returns 2

    of course, these values could be hardcoded according to Supported runners and hardware resources, but since we can retrieve this info, hardcoding is not needed.

  • my results show a decrease of build time for all platforms, but let's look at results for this PR.

@sergiud
Copy link
Contributor

sergiud commented Jun 4, 2021

Is Ninja an option? The generator (-G Ninja) uses the suitable number of parallel processes automatically.

@alexezeder
Copy link
Contributor Author

alexezeder commented Jun 4, 2021

Is Ninja an option?

Ninja is definitely an option, but I just wasn't sure about the correctness of its usage for Windows, where actually some MSVC files are used by default. But maybe we can assume that all generators of CMake work fine and simply use Ninja. 🙂

Another question - is Ninja installed on GitHub Actions?

@sergiud
Copy link
Contributor

sergiud commented Jun 4, 2021

I do not have much experience with Github workflows, but a quick search leads to this Github action.

@vitaut vitaut merged commit 024741b into fmtlib:master Jun 4, 2021
@vitaut
Copy link
Contributor

vitaut commented Jun 4, 2021

This is great, thanks!

I wonder why macOS has more workers 🤔.

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.

3 participants