1. 14

Shaders in OpenGL are written in GLSL which gets compiled and uploaded to the GPU by the driver. There is no way of writing hardware-specific GPU assembly code directly.

Well… officially, anyway.

As the last slide says: GPU-based OS anyone?

  1.  

  2. 2

    I like to compare CPUs and GPUs to TCP and UDP. While with TCP, you get a guarantee your packet will arrive (more or less), there is none with UDP. The situation has improved, but GPUs (especially older kinds) are not great coprocessors. And even though you can multiplex a lot of stuff with them, you just don’t get the guarantee the result is exact. In the end, GPUs are supposed to do shader-calculations fast. A little error here and there is not that much of a problem.

    If you use GPUs for financial mathematics, it’s a whole other story…

    1. 2

      Modern GPUs are compliant with IEEE-754 (both single and double precision) so you can use these just like you do on the CPU side.

    2. 1

      Are GPUs good at general purpose code? I thought their specialization to the types of tasks graphics are good at meant they’re poor at everything else.

      Also, documentation?

      1. 4

        My favorite analogy about the difference is that CPUs are like a handful (2-8) of bulldozers – powerful units accomplishing independent tasks. GPUs, on the other hand, are like an army of ten thousand shovels all performing the same actions in the same way. Great at some things, but bad at others.

        Using Flynn’s Taxonomy, the difference is MIMD (Multiple Instruction, Multiple Data) CPUs, versus SIMD (Single Instruction Multiple Data) GPUs. SIMD architectures are constrained to one instruction at a time, multiplied by many cores. This is especially useful for graphics, when operations need to be applied the same way to each pixel in the image. But if your task can’t be effectively expressed that way, then your GPU performance will suffer.

        Intel is competing with Nvidia and AMD for the powerful-coprocessor market by making Xeon Phi cards, which are essentially a few dozen x64 Xeon processors on a PCIe bus. The chief advantage of this is that MIMD x64 cores are much more comfortable to program for, since it’s what most of us are used to.