11.07.2015 Views

A Compiler for Parallel Exeuction of Numerical Python Programs on ...

A Compiler for Parallel Exeuction of Numerical Python Programs on ...

A Compiler for Parallel Exeuction of Numerical Python Programs on ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Algorithm 1 solves the data transfer problem <str<strong>on</strong>g>for</str<strong>on</strong>g> a single RCSLMAD L defined over adomain D.1: M = {L(V )|V ɛD}.d∏2: S = u k from property <str<strong>on</strong>g>of</str<strong>on</strong>g> RCSLMAD.k=13: Let m = L(V ), V ɛD, then F (m) =d∑(V (k) ∗ (k=1d∏j=k+1u j )) and range R = S.To argue that the algorithm 1 does produce a correct functi<strong>on</strong> F , we observe that givena d-dimensi<strong>on</strong>al tuple D, the composite functi<strong>on</strong> F (L) is also an RCSLMAD defined overthe domain D, and hence each distinct tuple V is mapped to a distinct locati<strong>on</strong> in theGPU memory by the composite functi<strong>on</strong> F (L). The range R can be directly verified bycalculating the maximum and minimum values <str<strong>on</strong>g>of</str<strong>on</strong>g> F (L) over D.The problem <str<strong>on</strong>g>of</str<strong>on</strong>g> multiple RCSLMADs can be simplified in many cases by c<strong>on</strong>sideringthe memory intervals spanned by the RCSLMADs in the list.If the memory intervalsspanned by the RCSLMADs in the list are completely disjoint, then each RCSLMAD canbe analyzed individually without any necessity to compute the uni<strong>on</strong> because there can be nodependencies and no possibilities <str<strong>on</strong>g>of</str<strong>on</strong>g> multiple copies. If the interval spanned by two or moreRCSLMADs overlaps, then we can <str<strong>on</strong>g>for</str<strong>on</strong>g>m a group <str<strong>on</strong>g>of</str<strong>on</strong>g> RCSLMADs. A group <str<strong>on</strong>g>of</str<strong>on</strong>g> RCSLMADsspans over an interval given as the uni<strong>on</strong> <str<strong>on</strong>g>of</str<strong>on</strong>g> intervals <str<strong>on</strong>g>of</str<strong>on</strong>g> all members <str<strong>on</strong>g>of</str<strong>on</strong>g> the group. In generalwe can partiti<strong>on</strong> the list <str<strong>on</strong>g>of</str<strong>on</strong>g> RCSLMADs into groups <str<strong>on</strong>g>of</str<strong>on</strong>g> RCSLMADs where the intervalrepresented by each group is disjoint from other groups. An algorithm to compute groups<str<strong>on</strong>g>of</str<strong>on</strong>g> RCSLMADs is given by algorithm 2.Algorithm 2 partiti<strong>on</strong>s a list <str<strong>on</strong>g>of</str<strong>on</strong>g> RCSLMADs defined over a domain D into disjoint groups<str<strong>on</strong>g>of</str<strong>on</strong>g> RCSLMADs.Inputs: List {L 1 , L 2 , .., L n } <str<strong>on</strong>g>of</str<strong>on</strong>g> RCSLMADs defined over a domain D.Outputs: List {G 1 , G 2 , .., G n } <str<strong>on</strong>g>of</str<strong>on</strong>g> groups <str<strong>on</strong>g>of</str<strong>on</strong>g> LMADs such that the interval spanned by eachgroup is disjoint from the interval spanned by any other group.1: <str<strong>on</strong>g>for</str<strong>on</strong>g> each RCSLMAD L in {L 1 , L 2 , .., L n } do2: Find out the start and end addresses <str<strong>on</strong>g>of</str<strong>on</strong>g> R in memory.3: end <str<strong>on</strong>g>for</str<strong>on</strong>g>4: C<strong>on</strong>struct a graph G where each RCSLMAD is a node.5: <str<strong>on</strong>g>for</str<strong>on</strong>g> each pair <str<strong>on</strong>g>of</str<strong>on</strong>g> nodes in G do6: Insert an edge if the start-to-end intervals <str<strong>on</strong>g>of</str<strong>on</strong>g> the two nodes overlap.7: end <str<strong>on</strong>g>for</str<strong>on</strong>g>8: Find the c<strong>on</strong>nected comp<strong>on</strong>ents in the graph G using a suitable algorithm such as adepth first search. Each c<strong>on</strong>nected comp<strong>on</strong>ent represents a group <str<strong>on</strong>g>of</str<strong>on</strong>g> RCSLMADs.9: return A list <str<strong>on</strong>g>of</str<strong>on</strong>g> c<strong>on</strong>nected comp<strong>on</strong>ents.If <strong>on</strong>e or more groups c<strong>on</strong>tains more than <strong>on</strong>e RCSLMAD, then the problem <str<strong>on</strong>g>of</str<strong>on</strong>g> computingthe uni<strong>on</strong> (or the superset) still remains. One general soluti<strong>on</strong> is described in algorithm 3.39

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!