Informal Parallel Programming Course for High School Students
90 likes | 224 Views
Informal Parallel Programming Course for High School Students. Fall 2007 By: Alex Valentin. Who?. Uzi Vishkin, UMD Professor Scott Watson, UMD Graduate Student 10 Montgomery Blair Students Me. Why?. Think Differently Target younger audience Parallel is the Future. What?.
Informal Parallel Programming Course for High School Students
E N D
Presentation Transcript
Informal Parallel Programming Course for High School Students Fall 2007 By: Alex Valentin
Who? • Uzi Vishkin, UMD Professor • Scott Watson, UMD Graduate Student • 10 Montgomery Blair Students • Me
Why? • Think Differently • Target younger audience • Parallel is the Future
What? • Language: XMT-C • Spawn • Ps( ) • Hardware: 64-processor computer
HW0: Exchange Problem Swap elements from A[ ] with those of B[ ] Input: A[ ], B[ ], n = length of arrays #include <xmtc.h> int main( ) { int x; for(x=0; x<n; x++){ int e= A[x]; A[x] = B[x]; B[x] = e; }//end for }//end main #include <xmtc.h> int main() { spawn(0,n-1){ Int x ; x= A[$]; A[$] = B[$]; B[$] = x[$]; }//end for }//end main
Optimal Parallel Exchange int main() { int y[n]; int x[n]; spawn(0,2*n-1) { if($<n) x[$] = A[$]; else y[$%n] = B[$%n]; } spawn(0, 2*n-1) { if($<n) A[$] = y[$]; else B[$%n] = x[$%n]; } }
HW3: Compaction • Given a sparse array, copy all non-zero values into a new array • Input: A[ ], B[ ], C[ ], n= length of arrays • To be done in constant time, O(1)
Compaction Code int main(void) { int ptr=0; int l; for(l=0; l<n; l++) { if(B[l] != 0) { C[ptr] = A[l]; ptr++; } }//end for }//end main #include <xmtc.h> psBaseReg base; int main (void) { base =0; spawn(0, n-1) { int step =1; if( B[$] != 0) { ps( step, base); C[step] = A[$]; } }//end spawn }// end main
The Future • Ear Decomposition Search ( EDS) • Sub-Graph of Input • Parallel equivalence of Depth-First-Search • st-Numbering