the device being used is no longer there (MATLAB + GPU)
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hi Folks: This bothers me: I have 2 GPU cards on my machine. I designate the 2nd one to use in my MATLBA code, but I got following error:
The device being used is no longer current.
Error in deriv_optcontMxy_cuda (line 18)
gpuderivMxy.GridSize = [min(1024,tmp.MaxGridSize(1)) 1]; % min(1024, maxblocks)
Error in optcontMxyHBG (line 72)
drfn = deriv_optcontMxy_cuda(rfn,gamgdtn,xx,auxa,auxb,a,b,rfmask);
I am not sure why; Here is my code:
persistent gpuderivMxy
persistent drfrt drfit;
Nt = size(rf,1);
Ns = size(xx,1);
Ndim = size(xx,2);
if isempty(gpuderivMxy)
disp 'Initializing GPU drf calculation...';
gpuderivMxy = parallel.gpu.CUDAKernel('deriv_optcontMxy_cuda.ptx','deriv_optcontMxy_cuda.cu','deriv_optcontMxy_cuda');
tmp = gpuDevice(2);
gpuderivMxy.GridSize = [min(1024,tmp.MaxGridSize(1)) 1]; % min(1024, maxblocks)
gpuderivMxy.ThreadBlockSize = [min(128, tmp.MaxThreadsPerBlock) 1 1]; % min(128, maxthreadsperblock)
drfrt = gpuArray(zeros(Ns, Nt));
drfit = gpuArray(zeros(Ns, Nt));
end;
If I do not use tmp = gpuDevice(2), only tmp = gpuDevice(); it has no mistake like above;
Any one has any idea why this is happening? I appreciate it.
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre GPU Computing in MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!