MATLAB PARALLEL COMPUTING TOOLBOX - S Guía de usuario Pagina 206

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 656
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 205
6 Programming Overview
6-66
total = 0;
count = 0;
parfor ii = 1:N
% Get partition ii of the datastore.
subds = partition(ds,N,ii);
[localTotal,localCount] = sumAndCountArrivalDelay(subds);
total = total + localTotal;
count = count + localCount;
end
end
Now the MATLAB code calls this new function, so that the counting and summing of the
non-NAN values can occur in parallel loop iterations.
p = parpool('local',4);
reset(ds);
tic
[total,count] = parforSumAndCountArrivalDelay(ds)
parfortime = toc
mean = total/count
Starting parallel pool (parpool) using the 'local' profile ... connected to 4 workers.
Analyzing and transferring files to the workers ...done.
total =
17211680
count =
2417320
parfortime =
13.6401
mean =
7.1201
Vista de pagina 205
1 2 ... 201 202 203 204 205 206 207 208 209 210 211 ... 655 656

Comentarios a estos manuales

Sin comentarios