how to use matlabpool and multiple GPUs simultaneously?
2 views (last 30 days)
Show older comments
Hi, everyone. The matlab I am using is of version 2010b with parallel computing toolbox. And the machine on which the matlab is installed has 8 CPUs and 3 GPUs. When I use only for loop, I could access one GPU to conduct computation. Now, I'm wondering how to use parfor (e.g.,matlabpool(3)) together with 3 GPUs. That is to say, each CPU can access one GPU to conduct computation.
It's mentioned on the internet that Jacket is the only software that supports multiple GPUs for Matlabpool. I'm wondering if that is true.
I really want to know how to get the target by using matlab with parallel computing toolbox only. Your answer will be appreciated very much.
Best wishes and Merry Christmas,
Qian
0 Comments
Answers (2)
Jason Ross
on 22 Dec 2011
You can use labIndex as a means to connect the lab to one GPU. Do this inside a smpd block and you can control what goes to each GPU. The spmd statement lets you define a block of code to run simultaneously on multiple labs.
e.g.
matlabpool open 3
spmd
labindex
end
0 Comments
Friedrich
on 22 Dec 2011
Hi,
normally one uses the gpuDevice command to active/use a specific GPU device. I am not sure if this will work but I would try something like:
matlabpool open 3
parfor i=1:3
gpuDevice(i)
%gpu stuff here
end
This will open 3 workers and each worker will activate a different GPU for the computation. I can't test this since I don't have multiple GPU's so I am not 100% sure if this will work.
In addition see this thread for how to access the GPU from a worker
0 Comments
See Also
Categories
Find more on GPU Computing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!