18 lines
533 B
C++
18 lines
533 B
C++
|
|
||
|
#include <cuda_runtime.h>
|
||
|
#include <cublas_v2.h>
|
||
|
#include <iostream>
|
||
|
|
||
|
#define CHECK_CUDA_ERROR(val) check((val), #val, __FILE__, __LINE__)
|
||
|
template <typename T>
|
||
|
void check(T err, const char* const func, const char* const file,
|
||
|
const int line)
|
||
|
{
|
||
|
if (int(err) != int(cudaSuccess))
|
||
|
{
|
||
|
std::cerr << "CUDA Runtime Error at: " << file << ":" << line << ":" << err
|
||
|
<< std::endl;
|
||
|
// We don't exit when we encounter CUDA errors in this example.
|
||
|
// std::exit(EXIT_FAILURE);
|
||
|
}
|
||
|
}
|