-
Notifications
You must be signed in to change notification settings - Fork 110
bugfix: Fix axom's MSVC with OpenMP build #1977
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
base: develop
Are you sure you want to change the base?
Conversation
|
Can confirm these changes do fix the failures Axom was seeing in llnl/axom#1769 ! |
| #include "RAJA/config.hpp" | ||
|
|
||
| #include "RAJA/pattern/thread.hpp" | ||
| #if defined(RAJA_ENABLE_OPENMP) |
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.
The include of omp.h should be moved into RAJA/policy/openmp/thread.hpp.
| { | ||
| // This branch handles the case of an OpenMP reduction through the RAJA::kernel | ||
| // abstraction. MSVC is not supported in this case. | ||
| #if !defined(RAJA_COMPILER_MSVC) |
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.
There has to be a different way to do this. This approach will just give the wrong answer silently, and we definitely don't want that.
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 you might be able to use static assert since this is the else branch of an if constexpr.
#if defined(RAJA_COMPILER_MSVC)
static_assert(false, "MSVC does not support an OpenMP reduction through the RAJA::kernel abstraction");
#endif
You might have to make use of the template arguments instead of directly using false in the static_assert, though I found in some simple examples that false worked for clang and gcc.
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.
Axom found some bugs in RAJA's latest release with two root causes:
#1884
#1947
The first led to MSVC attempting to compile some OpenMP pragmas it didn't understand. The second led to undefined symbol names. Both of these are ultimately strange, because our tests and examples do not even compile with
ENABLE_OpenMP=Onwithmsvc. Axom's Windows workflow is to build RAJA without any of the tests and exercises enabled, install RAJA, then only use non-reduction versions of RAJA's OpenMP constructs. This only ever worked because SFINAE and code duplication allowed reduction-free OpenMP code to be compiled by Axom downstream, but RAJA's reduction versions of launch, forall and kernel to go uncompiled.tldr; RAJA + OpenMP + msvc doesn't work in most cases, but axom carved out some use cases that do. This PR retains that functionality.
We might need to add more #ifdef guards to the launch and forall backends
@bmhan12