How to pass data divided to two GPU for parallel calculations?

1 visualización (últimos 30 días)
Mantas Vaitonis
Mantas Vaitonis el 27 de Mzo. de 2019
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

Respuestas (0)

Categorías

Más información sobre Parallel Computing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by