{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Colsperchunk change helper to take a domain proc

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: cache use •  A bit fine- grained •  Not ideal for distributed memory CSEP 524: Parallel ComputaIon Winter 2013: Chamberlain 78 Smith- Waterman Naïve Data- Driven Task- Parallel Approach: proc computeH(H: [0..n, 0..n] int) { Create domain describing const ProbSpace = H.domain.translate(1,1); shieed version off H’s domain var NeighborsDone: [ProbSpace] atomic int = 0; Arrays to count how many of our var Ready$: [ProbSpace] sync int; 3 neighbors are done; and to NeighborsDone[1, ..].add(1); signal when we can compute NeighborsDone[.., 1].add(1); NeighborsDone[1, 1].add(1); Set up boundaries: north and west elements Ready$[1,1] = 1; have a neighbor done; top- lee is ready coforall (i,j) in ProbSpace { Create a task per matrix element const goNow = Ready$[i,j]; H[i,j] = f(H[i-1,j-1], H[i-1,j], H[i,j-1]); and have it block unIl ready const eastReady = NeighborsDone[i,j+1].fetchAdd(1); Compute our element const seReady = NeighborsDone[i+1,j+1].fetchAdd(1); Increment our const southReady = NeighborsDone[i+1,j].fetchAdd(1); neighbors’ counts if (eastReady == 2) then Ready$[i,j+1] = 1; if (seReady == 2) then Ready$[i+1,j+1] = 1; Signal our neighbors as if (southRea...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online