Pro Tip: Pinpointing Runtime Errors in CUDA Fortran

Originally published at: Pro Tip: Pinpointing Runtime Errors in CUDA Fortran | NVIDIA Technical Blog

CUDA Fortran for Scientists and Engineers shows how high-performance application developers can leverage the power of GPUs using Fortran. We’ve all been there. Your CUDA Fortran code is humming along and suddenly you get a runtime error: copyin, copyout, usually accompanied by FAILED in all caps. In many cases, the error message gives you enough information…

I found that if you turn on optimization with -fast flag, those detailed error outputs are gone. What I got are:

0: copyin Memcpy (dev=0x(nil), host=0x0x7f80c2e8b230, size=18446744073709550692) FAILED: 11(invalid argument)
Error: segmentation violation, address not mapped to object

Hi Xinsheng:

Thanks for catching this. You are correct, in fact when using any optimization of -O2 or higher you also need to compile with -g to get the traceback. I've modified the text (including the example) to reflect this.

Thanks again,

Greg