-
Notifications
You must be signed in to change notification settings - Fork 37
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
Enable sanitizers for extended CI host build #1114
Conversation
Tests are expected to fail until the issues are fixed in other PRs: https://github.com/parthenon-hpc-lab/parthenon/actions/runs/9522754529/job/26252926684 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be nice to have this automatically. Hopefully will catch bugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I agree that this will help us catch some subtler issues before they can enter develop
.
- name: Set vars based on matrix | ||
id: cmake-vars | ||
run: | | ||
if ${{ matrix.device == 'host' }}; then | ||
echo "enable_asan=ON" >> $GITHUB_OUTPUT | ||
else | ||
echo "enable_asan=OFF" >> $GITHUB_OUTPUT | ||
fi | ||
|
||
- name: Configure | ||
run: | | ||
cmake -B build \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DENABLE_ASAN=${{ steps.cmake-vars.outputs.enable_asan }} \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a common pattern?
Might sth like
-DENABLE_ASAN=${${{ matrix.device == 'host' }}^^} \
work, too?
Or if that one line logic doesn't work using an env var:
env:
ENABLE_ASAN: ${{ matrix.device == 'host' }}
with (the ^^
to uppercase the lowercase result in the env var):
-DENABLE_ASAN=${ENABLE_ASAN^^} \
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bash outputs 1
for true and 0
for false, so I don't think that works, unless CMake translates 1
to ON
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should
"True if the constant is 1, ON, YES, TRUE, Y, or a non-zero number (including floating point numbers)." from https://cmake.org/cmake/help/latest/command/if.html
But I think GitHub actions only returns (lowercase) true
or false
for expressions so that's why we need to convert it to uppercase.
Probably need to disable LeakSanitizer for MPI runs due to the memory leaks in OpenMPI we can't do anything about... |
AddressSanitizer and UndefinedBehaviorSanitizer run without workings, but some tests have memory leaks that cause LeakDetector to fail. |
Rather than try to chase down every memory leak in the unit tests, I've just disabled memory leak detection entirely. |
I think that's the right thing but we should leave the memory leak test in place in the cmake so we can trigger it locally. Because someone should start trying to track these down over time. :) |
PR Summary
Enable sanitizers (e.g., AddressSanitizer, UndefinedBehaviorSanitizer, etc.) for the extended CI host build. It is not enabled for the CUDA build, since CUDA does not support sanitizers.
Memory leak detection is currently disabled (does not work with OpenMPI, several unit tests have memory leaks).
Depends on:
shared_ptr
cycle inTree
#1112PR Checklist