Skip to content

Comments

[WIP] test enabling UB sanitizer#1340

Open
lucafedeli88 wants to merge 16 commits intoHi-PACE:developmentfrom
lucafedeli88:enable_sanitizer
Open

[WIP] test enabling UB sanitizer#1340
lucafedeli88 wants to merge 16 commits intoHi-PACE:developmentfrom
lucafedeli88:enable_sanitizer

Conversation

@lucafedeli88
Copy link
Contributor

  • Small enough (< few 100s of lines), otherwise it should probably be split into smaller PRs
  • Tested (describe the tests in the PR description)
  • Runs on GPU (basic: the code compiles and run well with the new module)
  • Contains an automated test (checksum and/or comparison with theory)
  • Documented: all elements (classes and their members, functions, namespaces, etc.) are documented
  • Constified (All that can be const is const)
  • Code is clean (no unwanted comments, )
  • Style and code conventions are respected at the bottom of https://github.com/Hi-PACE/hipace
  • Proper label and GitHub project, if applicable

@lucafedeli88
Copy link
Contributor Author

@AlexanderSinn , as an experiment, I've tried to enable sanitizers in CI. Like this the test is way too long, although if we use caching for the compilation of AMReX we may be able to keep it around 10 minutes.

The UB/address sanitizer finds some issues with tests related to ionization. I've done some tests on my local machine and it seems that in the following code block ion_lev_loc can be 1 when adk_prefactor has size=1 . So this may be a real bug. What do you think?

amrex::Real w_dtau = gamma_psi * adk_prefactor[ion_lev_loc] *
                std::pow(Ep, adk_power[ion_lev_loc]) *
                std::exp( adk_exp_prefactor[ion_lev_loc]/Ep );

@AlexanderSinn
Copy link
Member

Yes this looks like a real bug. Can you try with #1343

@lucafedeli88
Copy link
Contributor Author

@AlexanderSinn , @MaxThevenet , do you think that having a sanitizer check in CI could be a good idea?
Like this it's way too long, but it's possible that using ccache (like it's done for WarpX) the runtime could be reduced to ~ 10 minutes (most of the compilation time is spent compiling AMReX).

@AlexanderSinn
Copy link
Member

With the runtime being 14 minutes already, excluding compile time, to me that is already too long to do for every PR. I also don't expect this to find problems very frequently. Maybe it could be good to run manually every once in a while, maybe about once a year.

@AlexanderSinn
Copy link
Member

@lucafedeli88 Just to test how much time the compilation would take with caching enabled, can you merge development into this branch and let the CI finish so the ccache will be set? Then do a very small change in one small cpp file so it will be able to use the ccache when compiling.

@lucafedeli88
Copy link
Contributor Author

@AlexanderSinn , I am facing some issues:

  • the caching seems to work only for HIPACE, not for AMReX . A possible solution could be to put the whole AMReX folder in the cache (and add a script to update the cached version when a new one is required)
  • the tests are still a bit long (~ 14 minutes). However, they could split in two-three parts
    What do you think ?

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.

2 participants