30 lines
793 B
Plaintext
30 lines
793 B
Plaintext
|
|
#include <iostream>
|
||
|
|
|
||
|
|
#include <cuda_runtime.h>
|
||
|
|
|
||
|
|
#include "cuda_gemm_utils.hpp"
|
||
|
|
|
||
|
|
void check_cuda(cudaError_t err, const char* const func, const char* const file,
|
||
|
|
const int line)
|
||
|
|
{
|
||
|
|
if (err != cudaSuccess)
|
||
|
|
{
|
||
|
|
std::cerr << "CUDA Runtime Error at: " << file << ":" << line
|
||
|
|
<< std::endl;
|
||
|
|
std::cerr << cudaGetErrorString(err) << " " << func << std::endl;
|
||
|
|
std::exit(EXIT_FAILURE);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void check_cuda_last(const char* const file, const int line)
|
||
|
|
{
|
||
|
|
cudaError_t const err{cudaGetLastError()};
|
||
|
|
if (err != cudaSuccess)
|
||
|
|
{
|
||
|
|
std::cerr << "CUDA Runtime Error at: " << file << ":" << line
|
||
|
|
<< std::endl;
|
||
|
|
std::cerr << cudaGetErrorString(err) << std::endl;
|
||
|
|
std::exit(EXIT_FAILURE);
|
||
|
|
}
|
||
|
|
}
|