12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

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

610 appendix d200Execution Time (sec)1601208040MPIpi.cExecution Time30025020015010050TuneMPI01 2 3 4 5 6 7 8 9 10Number of Processors00 5 10 15 20Number of ProcessorsFigure D.3 Execution time versus number of processors. Left: For the calculation of π withMPIpi.c. Right: For the solution of an eigenvalue problem with TuneMPI.c. Note that thesingle-processor result here does not include the overhead for running MPI.• MPI_Bcast sends out data from one processor to all the others. In our case thehost broadcasts the number of iterations to the guests, which in turn replacetheir current values of n with the one received from the host.• MPI_Allreduce is a glorified broadcast command. It collects the values of thevariable mypi from each of the processors, performs an operation on themwith MPI_SUM, and then broadcasts the result via the variable pi.D.3.5 ExerciseOn the left in Figure D.3 we show our results for the speedup obtained by calculatingπ in parallel with MPIpi.c. This exercise leads you through the steps required toobtain your own speedup curve:1. Two versions of a parallel program are possible. In the active host version thehost acts just like a guest and does some work. In the lazy host version thehost does no work but instead just controls the action. Does MPIpi.c containan active or a lazy host? Change MPIpi.c to the other version and record thedifference in execution times.2. Make a plot of the time versus the number of processors required forthe calculation of π.3. Make a speedup plot, that is, a graph of the computation time divided by thetime for one processor versus the number of processors.4. Record how long each of your runs takes and how accurate the answers are.Does round-off error enter in? What could you do to get a more accuratevalue for π?−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 610

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

Saved successfully!

Ooh no, something went wrong!