Blame view

rts/cuda/error.h 1.3 KB
f1402849   dmayerich   renewed commit
1
2
  #include <stdio.h>

  #include "cuda_runtime.h"

6e257ab3   dmayerich   ENVI and colormap...
3
4
  #include "device_launch_parameters.h"
  #include "cufft.h"

f1402849   dmayerich   renewed commit
5
6
7
8
9
10
11
12
13
14
15
16
  

  #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 );

6e257ab3   dmayerich   ENVI and colormap...
17
  

f1402849   dmayerich   renewed commit
18
19
     	}

  }

6e257ab3   dmayerich   ENVI and colormap...
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  #define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ ))
  
  static void CufftError( cufftResult err )
  {
      if (err != CUFFT_SUCCESS)
      {
          if(err == CUFFT_INVALID_PLAN)
              printf("The plan parameter is not a valid handle.\n");
          if(err == CUFFT_INVALID_VALUE)
              printf("At least one of the parameters idata, odata, and direction is not valid.\n");
          if(err == CUFFT_INTERNAL_ERROR)
              printf("An internal driver error was detected.\n");
          if(err == CUFFT_EXEC_FAILED)
              printf("CUFFT failed to execute the transform on the GPU.\n");
          if(err == CUFFT_SETUP_FAILED)
              printf("The CUFFT library failed to initialize.\n");
  
      }
  }

f1402849   dmayerich   renewed commit
39
40
41
42
  

  

  

  #endif