On a HPC cluster environment, CPUs can be given to it via job schedulers, such as Slurm, using cgroups to provide a cpuset to a job. Currently Alicevision (and hence Meshroom) will report the maximum number of processors on the compute node, whilst the job scheduler may have own given access to a limited set of CPUs. Therefore the user has to remember to limit the number of CPUs to what Slurm has given it.
Would it be worth changing the code for get_total_cpus at:
This should return the actual CPUs which are available to the software rather than the total maximum on the node. This may need updates to Cmake to test for existence of sched_getaffinity so fallback to current method can be used, something like:
On a HPC cluster environment, CPUs can be given to it via job schedulers, such as Slurm, using cgroups to provide a cpuset to a job. Currently Alicevision (and hence Meshroom) will report the maximum number of processors on the compute node, whilst the job scheduler may have own given access to a limited set of CPUs. Therefore the user has to remember to limit the number of CPUs to what Slurm has given it.
Would it be worth changing the code for get_total_cpus at:
https://github.com/alicevision/AliceVision/blob/3a0be0fef01d19a0bb1cb5054f23be6591de0301/src/aliceVision/system/cpu.cpp#L133-L143
to be instead use:
This should return the actual CPUs which are available to the software rather than the total maximum on the node. This may need updates to Cmake to test for existence of sched_getaffinity so fallback to current method can be used, something like: