Commit 3eb12494c4fa5dd693e80d824ebe20f538aaf700
1 parent
a23c4132
removed CUDA dependence in colormap.h
Showing
2 changed files
with
24 additions
and
22 deletions
Show diff stats
cuda/error.h
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <iostream> | 2 | #include <iostream> |
3 | -using namespace std; | ||
4 | -#include "cuda_runtime.h" | 3 | +using namespace std; |
4 | +#include "cuda_runtime.h" | ||
5 | #include "device_launch_parameters.h" | 5 | #include "device_launch_parameters.h" |
6 | -#include "cufft.h" | ||
7 | - | ||
8 | -#ifndef CUDA_HANDLE_ERROR_H | ||
9 | -#define CUDA_HANDLE_ERROR_H | ||
10 | - | ||
11 | -//handle error macro | ||
12 | -static void HandleError( cudaError_t err, const char *file, int line ) { | ||
13 | - if (err != cudaSuccess) { | ||
14 | - //FILE* outfile = fopen("cudaErrorLog.txt", "w"); | ||
15 | - //fprintf(outfile, "%s in %s at line %d\n", cudaGetErrorString( err ), file, line ); | ||
16 | - //fclose(outfile); | ||
17 | - printf("%s in %s at line %d\n", cudaGetErrorString( err ), file, line ); | ||
18 | - //exit( EXIT_FAILURE ); | ||
19 | - | ||
20 | - } | ||
21 | -} | 6 | +#include "cufft.h" |
7 | + | ||
8 | +#ifndef CUDA_HANDLE_ERROR_H | ||
9 | +#define CUDA_HANDLE_ERROR_H | ||
10 | + | ||
11 | +//handle error macro | ||
12 | +static void HandleError( cudaError_t err, const char *file, int line ) { | ||
13 | + if (err != cudaSuccess) { | ||
14 | + //FILE* outfile = fopen("cudaErrorLog.txt", "w"); | ||
15 | + //fprintf(outfile, "%s in %s at line %d\n", cudaGetErrorString( err ), file, line ); | ||
16 | + //fclose(outfile); | ||
17 | + printf("%s in %s at line %d\n", cudaGetErrorString( err ), file, line ); | ||
18 | + //exit( EXIT_FAILURE ); | ||
19 | + | ||
20 | + } | ||
21 | +} | ||
22 | #define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ )) | 22 | #define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ )) |
23 | 23 | ||
24 | static void CufftError( cufftResult err ) | 24 | static void CufftError( cufftResult err ) |
@@ -41,8 +41,8 @@ static void CufftError( cufftResult err ) | @@ -41,8 +41,8 @@ static void CufftError( cufftResult err ) | ||
41 | cout<<"Unknown error: "<<err<<endl; | 41 | cout<<"Unknown error: "<<err<<endl; |
42 | 42 | ||
43 | } | 43 | } |
44 | -} | ||
45 | - | ||
46 | - | ||
47 | - | 44 | +} |
45 | + | ||
46 | + | ||
47 | + | ||
48 | #endif | 48 | #endif |
visualization/colormap.h
@@ -3,7 +3,9 @@ | @@ -3,7 +3,9 @@ | ||
3 | 3 | ||
4 | #include <string> | 4 | #include <string> |
5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
6 | +#ifdef __CUDACC__ | ||
6 | #include "../cuda/error.h" | 7 | #include "../cuda/error.h" |
8 | +#endif | ||
7 | 9 | ||
8 | //saving an image to a file uses the CImg library | 10 | //saving an image to a file uses the CImg library |
9 | //this currently throws a lot of "unreachable" warnings (as of GCC 4.8.2, nvcc 6.5.12) | 11 | //this currently throws a lot of "unreachable" warnings (as of GCC 4.8.2, nvcc 6.5.12) |