未验证 提交 e0a32074 编写于 作者: Q qingqing01 提交者: GitHub

Fix PADDLE_ASSERT. (#10981)

* Enable assertions in CUDA.

* Fix PADDLE_ASSERT.
上级 106ee9d1
...@@ -17,7 +17,7 @@ limitations under the License. */ ...@@ -17,7 +17,7 @@ limitations under the License. */
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x) #define TOSTRING(x) STRINGIFY(x)
#if defined(__APPLE__) && defined(__CUDA_ARCH__) && !defined(NDEBUG) #if defined(__CUDA_ARCH__)
#include <stdio.h> #include <stdio.h>
#define PADDLE_ASSERT(e) \ #define PADDLE_ASSERT(e) \
do { \ do { \
...@@ -38,6 +38,9 @@ limitations under the License. */ ...@@ -38,6 +38,9 @@ limitations under the License. */
} while (0) } while (0)
#else #else
#include <assert.h> #include <assert.h>
#define PADDLE_ASSERT(e) assert(e) // For cuda, the assertions can affect performance and it is therefore
// recommended to disable them in production code
// https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#assertion
#define PADDLE_ASSERT(e) assert((e))
#define PADDLE_ASSERT_MSG(e, m) assert((e) && (m)) #define PADDLE_ASSERT_MSG(e, m) assert((e) && (m))
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册