Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Multi-GPU on MATLAB 2013

1 Ansicht (letzte 30 Tage)
Amnah
Amnah am 26 Mai 2014
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
Salam, I am trying to do a MultiGPU implementation in MATLAB2013. But when I copy my array (say A) which i need to divide on multiple gpus, the copy is only made to one gpu, not all. Then I tried to set 4 gpus to 4 matlab workers separately, but the gpuDevice(i) is called inside the parfor loop, and every time the iteration starts, the gpu initializes, and it takes more time than single gpu to implement my code. Kindly help
Also i Attached a different m-file setGPU
function setGPU()
n = (matlabpool('size'));
parfor idx=1:n
t = getCurrentTask()
t.ID
if(t.ID<3)
gpuDevice(1)
end
if(t.ID>2 && t.ID<5)
gpuDevice(2)
end
if(t.ID>4 && t.ID<7)
gpuDevice(3)
end
if(t.ID>6 && t.ID<=8)
gpuDevice(4)
end
end
and called it in my matlabpool function like this:
matlabpool ('open' ,2,'AttachedFiles',setGPU)
but still i can't set 4 separate gpus to 4 separate workers.. any solution ?

Antworten (1)

Edric Ellis
Edric Ellis am 2 Jun. 2014
Bearbeitet: Edric Ellis am 2 Jun. 2014
Why not use SPMD to do this once after you've opened the pool?
matlabpool(...);
spmd
n = numlabs;
if labindex < 3
gpuDevice(1);
end
if labindex > 2 && labindex < 5
gpuDevice(2);
end
...
end

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by