diff --git a/samples/2_Cookbook/15_static_library/device_functions/hipMain2.cpp b/samples/2_Cookbook/15_static_library/device_functions/hipMain2.cpp index a3c3f8f164..fafbf5a72d 100644 --- a/samples/2_Cookbook/15_static_library/device_functions/hipMain2.cpp +++ b/samples/2_Cookbook/15_static_library/device_functions/hipMain2.cpp @@ -23,8 +23,15 @@ #include #include #include +#include -#define HIP_ASSERT(status) assert(status == hipSuccess) +#define HIP_ASSERT(status) \ + { \ + if ((status != hipSuccess)) { \ + std::cerr << "Failed in: " << __LINE__ << " on hip call: " #status << std::endl; \ + throw std::runtime_error("generic failure"); \ + } \ + } #define LEN 512 extern __device__ int square_me(int);