[Tarantool-patches] [PATCH luajit 1/3] ci: fix --parallel argument for MacOS runners

Sergey Bronnikov sergeyb at tarantool.org
Tue Jul 5 20:20:08 MSK 2022


Igor,

I found that hw.ncpu sysctl setting is deprecated and it is recommended 
to use

hw.logicalcpu, hw.logicalcpu_max, hw.physicalcpu, or hw.physicalcpu_max.

I believe hw.logicalcpu is the best choice for our case.

macOS manual pages are unavailable on apple.com [1], but there are other 
places:
[2], [3], [4].


1. 
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/sysctlbyname.3.html
2. https://www.unix.com/man-page/mojave/3/sysctlbyname/
3. Use of deprecated hw.ncpu https://github.com/ziglang/zig/issues/1252
4. sysctl name "hw.ncpu" (HW_NCPU) is deprecated in Mac OS X 
https://gitlab.haskell.org/ghc/ghc/-/issues/8594


Sergey

On 22.06.2022 18:33, Igor Munkin wrote:
> In scope of the commit 4195eb8f7e2abcf75f92eedd2859b7991cc8b363 ("ci:
> make GitHub workflows more CMake-ish") --parallel value has been
> explicitly set to $(nproc) + 1, since -j default behaviour differs for
> Ninja and GnuMake. However, MacOS lacks nproc command, but CI silently
> continues to execute pipeline.
>
> This patch fixed MacOS-specific workflows changing nproc command with
> sysctl -n hw.ncpu.
>
> Signed-off-by: Igor Munkin <imun at tarantool.org>
> ---
>   .github/workflows/macos-m1.yml     | 4 ++--
>   .github/workflows/macos-x86_64.yml | 4 ++--
>   2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/.github/workflows/macos-m1.yml b/.github/workflows/macos-m1.yml
> index 8387bbcf..d1d144f0 100644
> --- a/.github/workflows/macos-m1.yml
> +++ b/.github/workflows/macos-m1.yml
> @@ -68,6 +68,6 @@ jobs:
>         - name: configure
>           run: ${ARCH} cmake . ${{ matrix.CMAKEFLAGS }} -DLUAJIT_ENABLE_GC64=${{ matrix.GC64 }}
>         - name: build
> -        run: ${ARCH} cmake --build . --parallel $(($(nproc) + 1))
> +        run: ${ARCH} cmake --build . --parallel $(($(sysctl -n hw.ncpu) + 1))
>         - name: test
> -        run: ${ARCH} cmake --build . --parallel $(($(nproc) + 1)) --target test
> +        run: ${ARCH} cmake --build . --parallel $(($(sysctl -n hw.ncpu) + 1)) --target test
> diff --git a/.github/workflows/macos-x86_64.yml b/.github/workflows/macos-x86_64.yml
> index 2ab2c8d0..a7c2f4e3 100644
> --- a/.github/workflows/macos-x86_64.yml
> +++ b/.github/workflows/macos-x86_64.yml
> @@ -63,6 +63,6 @@ jobs:
>         - name: configure
>           run: cmake . ${{ matrix.CMAKEFLAGS }} -DLUAJIT_ENABLE_GC64=${{ matrix.GC64 }}
>         - name: build
> -        run: cmake --build . --parallel $(($(nproc) + 1))
> +        run: cmake --build . --parallel $(($(sysctl -n hw.ncpu) + 1))
>         - name: test
> -        run: cmake --build . --parallel $(($(nproc) + 1)) --target test
> +        run: cmake --build . --parallel $(($(sysctl -n hw.ncpu) + 1)) --target test


More information about the Tarantool-patches mailing list