-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[BUG] Core Affinity doesn't seem to work (Or Reporter wrong?) #1812
Comments
Doesn't core affinity only ensure that the main thread stays on the same CPU, https://man7.org/linux/man-pages/man1/taskset.1.html
|
I agree. What's the meaning of That does not indicate any threading decisions by benchmark instead it enumerates the number of CPU cores of the test system? Equivalently, if |
I think so, yes. |
we could fix the |
That would be wonderful, but I wonder if that solves only one-half of the issue? If no affinity is set (0xFFFFFFF is returned), should the benchmark report that it runs on all cores? I think the benchmark is not scheduled to run in parallel on different cores, or? However, particularly when the system is a hybrid architecture and consists of "performance" and "efficient" cores, reporting the affinity is useful, I think. |
Describe the bug
I would like to run the benchmark on a particular CPU core. The [docs]( says:
However, when I run the
basic_test
app, I see the following:I think it might be reporting here that is wrong. Looking at
top
, I can verify that only core 0 is used. The code inreporter
[https://github.com/google/benchmark/blob/main/src/reporter.cc#L49C29-L49C37) seems to use a static number of cores.System
Which OS, compiler, and compiler version are you using:
To reproduce
Steps to reproduce the behavior:
ea71a14891474943fc1f34d359f9e0e82476ffe1
cmake -D BENCHMARK_DOWNLOAD_DEPENDENCIES=1 -S . -B build
cmake --build build/ -j20
taskset -c 0 ./build/test/basic_test
Expected behavior
I would expect the test to run only on core 0 and the output of the test be:
Run on (1 X 4700 MHz CPU s)
instead ofRun on (24 X 4700 MHz CPU s)
The text was updated successfully, but these errors were encountered: