Skip to content
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

Optimize logger implementation #1254

Merged
merged 2 commits into from
Feb 20, 2024
Merged

Optimize logger implementation #1254

merged 2 commits into from
Feb 20, 2024

Conversation

bmhowe23
Copy link
Collaborator

@bmhowe23 bmhowe23 commented Feb 18, 2024

This PR bypasses some processing if the current log level prevents the message from actually being logged.

For the most part, this means that we check the log level before calling fmt::format(). However, note that some log messages form strings outside of the cudaq::info structs and then pass the result into the cudaq::info() structs. We cannot optimize those out without more invasive code changes, which for the most part, I've left for a future task. The only exception to that was one particularly hot piece of code in runtime/nvqir/CircuitSimulator.h, where I've wrapped it in a new cudaq::details::should_log() function.

Testing on Gorby with some UCCSD benchmarks from @marwafar reveals these changes reduce runtime by 17-32%, but as always, YMMV.

Bypass some processing if the log level means that the message wasn't
actually going to be logged.
@bmhowe23 bmhowe23 added this to the release 0.7.0 milestone Feb 18, 2024
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Feb 18, 2024
Copy link
Collaborator

@amccaskey amccaskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@bmhowe23 bmhowe23 enabled auto-merge (squash) February 20, 2024 13:56
@bmhowe23 bmhowe23 merged commit 32acd6c into NVIDIA:main Feb 20, 2024
133 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 20, 2024
@bmhowe23 bmhowe23 deleted the pr-opt-logger branch February 20, 2024 14:29
@bettinaheim bettinaheim added the release notes Changes need to be captured in the release notes label Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
performance release notes Changes need to be captured in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants