gliptak gliptak - 1 year ago 135
R Question

multithreading with R?

Reading the R-project website, there are some (unclear) references to multithreading with R, but it is unclear how the base product and CRAN libraries are compiled.

Revolution Analytics offers multithreaded base(?) download for Windows and Redhat.

Would some of the other Linux distributions also include multithreaded R (and packages)?


Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download