doc: Change nproc in docs to getconf _NPROCESSORS_ONLN #30619

pull l0rinc wants to merge 1 commits into bitcoin:master from l0rinc:paplorinc/nproc changing 4 files +14 −8
  1. l0rinc commented at 4:01 pm on August 9, 2024: contributor

    Split out of https://github.com/hebasto/bitcoin/pull/316/files#r1711537463

    nproc is linux only, getconf _NPROCESSORS_ONLN is used in the Linux kernel for the same task (works on Mac as well): https://github.com/torvalds/linux/blob/master/tools/testing/selftests/rcutorture/bin/kvm-build.sh#L44

    On linux:

    0# nproc
    18
    2root@rescue ~ # getconf _NPROCESSORS_ONLN
    38
    

    Note that in the productivity doc the recommended core count is one less than before, seems simpler to me this way.

  2. DrahtBot commented at 4:01 pm on August 9, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #30712 (fuzz: Add missing fuzz targets to cmake build by maflcko)
    • #30454 (build: Introduce CMake-based build system by hebasto)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  3. l0rinc force-pushed on Aug 9, 2024
  4. l0rinc renamed this:
    Change `nproc` in docs to `getconf _NPROCESSORS_ONLN`
    doc: Change `nproc` in docs to `getconf _NPROCESSORS_ONLN`
    on Aug 9, 2024
  5. DrahtBot added the label Docs on Aug 9, 2024
  6. in doc/productivity.md:74 in 6d7bf8ea8c outdated
    70+make -j$(getconf _NPROCESSORS_ONLN)
    71+```
    72+
    73+Or is you're on Linux you can even do:
    74+```sh
    75+make -j$(nproc)
    


    hodlinator commented at 10:12 am on August 13, 2024:

    Typo “Or is” -> “Or if”, also missing empty line before next block. My suggestion:

    0Linux has the less verbose:
    1
    2```sh
    3make -j$(nproc)
    

    l0rinc commented at 12:53 pm on August 13, 2024:

    Done, thanks!

    These files are also edited during the CMake migration, we can finalize the details once that’s merged.

  7. hodlinator commented at 11:32 am on August 13, 2024: contributor

    Reviewed 6d7bf8ea8c11d95ae1cd5b803c151d07cdc2f8d6

    Long-time devs state how MacOS is not a supported development platform, and this change does make things more verbose, so I’m curious to get their take. But I’m happy to see there is a way that works for both.

    Verified that it does seem to be the right identifier to query by reading: https://www.gnu.org/software/libc/manual/html_node/Processor-Resources.html

    You are not changing doc/fuzzing.md which was linked in #30619#issue-2458230769?

  8. Change nproc in docs to getconf _NPROCESSORS_ONLN
    nproc is linux only, getconf _NPROCESSORS_ONLN is used in the Linux kernel for the same task: https://github.com/torvalds/linux/blob/master/tools/testing/selftests/rcutorture/bin/kvm-build.sh#L44
    
    Co-authored-by: Hodlinator <172445034+hodlinator@users.noreply.github.com>
    7f8e80b662
  9. l0rinc force-pushed on Aug 13, 2024
  10. maflcko commented at 7:48 am on August 14, 2024: member

    nproc is linux only

    I don’t think this is true. I don’t have a mac, but I fail to see why installing it won’t work. Also, a bash alias similar to alias nproc="sysctl -n hw.logicalcpu" or alias nproc="getconf _NPROCESSORS_ONLN" should work as well.

    No objection to changing this, but I think the claim that nproc is linux-only may not be true.

  11. l0rinc commented at 9:07 am on August 14, 2024: contributor
    Thanks @maflcko, I would actually prefer mentioning nproc (+ alternatives) only once in the docs - will be easier after the cmake PR updates are merged.
  12. hebasto added the label Needs CMake port on Aug 16, 2024
  13. DrahtBot added the label Needs rebase on Aug 28, 2024
  14. DrahtBot commented at 9:57 am on August 28, 2024: contributor

    🐙 This pull request conflicts with the target branch and needs rebase.

  15. l0rinc closed this on Aug 28, 2024

  16. laanwj commented at 9:10 pm on August 28, 2024: member
    it is true that getconf _NPROCESSORS_ONLN works on macos out of the box, while nproc isn’t installed by default, but the identifier is so ugly and hard to type i find it an questionable improvement documentation-wise
  17. l0rinc commented at 9:13 pm on August 28, 2024: contributor

    i find it an questionable improvement documentation-wise

    Yeah, would require more thorough doc updates to clarify that - agree, not worth it

  18. l0rinc deleted the branch on Aug 28, 2024
  19. maflcko removed the label Needs CMake port on Aug 29, 2024
  20. maflcko commented at 9:06 am on September 20, 2024: member

    Just for reference, the change would be wrong anyway, because the two are used to return different values

    0$ podman run --cpuset-cpus=0-1 --rm ubuntu:noble nproc 
    12
    2$ podman run --cpuset-cpus=0-1 --rm ubuntu:noble getconf _NPROCESSORS_ONLN
    316
    
  21. l0rinc commented at 9:45 am on September 20, 2024: contributor
    Yeah, I hated how verbose that was. But did a search again and it seems coreutils adds nproc support, so pushed a PR adding that in the OSx docs: https://github.com/bitcoin/bitcoin/pull/30936/files

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me