YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Analyze - Intro to Parallel Programming

Get Embed Code
2 Languages

Showing Revision 4 created 05/25/2016 by Udacity Robot.

  1. Now there are really 2 components to the analyze stage--
  2. understanding where your application spends its time
  3. and understanding what you want to do with the additional parallelism.
  4. So understanding hotspots is pretty straightforward.
  5. Often the programmer will have some intuition for this.
  6. They'll have some idea where the time is being spent in their code.
  7. But intuition can be wrong and there's no substitute for data, so don't rely on intuition.
  8. So run your favorite profiler, whether that's GProf or VTune
  9. or the brilliantly named Very Sleepy profiler,
  10. and look at how much time the various functions or lines of code take.
  11. You're going to get some output back that tells you how much time each function takes.
  12. So this function might take 10% of the time,
  13. this function might take 20% of the total time of the program,
  14. and in this case, the program is spending 50% of its time in this 1 function,
  15. so there's a clear hotspot here.
  16. Maybe your intuition would have told you that this is where the time is going.
  17. Often you do know that first hotspot,
  18. but sometimes you're surprised surprised by that second and third hotspot.
  19. Sometimes they're not what you think.
  20. And this gives you a starting point of where to begin parallelizing the code
  21. and an indication as well of how much speedup you can expect to do so.
  22. Let's try that at home with a quiz.
  23. So in this example that we've shown here, the question is
  24. what is the maximum speedup possible that you could hope for if you parallelized this top function,
  25. the function which takes the most time?
  26. Okay, that's this one.
  27. And then I'll say what if you parallelized the top 3 functions? So what if you parallelized all of these?