NVMex Issues


I am using nvmex to compile my .cu code from matlab. So far I have been able to manage the most accept for the following issues which I need solution to at the earliest:

  1. I am unable to use error handlers (CUDA_SAFE_CALL). The nvmex compilation of .cu code gives errors.
  2. I am having trouble compiling for “device emulation” mode. My current command line input for compilation is:
    nvmex -f nvmexopts.bat -g dericheCSDEMD.cu -IC:\cuda\include -LC:\cuda\lib -lcudart -lcufft -lcutil
  3. I cannot use “memset” for the host-section of the .cu code.

Will be thankful if someone can please help me with the above.

Also, I needed to understand the various utilities that the include files like cuda.h, cudart.h, cutil.h, cuda_runtime.h, cuda_runtime_api.h, etc. offer, the differences between them, etc. Google-ing did not help much. Can someone please quote a good source? This understanding may help me resolve similar issues as quoted above.

Thanks & regards,


common nvmex issues and solutions are posted here

Hi Janaka,

I am using CUDA code to speedup my matlab (version R2008a) computations and I am getting speedups of over 200. The trouble is that, I am using the code for an optimization technique where even though my CUDA results match within first 7 decimal places of accuracy for every element of my matrix (4 million entries), my code doesnt converge.

So, I moved to a double precision supporting card (GTX280) and now I am having troubles getting the GPU to do double precision computations. The kernel returns my matrices with garbage values. I browsed internet for solutions and some people talked about adding flags to the COMPFLAGS line of the nvmexopts.bat file but it didnt really work for me.

So I was wondering if you have a modified nvmexopts.bat file available for download which works with GPUs that support double precision computation? Or if now, do you know how to make this work?

Thanks a bunch

Makarand Datar

Graduate Student

Simulation Based Engineering Lab

University of Wisconsin-Madison

What I understand is, to enable double precision on a 1.3 compute capability GPU device (say GTX280), we need to pass the flag “-arch sm_13” without the quotes to the compiler (ie. nvcc -arch sm_13 ).

But I am using the nvmex (MATLAB plug-in for CUDA). My current command line input for device execution mode in single precision is:
nvmex -f nvmexopts.bat -g .cu -IC:\cuda\include -LC:\cuda\lib -lcufft -lcublas -lcudart

I tried different ways to modify the command line input and/or the nvmexopts.bat to accommodate the flag -arch sm_13, but nothing has worked. My GPU kernel returns crap when all floats are converted to double (i.e. all variable types are double) with any such modification. This doesn’t happen in the device emulation mode.

I do not understand the compiler options very logically and so would appreciate if someone could help me with how to incorporate -arch sm_13 flag with nvmex.

Thanks & regards,