Text-only Table of Contents (frame/ no frame)
(14) Scheduling of Parallel Loops Previous Top Next

Scheduling of Parallel Loops


Schedule:

N= number of iterations of the parallel loop
P= number of threads
C=user-specified chunk size
Name Type Chunk Chunk Size # of Chunks Static or Dynamic Computer Overhead
Simple Static simple no N/P P static lowest
Interleaved simple yes C N/C static low
Simple Dynamic dynamic optional C N/C dynamic medium
Guided guided optional decreasing from N/P fewer than N/C dynamic high
Runtime runtime no varies varies varies varies


/* C/C++ Example */

#pragma omp parallel for schedule(dynamic) private(tmp, i, j, k)
for (i=0; i<Ndim; i++){
for (j=0; j<Mdim; j++){
tmp = 0.0;
for(k=0;k<Pdim;k++){
tmp += *(A+(i*Ndim+k)) * *(B+(k*Pdim+j));
}
*(C+(i*Ndim+j)) = tmp;
}
}



Previous Top Next


schedule_loops.src  last modified Mar 23, 2009 Introduction Table of Contents
(frame/no frame)
Printable
(single file)
© Dartmouth College