I’m looking for someone who knows exactly how to use cuda-memcheck to check a cuda kernel that’s being run inside a Matlab MEX file. I’ve tried to accomplish this “feat” based on my interpretation of this post. However, when I run cuda-memcheck with an out of bounds global memory access intentionally inserted into my kernel to see if the memchecker is working, I get 0 errors reported. Maybe someone here can tell me what I’m doing wrong. My approach to implementing what’s mentioned in the above post is as follows:
I compile the .cu file into a .ptx file using nvcc (using -G for debug). From what I understand, the .ptx file is what the Matlab compiler requires in order to compile a .cu MEX file into a standalone application/.exe file. I then use Matlab’s deploytool to create this standalone application (to do this I include the .ptx generated by nvcc, and the Matlab .m file mentioned above, and the .mexa64 file which mex generates). The Matlab compiler generates an executable and a shell script to set up the environment and run said executable. Then, from the Linux command prompt, I run:
cuda-memcheck --continue [script_to_run_executable] [matlab_root_directory]
The executable runs to completion, but cuda-memcheck reports 0 errors, even when I explicitly put an out of bounds global memory access in the cuda kernel.
I’ve also tried setting up the shell environment exactly the same way that the shell script does, and passing the executable generated by the Matlab compiler directly to cuda-memcheck and have, once again, had 0 errors reported by the memchecker, when I explicitly put an out of bounds access in my kernel.
If anyone can tell me where I’m going wrong, I would greatly appreciate it!!!
I’m using a gtx580 with toolkit 4.0, and driver 270.41.19 on Centos 5.4