Skip to content

Commit

Permalink
Use CUDA assert function in device code
Browse files Browse the repository at this point in the history
  • Loading branch information
msimberg committed Nov 13, 2019
1 parent 374068a commit bde31e3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libs/assertion/include/hpx/assertion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// Make HPX inspect tool happy:
// hpxinspect:noinclude:HPX_ASSERT
// hpxinspect:noinclude:HPX_ASSERT_MSG
// hpxinspect:noassert_macro

// Note: There are no include guards. This is intentional.

Expand All @@ -16,6 +17,9 @@
#include <hpx/assertion/source_location.hpp>
#include <hpx/preprocessor/stringize.hpp>

#if defined(HPX_COMPUTE_DEVICE_CODE)
#include <assert.h>
#endif
#include <string>
#include <type_traits>

Expand Down Expand Up @@ -61,8 +65,13 @@ namespace hpx { namespace assertion {
/**/

#if defined(HPX_DEBUG)
#if defined(HPX_COMPUTE_DEVICE_CODE)
#define HPX_ASSERT(expr) assert(expr)
#define HPX_ASSERT_MSG(expr, msg) HPX_ASSERT(expr)
#else
#define HPX_ASSERT(expr) HPX_ASSERT_(expr, std::string())
#define HPX_ASSERT_MSG(expr, msg) HPX_ASSERT_(expr, msg)
#endif
#define HPX_NOEXCEPT_WITH_ASSERT
#else
#define HPX_ASSERT(expr)
Expand Down

0 comments on commit bde31e3

Please sign in to comment.