Page 1 of 1

cula 2.1 with matlab 2010a

PostPosted: Wed Oct 20, 2010 7:53 am
by asempey
Hi admin,

I met a problem of cula with matlab 2010b, according to the blog of interface with matlab
part 1 2 &3, i creat 2 files 1 is culasvd.cpp. the other is culamex.hpp, i succeed the
compilation, so far so good, the mexfile got running correctly, but when i run it again, i got a error of cula runtime. The error is like "culaSelectDevice: Runtime error (36)"

" culaStatus status = culaSelectDevice(2);
checkStatus(status,"culaSelectDevice");
status = culaInitialize();
checkStatus(status, "culaInitialize");"

i have 1 GTX295 and 1 Tesla C1060 in the same PC, so the device 2 (Tesla C1060) is firstly selected

thx for ur replay in advance

Re: cula 2.1 with matlab 2010a

PostPosted: Wed Oct 20, 2010 10:24 am
by john
culaSelectDevice is basically a passthrough for cudaSelectDevice (for convenience). Error 36 corresponds to the same CUDA error number, which is cudaErrorSetOnActiveProcess - basically that your device has already been set, whether manually or implicitly.

Re: cula 2.1 with matlab 2010a

PostPosted: Thu Oct 21, 2010 2:09 am
by asempey
john wrote:culaSelectDevice is basically a passthrough for cudaSelectDevice (for convenience). Error 36 corresponds to the same CUDA error number, which is cudaErrorSetOnActiveProcess - basically that your device has already been set, whether manually or implicitly.


thx for admin's reply, but how can i unbound the selectDevice, cause i need run the mexfile
many times, when the mexfile got this error, it crashed. any solution?

BTW im the prenium user, but i cant post at the private board.

Re: cula 2.1 with matlab 2010a

PostPosted: Thu Oct 21, 2010 6:06 am
by kyle
You could write a very short mex file to be called once at the start of your MATLAB program. We'll need to analyze the ramifications, but we could possibly build some intelligence into culaSetDevice() so that it will only ever call cudaSetDevice() once therefor avoiding the "device set on active process" CUDA error.

(Also, the private support forum does not include Academic discounted users)

Re: cula 2.1 with matlab 2010a

PostPosted: Thu Oct 21, 2010 7:22 am
by john
In CUDA, you cannot unset the device once it is set - that's a part of the programming model. A given thread is permanently bound to a given GPU.

For your script, it is safe to omit the selectDevice call. culaInitialize will bind to a GPU if none has been selected prior to culaInitialize. If you need to bind to a particular GPU, you can make a new mex file that you only run once prior to the mex file that is run repeatedly.

Re: cula 2.1 with matlab 2010a

PostPosted: Fri Oct 22, 2010 6:51 am
by asempey
john wrote:In CUDA, you cannot unset the device once it is set - that's a part of the programming model. A given thread is permanently bound to a given GPU.


thx for ur reply, but i dont agree with u, cuda context management shows that the current
context could be poped with "cuCtxPopCurrent" driver API. A given host thread is bound to a given GPU context, and it could be released.