-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] CPU hang on multithreaded benchmarks overriding the memory manager #1849
Comments
you shouldn't need a fixture for this i believe, as the section before the benchmarked loop is only run on thread 0: https://google.github.io/benchmark/user_guide.html#multithreaded-benchmarks "it is guaranteed that none of the threads will start until all have reached the start of the benchmark loop, and all will have finished before any thread exits the benchmark loop". i think you can hugely simplify your code. instead of answering your questions about why the library works the way that it does, what exactly are you trying to do? |
Yes, you are correct, the code to achieve this very specific behavior could be much more simple. This code's purpose is to provide a minimal repro of an API issue. This issue will be encountered in any scenario where you might need to rely on benchmark::State::threads to perform a sync of all of your threads at any point in time in you benchmark. Let me provide more context with a different hypothetical scenario. Now, regardless of any scenario, wouldn't you agree that benchmark::State::threads not behaving as documented and returning an incorrect value (because that is what is is doing) is a flaw here? Thank you for your time. |
why would multithreading affect memory measurement? |
Because you might want to employ different allocation strategies when you encounter contention, for example. This is not the topic of this thread however. |
Describe the bug
Consider a multithreaded benchmark scenario which overrides the memory manager.
In this scenario we want all the benchmark threads to synchronize at a given point in time and we use benchmark::State::threads() to fetch the number of threads that need to be synced.
This leads to a CPU hang because when the memory manager is overriden, BenchmarkRunner::DoOneRepetition() runs a final pass to gather memory statistics on a single thread while recycling a fixture that was designed for multithreaded execution.
Here is a minimal repro scenario:
Why are memory statistics gathered in a multithreaded scenario not following the same path as regular fixture runs?
Why are they recycling a fixture that was built to run in a multithreaded fashion to perform a single threaded test?
The text was updated successfully, but these errors were encountered: