avx-turbo icon indicating copy to clipboard operation
avx-turbo copied to clipboard

Add CPU count override

Open vient opened this issue 3 years ago • 2 comments

Useful when some cores are isolated with isolcpus, setting maximum number of threads gives WARNING: can't run the requested number of threads (4) because there are only 1 available logical CPUs.

vient avatar May 01 '22 19:05 vient

@vient - thanks for the report.

Can you clarify the scenario a little bit? For example are you setting max number of threads using --max-threads=4, but only 1 core is available to the process because of isolcpus?

In that case, I think the warning is correct: it is telling you only 1 CPU is available so it will run only one thread.

travisdowns avatar May 01 '22 21:05 travisdowns

Yes, in my case all cores except first one are isolated so the program thinks that only one CPU is available because sched_getaffinity returns set consisting of only one cpu. It does not prevent setting affinity to other CPUs though, I've tested my patch on machine with 6 cores where 1-5 are isolated, setting --cpus-num 6 successfully performed test on all 6 cores.

If you set cpus-num larger than cores number, program immediately exits because of sched_setaffinity fail in filter_cpus, so you may call this feature harmless in this sense - no wrong results are produced if CPU number is set too high.

vient avatar May 01 '22 22:05 vient