R with OpenMP

Introduction to OpenMP

OpenMP is a directive based standard API for threaded parallel programming in Fortran, C, and C++. It is designed for the computer architecture with shared memory, such as multi-core computers and Intel Xeon Phiopenacc_and_gpu. OpenMP has a broad compiler support from GCC, MS Visual Studio, Intel, IBM, PCI and Cray.

TODO: Brief history of OpenMP and its pros and cons.

OpenMP's directives and library provide both high level and low level control to facilitate threaded programming. For a C programer with limited knowledge on threaded computing, it is enough to use OpenMP directives and clauses to realize different work sharing constructs such as parallized for loops, parallel regions, sections and tasks and thread scheduling. These high level tools take care of issues pertaining to threaded computing, for example, thread synchronization and dead locks. For an experienced programmer, OpenMP library API provides low level functionality (such as locks, flush, etc.)openmp_api_reference to finer tune the codes.

TODO: Don't waste a week to devise an efficient algorithm. It might just take half a day to incorporate OpenMP in your code and gain significant speedup.

Using OpenMP in R

Existing Packages

Calling OpenMP Functions from within R

Examples


openacc_and_gpu. Though GPU has the architecture of hundreds or thousands integrated cores sharing same memory, the cores are very simple. Besides, GPU programming needs to take care of different memory name spaces (e.g. moving data between GPU memory and CPU memory). OpenACC is more suitable for this kind of architecture.
openmp_api_reference. Many examples on OpenMP API can be found at http://openmp.org/mp-documents/OpenMP_Examples_4.0.1.pdf.