7 ms·
I hope this isn't too simplistic but it might help to think about what GPUs were originally designed for - banging out arrays of coloured dots at ridiculous spe
by danparsonson 4y ago
I hope this isn't too simplistic but it might help to think about what GPUs were originally designed for - banging out arrays of coloured dots at ridiculous speeds. Crudely (caveat: from my layman's understanding), when rendering graphics, a shader is a function whose input is a set of parameters that help identify where the pixel lies within its source triangle, and whose output is the appropriate colour for that pixel. A simple example might be to set the three vertices of a triangle respectively to red, green, and blue, and then interpolate the colour between those three points. When rendering the triangle, the shader is executed once for each pixel within it, and since each pixel's colour is independent of its neighbours', the problem is 'embarrassingly parallel' and can therefore be accelerated by running the same shader across multiple execution units varying only the input parameters.
Since computer graphics calculations are math-heavy, GPU cores are as you know excellent numerical processors, and therefore also great for other embarrassingly parallel maths problems; the challenge is that you have to think in broadly the same way as for graphical workloads about how to break up and execute the problem.