Using multiple GPUs in a parfor type of loop
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I am working on a machine learning problem where I am training my classifier using a GPU and the parallel computing toolbox. I want to do 10-fold cross-validation (basically train 10 different classifiers, completely independently of each other). I have access to a machine with two Tesla GPUs. Is there a straightforward way to to combine a parfor loop with two workers, each with their own GPU attached, to do this?
When I open the matlabpool can I just specify the two different GPU devices, one for each worker and then never have to bother with it again?
Risposte (1)
James Lebak
il 5 Apr 2013
In R2012b and later, in a matlabpool on a single machine with two GPUs, each worker will use a different GPU by default. You can see this by executing the following code:
matlabpool local 2
parfor ix = 1:10
gd=gpuDevice;
d(ix)=gd.Index;
end
The value of d will show you the index of the GPU on which each iteration was executed.
In earlier releases the workers all use device 1 by default, and you would have to set the device manually using spmd outside the parfor loop or (less optimally) inside each loop iteration.
0 Commenti
Vedere anche
Categorie
Scopri di più su GPU Computing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!