-
Notifications
You must be signed in to change notification settings - Fork 27
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 HIP assert in SLIC macros #1498
Conversation
d65797a
to
453111d
Compare
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.
Thanks @bmhan12
Please update the RELEASE-NOTES to indicate that SLIC_ASSERTs now work w/ hip as well as restrictions (if any)
// Use assert when on device | ||
#elif defined(AXOM_DEBUG) && defined(AXOM_DEVICE_CODE) | ||
#if !defined(__HIP_DEVICE_COMPILE__) | ||
#define SLIC_ASSERT(EXP) assert(EXP) | ||
#define SLIC_ASSERT_MSG(EXP, msg) assert(EXP) | ||
#define SLIC_CHECK(EXP) assert(EXP) | ||
#define SLIC_CHECK_MSG(EXP, msg) assert(EXP) | ||
#else | ||
// AXOM_DEBUG is defined so the expression and message cannot be ignored | ||
// as they probably contain parameters that were decorated with AXOM_UNUSED_PARAM | ||
// which will require the expression and message to be used to avoid warnings. | ||
// Here we use them in a way that will not really have a runtime effect. | ||
// The msg code block may contain << operators so we need a stream-like object | ||
// but we enclose it in "if(false)" so it never executes. | ||
namespace axom | ||
{ | ||
namespace slic | ||
{ | ||
namespace internal | ||
{ | ||
class blackhole | ||
{ }; | ||
// Write an object to a blackhole. | ||
template <typename T> | ||
AXOM_HOST_DEVICE inline blackhole &operator<<(blackhole &bh, T) | ||
{ | ||
return bh; | ||
} | ||
} // namespace internal | ||
} // namespace slic | ||
} // namespace axom | ||
|
||
#define SLIC_ASSERT(EXP) ((void)(EXP)) | ||
#define SLIC_ASSERT_MSG(EXP, msg) \ | ||
{ \ | ||
if(false) \ | ||
{ \ | ||
((void)(EXP)); \ | ||
axom::slic::internal::blackhole __oss; \ | ||
__oss << msg; \ | ||
} \ | ||
} | ||
#define SLIC_CHECK(EXP) ((void)(EXP)) | ||
#define SLIC_CHECK_MSG(EXP, msg) \ | ||
{ \ | ||
if(false) \ | ||
{ \ | ||
((void)(EXP)); \ | ||
axom::slic::internal::blackhole __oss; \ | ||
__oss << msg; \ | ||
} \ | ||
} | ||
#endif | ||
#define SLIC_ASSERT(EXP) assert(EXP) | ||
#define SLIC_ASSERT_MSG(EXP, msg) assert(EXP) | ||
#define SLIC_CHECK(EXP) assert(EXP) | ||
#define SLIC_CHECK_MSG(EXP, msg) assert(EXP) | ||
|
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 there a version of hip/rocm where this starts working and an earlier version where it doesn't work?
} | ||
#endif | ||
#define SLIC_ASSERT(EXP) assert(EXP) | ||
#define SLIC_ASSERT_MSG(EXP, msg) assert(EXP) |
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.
Are there restrictions on msg
?
E.g. can only be a simple c-style string and not an iostream expression or fmt
formatted string?
Please not these restrictions, if any, here
6e6a3b2
to
35b5e4b
Compare
…recipe accordingly, and undo NDEBUG requirement for mesh_tester hip policy
716bde3
to
f902598
Compare
Re-requesting reviews since the PR has expanded to include host-config changes and a Gitlab CI change to fix ruby jobs after the LC update. |
@@ -181,7 +181,7 @@ void Input::parse(int argc, char** argv, axom::CLI::App& app) | |||
#ifdef AXOM_USE_CUDA | |||
pol_sstr << "\nSet to 'raja_cuda' or 3 to use the RAJA CUDA policy."; | |||
#endif | |||
#if defined(AXOM_USE_HIP) && defined(NDEBUG) | |||
#if defined(AXOM_USE_HIP) |
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.
This isn't related to your changes, but is there a better way to do this than to have integral values, which IMO are opaque. Maybe, leave those out of the string and just say Set to 'raja_omp' etc.?
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.
Thank you @bmhan12
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.
Thank you @bmhan12
@@ -7,7 +7,7 @@ | |||
# This is the shared configuration of jobs for ruby | |||
.on_ruby: | |||
variables: | |||
SCHEDULER_PARAMETERS: "--res=ci --exclusive=user --deadline=now+1hour -N1 -t ${ALLOC_TIME}" | |||
SCHEDULER_PARAMETERS: "--reservation=ci --exclusive=user --deadline=now+1hour -N1 -t ${ALLOC_TIME}" |
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.
This change is blocking other PRs. Can it be pulled into its own PR? Or can this be PR be merged?
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'll merge it.
This PR
assert
for HIP in theSLIC_ASSERT_*
andSLIC_CHECK_*
macros.EDIT:
CMAKE_CXX_FLAGS_DEBUG
to actually allowassert()
for rocm builds.mesh_tester
working with a hip policy in Enable HIP policy for mesh_tester #1151,-DNDEBUG
was added to the debug flags.assert()
for debug rocm builds.CMAKE_CXX_FLAGS_DEBUG
change%cce
debug builds require some optimization (-O1
) to compile without cray compiler errors (error is of the form:PLEASE submit a bug report to Cray and include the crash backtrace, preprocessed source, and associated run script. Stack dump: ...
).NDEBUG
inmesh_tester
EDIT 2:
sbatch
option for Gitlab CI ruby jobs:res=ci
-->reservation=ci
.res
is no longer recognized as an option: