Skip to content

guard printfs in ndebug, addresses #656 - #657

Open
Yurlungur wants to merge 1 commit into
mainfrom
jmm/guard-printf
Open

guard printfs in ndebug, addresses #656#657
Yurlungur wants to merge 1 commit into
mainfrom
jmm/guard-printf

Conversation

@Yurlungur

Copy link
Copy Markdown
Collaborator

PR Summary

As @adamdempsey90 #656, printfs can hurt performance. Here I guard them behind macros.

PR Checklist

  • Adds a test for any bugs fixed. Adds tests for new features.
  • Format your changes by using the make format command after configuring with cmake.
  • Document any new features, update documentation for changes made.
  • Make sure the copyright notice on any files you modified is up to date.
  • After creating a pull request, note it in the CHANGELOG.md file.
  • LANL employees: make sure tests pass both on the github CI and on the Darwin CI
  • If ML was used, make sure to add a disclaimer at the top of a file indicating ML was used to assist in generating the file.
  • If Agentic AI was used, have the AI generate a "proposed changes" markdown file and store it in the plan_histories folder, with a filename the same as the MR number.

If preparing for a new release, in addition please check the following:

  • Update the version in cmake.
  • Move the changes in the CHANGELOG.md file under a new header for the new release, and reset the categories.
  • Maintainers: ensure spackages are up to date:
    • LANL-internal team, update XCAP spackages
    • Current maintainer of upstream spackages, submit MR to spack

Comment on lines 303 to 306
if (verbose) {
printf("root finding reached the maximum number of iterations. likely not "
"converged\n");
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ones without arguments are maybe fine?

@adamdempsey90 adamdempsey90 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess it's a balance since in a production run you might actually want some of this information when things fail. We could maybe still print in those cases but maybe a simpler message that has no extra printf args?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

printf usage in performance critical functions

3 participants