10

Providers of new computer architectures regularly try to introduce new programming models, e.g. recently CUDA/OpenCL for GPGPUs, and displace C/POSIX as the control interface to platform parallelism. (Poss & Koening, AM3: Towards a hardware Unix accelerator for many-cores, 2015)

Why do architecture designers try to design new programming models to displace C/POSIX for parallel computing? Is C/POSIX not well suited to multiprocessors or did the original authors of C/POSIX not have the need for parallel computing in mind at C/POSIX design time? Or is it the case that programmers need more capabilities than C/POSIX can deliver,thus resorting to new designs e.g. CUDA/OpenCL, etc.?

Mehdi Haghgoo
  • 237
  • 1
  • 5
  • 7
    Remember, software is an abstraction of hardware. If hardware changes too much, then the software abstraction might not be a good one anymore. I believe this is certainly true when considering using POSIX threads for a GPU, but I will leave it to someone else to explain more fully in an answer. –  Dec 02 '15 at 20:22

2 Answers2

10

Compare POSIX threads and Grand Central Dispatch, for example. I have code that dispatches to four threads in eight lines of code. With POSIX, that would all be an absolute nightmare.

On the other hand, CUDA / OpenCL are not about multithreading at all, but about using massive vector abilities. (They can do multithreading as well, but vectorizing is the important thing).

gnasher729
  • 42,090
  • 4
  • 59
  • 119
9

There is a distinction between SIMD parallel programming and the more traditional parallel programming model that POSIX uses.

SIMD is the model that CUDA, OpenCL, etc. use. There is a single set of instructions that are executed simultaneously by many threads, each operating on their own pool of data. This is very useful for thing like 3-D graphics, where the same transformations are applied to a large number of points.

The POSIX model assumes that each thread runs asynchronously, and each thread can potentially execute totally different code.

Both models have their strengths and weaknesses -- that's why they are different. POSIX is much more flexible, but CUDA/OpenCL/etc. can take advantage of specialized hardware, running thousands of (usually simpler) threads at a time.

Mike Harris
  • 572
  • 3
  • 12