arrow
Return

R-Friendly Multi-Threading in C plus

delete2021-01-01
delete0
delete
OA
AI
T
Thomas Nagler *
DOI:10.18637/jss.v097.c01delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Calling multi-threaded C++ code from R has its perils. Since the R interpreter is single-threaded, one must not check for user interruptions or print to the R console from multiple threads. One can, however, synchronize with R from the main thread. The R package RcppThread (current version 1.0.0) contains a header only C++ library for thread safe communication with R that exploits this fact. It includes C++ classes for threads, a thread pool, and parallel loops that routinely synchronize with R. This article explains the package's functionality and gives examples of its usage. The synchronization mechanism may also apply to other threading frameworks. Benchmarks suggest that, although synchronization causes overhead, the parallel abstractions of RcppThread are competitive with other popular libraries in typical scenarios encountered in statistical computing.
Keywords:
R
C plus
parallel
thread
concurrency

Journal

Journal of Statistical Software cover
Journal of Statistical Software
IF:
8.1
Papers:
622
Citations:
4.6W

Organization

L
leiden university - excl lumc
Scholars:
3.5W
Papers: 2.9W
Citations: 46