完整部署快照
This commit is contained in:
29
upstream_ref/cuda_gemm_optimization/cuda_gemm_utils.cu
Normal file
29
upstream_ref/cuda_gemm_optimization/cuda_gemm_utils.cu
Normal file
@@ -0,0 +1,29 @@
|
||||
#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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user