Plugin for MATLAB R2008a

These are the updated files (nvmex.pl and nvmexopts.bat ) to compile CUDA plugins in MATLAB R2008a.

You will need to remove the old versions included in the zip file (http://developer.download.nvidia.com/compute/cuda/1_1/Matlab_CUDA-1.1a.zip)
and rename the file nvmex_r2008a.pl to nvmex.pl and the file nvmexopts_r2008a.bat to nvmexopts.bat

Follow the instructions in the original README.

Tested under Windows Xp 32bit and Matlab R2008a.
nvmex_r2008a.zip (22.9 KB)

Hi, (this is a cross-post with http://forums.nvidia.com/index.php?act=ST&…=0#entry429686)

i use this nvmex_r2008a.zip given by mfatica (http://forums.nvidia.com/index.php?showtopic=66961) on my winXPsp3 (32bit). I use CUDA 2.0beta on 8800GTX.
I met below errors when following Matlab_CUDA_1.1\Readme.txt:

QUOTE
E:\Codes\WB\Matlab_CUDA-1.1a\Matlab_CUDA_1.1>mex -setup
Please choose your compiler for building external interface (MEX) files:

Would you like mex to locate installed compilers [y]/n?

Select a compiler:
[1] Lcc-win32 C 2.4.1 in E:\PROGRA~1\MATLAB\R2008a\sys\lcc\bin
[2] Microsoft Visual C++ 2005 in E:\Program Files\Microsoft Visual Studio 8

[0] None

Compiler: 1

Please verify your choices:

Compiler: Lcc-win32 C 2.4.1
Location: E:\PROGRA~1\MATLAB\R2008a\sys\lcc\bin

Are these correct [y]/n? y

Trying to update options file: C:\Documents and Settings\Ke\Application Data\MathWorks\MATLAB\R200
From template:� � � � � � � E:\PROGRA~1\MATLAB\R2008a\bin\win32\mexopts\lccopts.bat

Done . . .



� Warning: The MATLAB C and Fortran API has changed to support MATLAB
� � � � � variables with more than 2^32-1 elements.� In the near future
� � � � � you will be required to update your code to utilize the new
� � � � � API. You can find more information about this at:
� � � � � [url=“http://www.mathworks.com/support/solutions...lution=1-5C27B9”]http://www.mathworks.com/support/solutions...lution=1-5C27B9[/url]
� � � � � Building with the -largeArrayDims option enables the new API.



E:\Codes\WB\Matlab_CUDA-1.1a\Matlab_CUDA_1.1>mex fft2_cuda.c -IG:\CUDA\include -LG:\CUDA\lib -lcud
Writing library for fft2_cuda.mexw32
c:\docume~1\ke\locals~1\temp\mex_nikyfd\fft2_cuda.obj .text: undefined reference to '_cudaMalloc@8
c:\docume~1\ke\locals~1\temp\mex_nikyfd\fft2_cuda.obj .text: undefined reference to '_cudaMemcpy@1
c:\docume~1\ke\locals~1\temp\mex_nikyfd\fft2_cuda.obj .text: undefined reference to '_cufftPlan2d@
c:\docume~1\ke\locals~1\temp\mex_nikyfd\fft2_cuda.obj .text: undefined reference to '_cufftExecC2C
c:\docume~1\ke\locals~1\temp\mex_nikyfd\fft2_cuda.obj .text: undefined reference to '_cufftDestroy
c:\docume~1\ke\locals~1\temp\mex_nikyfd\fft2_cuda.obj .text: undefined reference to ‘_cudaFree@4’

� E:\PROGRA~1\MATLAB\R2008A\BIN\MEX.PL: Error: Link of ‘fft2_cuda.mexw32’ failed.

i learn from the head of fft2_cuda.c that says “Setup the mex build from a Matlab shell: mex -setup”, so i chose [1] rather than vc as mex compiler.

thanks for suggestions! Best!

The script is expecting Visual Studio, if you use a different compiler you will need to change the syntax of the linker and compiler flags.

Lastly, I found it. It worked for me (windows XP 32bit, Matlab 2009a). Thank you.
I wonder though why nvidia doesn’t provide it through the web-site…

Thanks a lot mfatica.
The two scripts work well under Matlab R2009a and vista 32 home edition.

Hi!
I have some troubles. I use the updated files (nvmex.pl and nvmexopts.bat ) to compile CUDA plugins in MATLAB R2008a, and met error:

nvmex -f nvmexopts.bat Szeta.cu -IC:\cuda\include -LC:\cuda\lib -lcufft -lcudart
nvcc fatal : Cannot find compiler ‘cl.exe’ in PATH

C:\PROGRA~1\MATLAB\R2008A\BIN\NVMEX.PL: Error: Compile of ‘Szeta.cu’ failed.

??? Error using ==> nvmex at 206
Unable to complete successfully.

Can anybody help me with this problem?

I have Windows 7, visual studio 2008, cudasdk 2.2

When I had this problem the PATH to cl.exe was not correct in my nvmexopts.bat file. I have currently have

set VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 8

but I got and error when the file was set to

set VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0

because this was a file I downloaded off this site and I think the user had a newer version of VS.

The file cl.exe was located in

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin

I think nvmexopts.bat needs to have a path set that will get you to the correct directory, but I am new to this and may be wrong.

I don’t have it working yet, but I don’t get this error anymore.

I can’t download attached file. There’s HTTP 500 internal server error message.

Hi !
After doing all the previous operations ( the sdk works well), I put this line on matlab
nvmex -f nvmexopts.bat cudaMallocAndMemcpy.cu -IC:\cuda\include -LC:\cuda\lib -lcudart

it gaves me
Could not find the compiler “nvcc” on the DOS path.

Could somebody help me ?
thanks !!!