Documentation issues
Noticed a few issues in the documentation: https://carstenbauer.github.io/ThreadPinning.jl/stable/refs/api_pinning/
- pinthreads() may not work as expected by the end user. Namely, for such case:
One could expect that 5 Julia threads would be assigned to the first 3 cores:
Which would be consistent with the documentation:
Instead, it is more likely to get something like this:
That is because the number of threads affected is limited by the length of input vector to pinthreads():
https://github.com/carstenbauer/ThreadPinningCore.jl/blob/cb78f3b950af45a3b766bd418806b258eb0ebc90/src/internals.jl#L209
Which is probably intended but may be misleading. I think it is worth mentioning in the documentation this pitfall, which becomes even more important with things like NUMA nodes (part of the threads may be left on another node accidentally) or experiments with oversubscribing.
There is also a typo (highlighted in the screenshot).
- Description of
ThreadPinning.setaffinity_cpuids()is missing: examples forThreadPinning.setaffinity()are there instead.
Hey @SmalRat, thanks for your comments! See my response below.
That is because the number of threads affected is limited by the length of input vector to
pinthreads():carstenbauer/ThreadPinningCore.jl@
cb78f3b/src/internals.jl#L209Which is probably intended but may be misleading. I think it is worth mentioning in the documentation this pitfall, which becomes even more important with things like NUMA nodes (part of the threads may be left on another node accidentally) or experiments with oversubscribing.
The expression socket(1, 1:3) is a logical, system agnostic way of specifying the first three physical cores of a system. On most, but not all, systems with 2-fold SMT it will simply return the vector [0,2,4] indicating CPU IDs which is then passed on to pinthreads. Only pinning as many Julia threads as there have been CPU IDs specified is intended. Otherwise it would be unclear how you want to distribute the Julia threads among the specificed cpu threads. This is also mentioned in the documentation of pinthreads (see the part about nthreads and the length(cpuids) expression). But we should absolutely try to make this more clear in the documentation 👍. Want to give it a shot?
There is also a typo (highlighted in the screenshot).
Please go ahead and fix it. I would appreciate it!
2. Description of
ThreadPinning.setaffinity_cpuids()is missing: examples forThreadPinning.setaffinity()are there instead.
These are typos also: in all examples, setaffinity should be replaced by setaffinity_cpuids.