How to pass data divided to two GPU for parallel calculations?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!