-1

I have included helper_cuda.h and I am using the checkCudaErrors macro on every CUDA call in my code. I have forced an error through the following code:

checkCudaErrors(cudaMalloc(&GPUCameraData, sizeof(float) /*<-- Should be HCameraData */ ));
checkCudaErrors(cudaMemcpy(GPUCameraData, CPUCameraData, sizeof(HCameraData)
                                                       , cudaMemcpyHostToDevice));

The application simply exits with error code 1, as it should, but no information is printed. If I break on the first line and step into the second line, I see that _cudaGetErrorEnum() in helper_cuda.h does return "cudaErrorInvalidValue", but no information is printed in the output.

The development environment I use is Visual Studio 2013 and I have tested this both in Debug and Release mode.

Note: I have the same issue with OpenGL and glGetError. It seems as if any fprintf(stderr, ...); calls from code that is not directly inside my own file structure will not print anything.

  • 1
    Are you running the program from the command line or within VS? If you are running the program from within VS, try running it from the command line. If the error printout occurs there but not within VS, then you need to inspect your VS configuration (i.e. [figure out where the stderr pipe is routed to...](http://stackoverflow.com/questions/2683249/redirect-stdout-and-stderr-to-the-output-debug-console-of-microsoft-visual-studi)) – Robert Crovella Jul 31 '16 at 16:06
  • @RobertCrovella I routed the stderr pipe to an error log text file and the error messages are now correctly printed there. I will try to figure out how to route them to the output log in the VS IDE. Feel free to add your suggestion as an answer. – henrikdahlberg Aug 24 '16 at 21:52

1 Answers1

-1

The reason might be that you are creating some other type of application than default C++ application(regrading CUDA and OpenGL in your case) i.e. are you compiling this code to a library to be used in another project which is not c++, or some kind of linking issues(which type of project do you have...need information!). I had the same problem when i compiled cuda code to Matlab-Mex file which would print with the command "mexPrintf" not "fprintf" used inside "checkCudaErrors". You might test changing the print command inside helper_cuda.h from fprintf to a command which DOES print info incase you call it from your program.