6 37 38 41 42 43 44 45 46 47 48 49 for

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: ComputaCon Winter 2013: Chamberlain 34 Inclusive vs. Exclusive Scans •  Should the original item affect its result or not? –  e.g., + scan [1, 1, 1, 1, 1, 1, 1, 1] –  inclusive: [1, 2, 3, 4, 5, 6, 7, 8] –  exclusive: [0, 1, 2, 3, 4, 5, 6, 7] •  Different scenarios may want different semanCcs •  Note: given exclusive and input, inclusive can be computed CSEP 524: Parallel ComputaCon Winter 2013: Chamberlain 35 Scans on Arrays: Step 0: Accumulate accumulate Task 0 Task 1 Task 2 Task 3 Task 4 Task 5 Task 6 Task 7 combine 0.3 1.0 0.7 1.1 1.5 2.6 3.6 totTime CSEP 524: Parallel ComputaCon Winter 2013: Chamberlain 36 Scans on Arrays: Step 3’: Update all Elements update Task 0 Task 1 Task 2 Task 3 Task 4 Task 5 Task 6 Task 7 combine 0.3 1.0 0.7 1.1 1.5 2.6 3.6 totTime CSEP 524: Parallel ComputaCon Winter 2013: Chamberlain 37 Scans on Mul3dimensional Arrays 111 111 111 •  ParCal Scan: scan a subset of dims in given direcCon + scan along rows, L- >R: 1 2 3 along cols, 3 3 3 1 2 3 B - > T: 2 2 2 123 111 •  Full/Complete Scan: thread through dimensions + scan in Row- Major Order: 1 2 3 456 789 CSEP 524: Parallel ComputaCon Winter 2013: Chamberlain 38 Barrier Synchroniza3on (“Barrier”) Barrier: All parCcipaCng tasks must reach barrier before any may pass …create tasks… { foo(); barrier(); bar(); } Rough analogy: Barrier:Task Control Flow :: Fence:Memory Ops CSEP 524: Parallel ComputaCon Winter 2013: Chamberlain 39 Data Parallelism in Chapel Domain: A first- class index set —༉  A fundamental Chapel concept for data parallelism —༉  Domains may opConally be distributed 41 config const m = 4, n = 8; var D: domain(2) = {1..m, 1..n}; var Inner: domain(2) = [2..m-1, 2..-1]; D 42 config const m = 4, n = 8; var D: domain(2) = {1..m, 1..n}; var Inner: subdomain(D) = {2..m-1, 2..n-1}; Inner D 43 config const m = 4, n = 8; var D = {1..m, 1..n}; var Inner = D[2..m-1, 2..n-1]; Inner D 44 —༉  Syntax array-type: [ domain-expr ] elt-type —༉  SemanCcs —༉  Stores an elt- type for each index in domain- expr —༉  Example var A, B: [D] real; —༉  Earlier example, revisited A B var A: [1..3, 1..5] real; // [1..3, 1..5] creates an // anonymous domain 45 Domain values support... —༉  Methods for creaCng new domains Inner D var D2 = Inner.expand(1,0); D2 var D3 = Inner.translate(0,1); D3 —༉  IntersecCon via Slicing var D4 = D2[D3]; D4 —༉  Range operators (e.g., #, by,align) 4...
View Full Document

Ask a homework question - tutors are online