[Rcpp-devel] R limiting the number of child threads
Dirk Eddelbuettel
edd at debian.org
Mon Feb 4 19:37:23 CET 2013
On 4 February 2013 at 17:47, Yan Zhou wrote:
| I have a C++ library for parallel implementation of Sequential Monte Carlo
| algorithms. It can use some different programming models, OpenMP, Intel TBB,
| Intel Cilk, C++11 <thread>, and others. Everything worked fine so far.
Wow. You're way ahead of me. With OpenMP, and noticed that it uses the same
environment variable that Intel MKL uses. I suspect you may find it (and the
related ones) useful for Cilk and TBB too. Copied straight from the
libgomp-4.7 docs (in package gcc-4.7-doc on my Ubuntu box):
3.4 `OMP_NUM_THREADS' - Specifies the number of threads to use
==============================================================
_Description_:
Specifies the default number of threads to use in parallel
regions. The value of this variable shall be a comma-separated
list of positive integers; the value specified the number of
threads to use for the corresponding nested level. If undefined
one thread per CPU is used.
_See also_:
*note omp_set_num_threads::
_Reference_:
OpenMP specifications v3.1 (http://www.openmp.org/), section 4.2
I seem to recall that the R package parallel uses the same variables, so if
you behaviour that differs between standalone C++ code and code called from
R, check there too.
Hope this helps, Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list