cuda_handle_error.h
668 Bytes
#include <stdio.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#ifndef CUDA_HANDLE_ERROR_H
#define CUDA_HANDLE_ERROR_H
//handle error macro
static void HandleError( cudaError_t err, const char *file, int line ) {
if (err != cudaSuccess) {
//FILE* outfile = fopen("cudaErrorLog.txt", "w");
//fprintf(outfile, "%s in %s at line %d\n", cudaGetErrorString( err ), file, line );
//fclose(outfile);
printf("%s in %s at line %d\n", cudaGetErrorString( err ), file, line );
//exit( EXIT_FAILURE );
}
}
#define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ ))
#endif