-g flag causes program to give NaNs


I have a fortran application and I compile it with following flags,

-fast -Mr8 -Mcuda -Minfo=all -Mcache_align -ta=nvidia,cc20 -traceback

Code runs fine with these flags.
When I add the flag -g for debugging information, the code gives NaNs.
Any idea as to why this is happening.

I use,
pgf90 14.3-0 64-bit target on x86-64 Linux -tp nehalem
on c2050 using openmpi-1.7.4.


Hi Amit,

There are a number of possible reasons that this could be happening. For example, it could be caused by using uninitialized variables in your application, or it could be an issue with the compiler.

If you have a way to provide a small test case that reproduces the error, we would be happy to take a look at it . If you could share the application with us, we could potentially take a quick look at it as well. Feel free to send it to trs@pgroup.com, attention Chris.

Best regards,


Unfortunately, I cannot share the application. Also, its a large application so difficult to come up with a small test application.

Is there any option to check if I have uninitialized variables in cuda fortran?


Hi Amit,

Normally I would use Valgrind’s memcheck tool to check for these kinds of problems on a CPU application. However, the use of the GPU in your application throws some wrinkles into that. It looks like someone has developed a Cudagrind extension to Valgrind that works on GPUs:


I’ve never tried it, and can make no claims or warranties about how well it works. However, it might be worth a look to see if it turns up any useful information about your application.

Good luck,