cula with Matlab

General CULA Dense (LAPACK & BLAS) support and troubleshooting. Use this forum if you are having a general problem or have encountered a bug.

cula with Matlab

Postby lizecn » Wed May 05, 2010 3:25 am

I met a problem when i call cula functions from matlab, by
use of MEX

when i call culaInitial or culaShutdown
Matlab show me a error message, says that this
is not a win32 application, i wanna know if
cula support matlab Mex mode?
lizecn
 
Posts: 6
Joined: Mon Oct 05, 2009 12:30 pm

Re:cula with Matlab

Postby dan » Wed May 05, 2010 4:21 am

CULA works great with Matlab and many users are using it that way. Your problem is most likely an error in the way you've written or compiled your mex code. Try this mex file here that another user has submitted and see if it is causing you problems.

Make sure you're linking in the right CULA lib (32- or 64-bit) and all of its dependencies. Also note that CULA only support Matlab 2009b and later.
dan
Administrator
 
Posts: 61
Joined: Thu Jul 23, 2009 2:29 pm

Re:cula with Matlab

Postby lizecn » Wed May 05, 2010 5:56 am

thanks for ur reply however,

i have checked the file linked, it has been saved as
sgev.c, then i went to matlab 2010a(x64) and run

mex sgesv.c -I"C:\Program Files\CULA\include" -I"C:\CUDA\include" -LC:\CUDA\lib64 -lcudart -lcublas -L"C:\Program Files\CULA\lib64" -lcula

it failed with a error msg: sgesv.c(6) : fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory

so i changed the code to "time.h" and rerun the command mex and it worked.

so far so good, i called [X]=sgev(A,B) in matlab, it failed with the same
error of first post: Invalid MEX-file... is not a valid win32 application.

the CULA lib is 1.3a(x64) with XP 64 of course, the cuda runtime is 2.3 x64
and cublas is 2.3 x64 too. When i just use cublas lib, there is no problem,
so must there is something wrong here.
lizecn
 
Posts: 6
Joined: Mon Oct 05, 2009 12:30 pm

Re:cula with Matlab

Postby Boxed Cylon » Wed May 05, 2010 8:07 am

lizecn wrote:
mex sgesv.c -I"C:\Program Files\CULA\include" -I"C:\CUDA\include" -LC:\CUDA\lib64 -lcudart -lcublas -L"C:\Program Files\CULA\lib64" -lcula



I don't think you can compile it this way, though I could be wrong. The source code in question (written me) is meant to be named as sgesv.cu, for example, and compiled with nvcc. The mex environment needs to be set up to invoke the nvcc compiler when *.cu source code is encountered. The line above just uses the C compiler, seems to me.

I work in a linux environment, however, and can't speak to other situations.
Boxed Cylon
 
Posts: 48
Joined: Fri Oct 16, 2009 8:57 pm

Re:cula with Matlab

Postby lizecn » Wed May 05, 2010 9:11 am

Boxed Cylon wrote:
lizecn wrote:
mex sgesv.c -I"C:\Program Files\CULA\include" -I"C:\CUDA\include" -LC:\CUDA\lib64 -lcudart -lcublas -L"C:\Program Files\CULA\lib64" -lcula



I don't think you can compile it this way, though I could be wrong. The source code in question (written me) is meant to be named as sgesv.cu, for example, and compiled with nvcc. The mex environment needs to be set up to invoke the nvcc compiler when *.cu source code is encountered. The line above just uses the C compiler, seems to me.

I work in a linux environment, however, and can't speak to other situations.


i tried with nvmex(from matlab) which uses nvcc at first to get a .o then uses mex to get a mex executable, but i got the same error, by the way
when i use only cublas and compile the code(.c) on this way, it works, so strange!
lizecn
 
Posts: 6
Joined: Mon Oct 05, 2009 12:30 pm


Return to CULA Dense Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron