parallel noob Wrote: > Hello > > Intro: people with pseudonyms are often considered trolls here, but this is a > really honest question by a sw engineer now writing mostly sequential web > applications. (I write "parallel" web apps, but the logic goes that you > write sequential applications for each http query, the frontend distributes > queries among backend http processes, and the database "magically" ensures > proper locking. There's hardly ever any locks in my code.) > > D is touted as the next gen of multicore languages. I pondered between D and > D.learn, where to ask this. It just strikes me odd that there isn't any kind > of documentation explaining how I should write (parallel) code for multicore > in D. If D is much different, the general guidelines for PHP web > applications, Java, or Erlang might don't work. From what I've gathered from > these discussions, there are: > > - array operations and auto-parallelization of loops > - mmx/sse intrinsics via library > - transactional memory (requires hardware support? doesn't work?) > - "erlang style" concurrency? == process functions in Phobos 2? > - threads, locks, and synchronization primitives > > Sean, sybrandy, don, fawzi, tobias, gary, dsimcha, bearophile, russel, > trass3r, dennis, and simen clearly have ideas how to work with parallel > problems. > > A quick look at wikipedia gave > http://en.wikipedia.org/wiki/Parallel_computing and > http://en.wikipedia.org/wiki/Parallel_programming_model > > I fail to map these concepts discussed here with the things listed on those > pages. I found MPI, POSIX Threads, TBB, Erlang, OpenMP, and OpenCL there. > > Sean mentioned: > > "In the long term there may turn out to be better models, but I don't know of > one today." > > So he's basically saying that those others listed in the wikipedia pages are > totally unsuitable for real world tasks? Only Erlang style message passing > works? > > The next machine I buy comes with 12 or 16 cores or even more -- this one has > 4 cores. The typical applications I use take advantage of 1-2 threads. For > example a cd ripper starts a new process for each mp3 encoder. The program > runs at most 3 threads (the gui, the mp3 encoder, the cd ripper). More and > more applications run in the browser. The browser actively uses one thread + > one thread per applet. I can't even utilize more than 50% of the power of the > current gen! > > The situation is different with GPUs. My Radeon 5970 has 3200 cores. When the > core count doubles, the FPS rating in games almost doubles. They definitely > are not running Erlang style processes (one for GUI, one for sounds, one for > physics, one for network). That would leave 3150 cores unused.
This question would have been more appropriate in D.learn. I started my journey with http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601 The GPU is a different kind of beast. GPU uses CUDA/OpenCL.
