multithreading with R?

You are confused.

The R (and before it, S) internals are single-threaded, and will almost surely remain single-threaded. As I understand it, Duncan Temple Lang’s PhD work was about overcoming this, and if he can’t do it…

That said, there are pockets of multi-threadedness:

  • First off, whenever you make external calls, and with proper locking, you can go multi-threaded. That is what the BLAS libraries MKL, Goto/Open BLAS, Atlas (if built
    multithreaded), … all offer. Revo R “merely” ships with (Intel’s) MKL as Intel happens
    to be a key Revo investor

  • If you are careful about what you do, you can use OpenMP (a compiler extension for multi-threading). This started with Luke Tierney’s work on pnmath and pnmath0 (which used to be experimental / external packages) and has since been coming into R itself, slowly but surely.

  • Next, in a multicore world, and on the right operating system, you can always fork(). That is what package multicore pioneered and which package parallel now carries on.

  • Last but not least there is the network / RPC route with MPI used by packages like Rmpi, snow, parallel, … and covered in HPC introductions.

Leave a Comment