90 likes | 104 Views
Learn Master-Workers Model for parallel computing, load balancing strategies, iterations management, and illustrative examples. Master decomposes tasks and workers execute them, with focus on balancing load and overhead.
E N D
Master/Workers Model Example Research Computing UNC - Chapel Hill Instructor: Mark Reed Email: markreed@unc.edu
Master/Workers Model • Often embarrassingly parallel • Master: • decomposes the problem into small tasks • distributes to workers • gathers partial results to produce the final result • Workers: • work • pass results back to master • request more work (optional) • Mapping/Load Balancing • Static • Dynamic Master worker worker worker worker
Master/Workers Load Balance • Iterations may have different and unpredictable run times • Systematic variance • Algorithmic variance • Goal is to balance load balance and overhead Some Schemes • Block decomposition, static chunking • Round Robin decomposition • Self scheduling • assign one iteration at a time • Guided dynamic self-scheduling • Assign 1/P of the remaining iterations (P = # procs)
Bag of Tasks • embarrassingly parallel • master/workers model • Comes up in context of: • parameter studies, sweep • Monte Carlo • need parallel random numbers, e.g. SPRNG • image processing
An Illustrative Example • a master list with a set of tasks • a list of filenames to read • each task can be done independently • read file which has one line, an index and a text string • master process gathers all the results and assembles them • order text based on index and print result • assemble jumbled text into coherent poem
sample input %more poem.masterlist poem.100.dat poem.101.dat poem.102.dat poem.103.dat poem.104.dat poem.105.dat poem.106.dat poem.107.dat poem.108.dat ... %more poem.*.dat :::::::::::::: poem.100.dat :::::::::::::: 77 the :::::::::::::: poem.101.dat :::::::::::::: 76 that :::::::::::::: poem.102.dat :::::::::::::: 75 for
workerbee.c • See code
Results The Road Not Taken Two roads diverged in a yellow wood,And sorry I could not travel bothAnd be one traveler, long I stoodAnd looked down one as far as I couldTo where it bent in the undergrowth;Then took the other, as just as fair,And having perhaps the better claimBecause it was grassy and wanted wear,Though as for that the passing thereHad worn them really about the same,
Results And both that morning equally layIn leaves no step had trodden black.Oh, I marked the first for another day!Yet knowing how way leads on to wayI doubted if I should ever come back.I shall be telling this with a sighSomewhere ages and ages hence:Two roads diverged in a wood, and I,I took the one less traveled by,And that has made all the difference. Robert Frost