Info

此问题已关闭。 请重新打开它进行编辑或回答。

Multi-GPU on MATLAB 2013

1 次查看(过去 30 天)
Amnah
Amnah 2014-5-26
关闭: MATLAB Answer Bot 2021-8-20
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 ?

回答(1 个)

Edric Ellis
Edric Ellis 2014-6-2
编辑:Edric Ellis 2014-6-2
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

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by