From f76eae4dcada217c013b9ca061e4babd0fc23555 Mon Sep 17 00:00:00 2001 From: Changho Hwang Date: Sun, 19 May 2024 19:39:30 -0700 Subject: [PATCH] Fix assert declaration & add a compile test (#303) --- include/mscclpp/poll_device.hpp | 4 ++-- test/unit/CMakeLists.txt | 1 + test/unit/compile_tests.cu | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 test/unit/compile_tests.cu diff --git a/include/mscclpp/poll_device.hpp b/include/mscclpp/poll_device.hpp index 9ad116f8..90104bd2 100644 --- a/include/mscclpp/poll_device.hpp +++ b/include/mscclpp/poll_device.hpp @@ -17,8 +17,8 @@ extern "C" __device__ void __assert_fail(const char *__assertion, const char *__file, unsigned int __line, const char *__function); #else // !defined(MSCCLPP_DEVICE_HIP) -extern "C" __device__ void __assert_fail(const char *__assertion, const char *__file, unsigned int __line, - const char *__function) __THROW; +extern "C" __host__ __device__ void __assert_fail(const char *__assertion, const char *__file, unsigned int __line, + const char *__function) __THROW; #endif // !defined(MSCCLPP_DEVICE_HIP) #endif // NDEBUG diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index e86bc825..0f010f4a 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -10,4 +10,5 @@ target_sources(unit_tests PRIVATE socket_tests.cc utils_tests.cc utils_internal_tests.cc + compile_tests.cu ) diff --git a/test/unit/compile_tests.cu b/test/unit/compile_tests.cu new file mode 100644 index 00000000..2b732b85 --- /dev/null +++ b/test/unit/compile_tests.cu @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include + +#undef NDEBUG +#include + +#include + +TEST(CompileTest, Assert) { assert(true); }