Lecture 8 - Parallelization Patterns and Algorithmic Skeletons Flashcards
1
Q
skeletons instructions
A
map() mapreduce() reduce() map_overlap()
float filter (float a, b, c) { return wa*a + wb*b + wc*c; } float elemError ( float a, b ) { return fabs ( a – b ); } ... void main ( int argc, char *argv[] ) { … Vector array = new Vector ( n ); Vector tmp = new Vector ( n ); Vector err = new Vector ( n ); ... while ( globalerr > 0.1 ) { map_overlap( filter, 1, tmp, array ); map( elemError, err, array, tmp ); reduce( fmax, &globalerr, err ); map( copy, array, tmp ); }
}