Blame view

rts/cuda_handle_error.h 668 Bytes
f1402849   dmayerich   renewed commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  #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