English subtitles

← Thread Divergence in the Real World Part1 - Intro to Parallel Programming

Get Embed Code
2 Languages

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

  1. Let's look at a real example of branch divergence,
  2. the kind of thing that might come up in the real world.
  3. Suppose that I'm doing some sort of operation on a 1024x1024 image
  4. but I need to do some special operation to deal with the pixels that are on the boundary.
  5. For example, if I'm doing a blur, I don't want look off of the edge of the image.
  6. So here's a simple kernel code that illustrates this idea.
  7. I'm going to call per pixel kernel.
  8. I'm going to check to see if the thread index is 0 or 1024 in either x or y.
  9. If so, I'm going to call some code that deals with the boundary conditions.
  10. Otherwise, I will run some code that does whatever it is I'm doing to the pixel.
  11. Okay. You can totally imagine that this is a common kind of operation.
  12. You've probably written code like this already in this class.
  13. So as a quiz, what is the maximum branch divergence of any warp in this code?
  14. Is it 1-way, 2-way, 3-way, 32-way, and so forth?