Unable to compile device code with -g option

I have experienced issues compiling with -g option activated without which otherwise the code compiles well but generates some runtime error I’m unable to track down, I know its because of some illegal memory access but don’t really know which variable this pops from. These are the errors I get from the compiler:

for file 1 , from which I grasp that the error has to do with some texture array I’m using which works well without -g

pgf90 -Mcuda -Minfo  -g -c host_gen_m1.CUF
nvvmCompileProgram error: 9.
Error: /tmp/pgcudafor4BEfOps94U2X.gpu (203, 200): parse error: use of undefined value '@host_gen_m_t_param_array_tex_'
PGF90-F-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (host_gen_m1.CUF: 1)
PGF90/x86-64 Linux 14.10-0: compilation aborted

and file 2 ,

pgf90 -Mcuda -Minfo  -g -c host_subs_m1.CUF
Bad builtin (num params): 521 (__pgf90io_ldw_init)
PGF90-F-0000-Internal compiler error. Unhandled builtin function (num params).       0 (host_subs_m1.CUF: 864)
PGF90/x86-64 Linux 14.10-0: compilation aborted
make: *** [host_subs_m1.o] Error 2

This is the runtime error I get :

$ ./gpuqmc
.......
.......
0: copyout Memcpy (host=0x2aaaac235f00, dev=0x1302080600, size=8) FAILED: 77(an illegal memory access was encountered)

Files:
https://dl.dropboxusercontent.com/u/59996494/host_gen_m1.CUF
https://dl.dropboxusercontent.com/u/59996494/host_subs_m1.CUF

PGI Version:
pgf90 14.10-0 64-bit target on x86-64 Linux -tp istanbul
The Portland Group - PGI Compilers and Tools
Copyright © 2014, NVIDIA CORPORATION. All rights reserved.

NVCC Version:
nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2014 NVIDIA Corporation
Built on Thu_Jul_17_21:41:27_CDT_2014
Cuda compilation tools, release 6.5, V6.5.12

Hi egodfred,

In order to add debug information to the device code, we need to use an LLVM code generator. In 14.10 we defaulted to using a CUDA code generator and only used LLVM when “-g” was added. However the 14.10 LLVM code generator lack support for texture memory as well as calling CUDA system routines such as “printf”.

In 15.1, we moved to using LLVM code generation by default and fixed several issues, including the error you’re seeing with the “host_gen_m1.CUF” file.

Dropbox gives a “file not found” error for “host_subs_m1.CUF” so I can’t look at the code. But the error looks like you have a I/O statement in a device kernel. We added support for I/O to the LLVM code generator in the 15.4 compilers.

One work around you can try with the 14.10 compiler, is add “-Mcuda=nodebug”. You wont get debug information generated for the device code, but will for the host code.

Hope this helps,
Mat