How to pass data divided to two GPU for parallel calculations?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I have a group of large *.mat files that are arrays of size Nx130. I would like to load this data and sent it to two GPUs (workers) divided like Nx1:75 to 1GPU and Nx76:130 to 2GPU. I need to do both calculations in parallel, thus I use spmd. Firstly, I would like to ask if this method in the code below is correct. If yes, then if this is the optimal one?
clear;
gpuDevice(1);
nGPUs = gpuDeviceCount(); %start pool of 2 GPUS
parpool('local', nGPUs );
labdata=load ('07_04.mat');%load data to workspace
lab1=labdata.c;
[~,zz]=size(lab1);
zz=zz/2;
zz = fix(zz)*2;
spmd
er=zz-zz/labindex+1;
er1=zz/2*labindex;
lab=lab1(:,er:er1); %creat array depending of worker (Nx1:75 or Nx76:130)
dydis=5050;
[z,~]=size(lab);
z=z/dydis;
z = fix(z);
[a,b]=parallel (lab,z);
end
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Parallel Computing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!