フィルターのクリア

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

2 ビュー (過去 30 日間)
Mantas Vaitonis
Mantas Vaitonis 2019 年 3 月 27 日
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 件)

カテゴリ

Help Center および File ExchangeGPU Computing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by