0 4 repeat until max change jacobi iteration in

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 6 —༉  For loops —༉  Execute loop body once per domain index, serially for i in Inner do ... 1 2 3 4 5 6 7 8 9 10 11 12 —༉  Forall loops —༉  Executes loop body once per domain index, in parallel —༉  Loop must be serializable (executable by one task) forall i in Inner do ... • • • • • • • • • • • • —༉  Loop variables take on const domain index values 47 Forall loops also support... —༉  A shorthand notaCon: [(i,j) in D] A[i,j] = i + j/10.0; —༉  Expression- based forms: 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 A = forall (i,j) in D do i + j/10.0; A = [(i,j) in D] i + j/10.0; 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 A 48 —༉  Array expressions also support for and forall loops for a in A[Inner] do ... forall a in A[Inner] do ... 1 2 3 4 5 6 7 8 9 10 11 12 • • • • • • • • • • • • —༉  Array loop indices refer to array elements (can be modified) forall (a, (i,j)) in zip(A, D) do a = i + j/10.0; 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 Note that forall loops support zippered iteraCon, like for- loops 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 49 For loops: executed using one task —༉  use when a loop must be executed serially —༉  or when one task is sufficient for performance Forall loops: typically executed using 1 < #tasks << #iters —༉  use when a loop should be executed in parallel… —༉  …but can legally be executed serially —༉  use when desired # tasks << # of iteraCons Coforall loops: executed using a task per iteraCon —༉  use when the loop iteraCons must be executed in parallel —༉  use when you want # tasks == # of iteraCons —༉  use when each iteraCon has substanCal work 50 By default*, controlled by three config variables: - - dataParTasksPerLocale=# —༉  Specify # of tasks to execute forall loops —༉  Current Default: number of processor cores - - dataParIgnoreRunningTasks=[true|false] —༉  If false, reduce # of forall tasks by # of running tasks —༉  Current Default: true - - dataParMinGranularity=# —༉  If > 0, reduce # of forall tasks if any task has fewer iteraCons —༉  Current Default: 1 *Default values can be overridden for specific domains/arrays...
View Full Document

Ask a homework question - tutors are online