plink-ng
plink-ng copied to clipboard
sysconf(_SC_NPROCESSORS_ONLN) should not be used
Hello,
sysconf(_SC_NPROCESSORS_ONLN)
returns, when possible, the underlying hardware number of online cpu cores, which might not corresponds to the actual number of cores available to the process (through the use of taskset, batch system like slurm, etc...). The consequence is that plink might run in a non optimal way. For example, I've got a user that has submitted a plink job on a 96 cores HPC nodes, in a single core slurm allocation: 95 threads are now fighting for the usage of this core.
The immediate workaround is to use the --threads option to set the number of threads, but I think a more sane behavior would be to use sched_getaffinity
as in https://github.com/opencv/opencv/issues/16268. Gromacs did something similar (https://github.com/gromacs/gromacs/blob/1e6873fadf16d5f5be861e6f9ef5f9923a12e540/src/gromacs/hardware/hardwaretopology.cpp#L1221).
What do you think ?
Thank you.
Okay, I will test this, and include the change in the next release if the results look good.
Thank you for considering this !
Changed in 9df631b .
Fantastic, thank you !
My understanding is that there will be no further development on the 1.9 branch and this will not be backported, correct ?
plink 1.9 is updated much less frequently than 2.0, but this change may be backported during the next update.
Now updated in plink 1.9.