15 lines
466 B
C++
15 lines
466 B
C++
#pragma once
|
|
#include <iostream>
|
|
#include <hip/hip_runtime.h>
|
|
|
|
#define GPU_CHECK(ans) { gpuAssert((ans), __FILE__, __LINE__); }
|
|
inline void gpuAssert(hipError_t code, const char *file, int line, bool abort=true)
|
|
{
|
|
if (code != hipSuccess)
|
|
{
|
|
std::cerr << "GPU Error: " << hipGetErrorString(code) << " " << file << " " << line << std::endl;
|
|
if (abort) exit(code);
|
|
}
|
|
}
|
|
|
|
#define GPU_CHECK_LAST() { gpuAssert(hipGetLastError(), __FILE__, __LINE__); } |