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.

strides. In general, ERL has the useful property that the size <str<strong>on</strong>g>of</str<strong>on</strong>g> the set being representedcan be easily computed. To find an algorithm <str<strong>on</strong>g>for</str<strong>on</strong>g> finding the size <str<strong>on</strong>g>of</str<strong>on</strong>g> such a group E, I firstprove a theorem.Theorem 3. Let there be two d-dimensi<strong>on</strong>al RCSLMADs L 1 and L 2 defined over the samedomain D with equal strides p k in each dimensi<strong>on</strong> k. If the bases b 1 and b 2 <str<strong>on</strong>g>of</str<strong>on</strong>g> the twoRCSLMADs are such that 0 ≤ b 2 − b 1 < p d , then L 1 and L 2 are completely disjoint.Pro<str<strong>on</strong>g>of</str<strong>on</strong>g>. I prove the theorem by c<strong>on</strong>tradicti<strong>on</strong>. Let there be two d-dimensi<strong>on</strong>al tuples V 1 ɛDand V 2 ɛD such that L 1 (V 1 ) = L 2 (V 2 ). For the sake <str<strong>on</strong>g>of</str<strong>on</strong>g> c<strong>on</strong>tradicti<strong>on</strong>, I assume that V 1 ≠ V 2 .Let m be the smallest dimensi<strong>on</strong> in which V 1 and V 2 differ. The rest <str<strong>on</strong>g>of</str<strong>on</strong>g> the pro<str<strong>on</strong>g>of</str<strong>on</strong>g> is similar tothe pro<str<strong>on</strong>g>of</str<strong>on</strong>g> given in theorem 1. First, c<strong>on</strong>sider the case where V 1 (m) < V 2 (m). We substitutethe values <str<strong>on</strong>g>of</str<strong>on</strong>g> V 1 and V 2 in the definiti<strong>on</strong>s <str<strong>on</strong>g>of</str<strong>on</strong>g> L 1 and L 2 .Then we apply the c<strong>on</strong>diti<strong>on</strong>p m > p 1 − 1 + ∑ dk=m+1 p k ∗ (u k − 1). Following the logic <str<strong>on</strong>g>of</str<strong>on</strong>g> pro<str<strong>on</strong>g>of</str<strong>on</strong>g> <str<strong>on</strong>g>of</str<strong>on</strong>g> theorem 1, using thec<strong>on</strong>diti<strong>on</strong> it can be proven that L 1 (V 1 ) < L 2 (V 2 ). There<str<strong>on</strong>g>for</str<strong>on</strong>g>e, we arrive at a c<strong>on</strong>tradicti<strong>on</strong>and the theorem is proved <str<strong>on</strong>g>for</str<strong>on</strong>g> this case. Sec<strong>on</strong>d, c<strong>on</strong>sider the case V 1 (m) > V 2 (m). In thiscase it can be proven that L 1 (V 1 ) > L 2 (V 2 ). Again we arrive at a c<strong>on</strong>tradicti<strong>on</strong> and thetheorem is proved.Given the previous theorem, computing the number <str<strong>on</strong>g>of</str<strong>on</strong>g> distinct elements in an d-dimensi<strong>on</strong>alERL E composed <str<strong>on</strong>g>of</str<strong>on</strong>g> n RCSLMADs is straight<str<strong>on</strong>g>for</str<strong>on</strong>g>ward.Theorem 4. Let E be a d-dimensi<strong>on</strong>al ERL composed <str<strong>on</strong>g>of</str<strong>on</strong>g> n RCSLMADs L 1 , L 2 , .., L n withbases b 1 , b 2 , ..., b n respectively. Then the number <str<strong>on</strong>g>of</str<strong>on</strong>g> distinct elements <str<strong>on</strong>g>of</str<strong>on</strong>g> E is given by q ∗d∏u k where q is the number <str<strong>on</strong>g>of</str<strong>on</strong>g> distinct elements in the list {b 1 , b 2 , b 3 , .., b n }.k=1Pro<str<strong>on</strong>g>of</str<strong>on</strong>g>. The theorem is a corollary <str<strong>on</strong>g>of</str<strong>on</strong>g> the previous theorem.5.3.2 One-dimensi<strong>on</strong>al RCSLMADs with comm<strong>on</strong> strideC<strong>on</strong>sider two <strong>on</strong>e-dimensi<strong>on</strong>al RCSLMADs L 1 , L 2 having the same stride m and definedover the domain D.L 1 = b 1 + m ∗ i (5.33)L 2 = b 2 + m ∗ i (5.34)0 ≤ i < u (5.35)Without loss <str<strong>on</strong>g>of</str<strong>on</strong>g> generality assume that b 1 ≤ b 2 . As was shown earlier, RCSLMADs canbe visualized as simple-strided accesses into an imaginary C array. If there is more than <strong>on</strong>eRCSLMAD, we can attempt to place both <str<strong>on</strong>g>of</str<strong>on</strong>g> them in the same imaginary C array. In this42

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

Saved successfully!

Ooh no, something went wrong!