Matlab example problems mexversion.c is not found

After some tweaking I was able to get most of the matlab example compile on a Mac; but now I have run into a problem. Namely I get the following error:

[indent]./nvmex -f nvopts.sh Szeta.cu -I/usr/local/cuda/include -L/usr/local/cuda/lib -lcufft -lcudart -Wl,-rpath,/usr/local/cuda/libversion

mex:  /Applications/MATLAB_R2010a.app/extern/src/mexversion.c not a normal file or does not exist.

make: *** [Szeta.mexmaci] Error 1
[/indent]

The file indeed does not exist.
This does not actually look Mac-specific – I suspect would be the same for Linux with any matlab version later than R2008b as they no longer include this particular file (and the standard mex script from Mathworks no longer calls it).
Any way to work around this?

I’m having exactly the same problem. I have MATLAB 2009b 64-bit on Ubuntu, and I’m trying to get the MATLAB and CUDA plugin example to work.

Please let me know if someone comes up with a workaround or solution to this.

Thanks!

Try this other method.

From inside Matlab:

!nvcc -c myfun.cu -Xcompiler -fPIC -I /usr/local/matlab/extern/include

mex myfun.o -L /usr/local/cuda/lib64 -lcudart -lcufft (on Linux)

mex myfun.o -L /usr/local/cuda/lib -lcudart -lcufft (on Mac)

Thanks a lot!!

Looks like it worked – one modification I had to do was to remove the space after “-L” in the “mex” command.

Interestingly the GPU version works slower for me than the pure .m version (34 vs. 12 sec.) – perhaps the card in Mac mini is too weak and/or 256M of memory on it is not enough.