omp: Set or get the number of OpenMP threads 'Delaporte' should...

setDelapThreadsR Documentation

Set or get the number of OpenMP threads Delaporte should use

Description

Set or get number OpenMP threads to be used by Delaporte functions which are parallelized. These include ddelap, pdelap, qdelap, and rdelap.

Usage

setDelapThreads(n)
getDelapThreads()

Arguments

n

integer: maximum number of threads to be used.

Details

The requested thread count is stored in an environment local to the package namespace, following the guidance in Writing R Extensions, and is passed to the compiled routines on each call, where it scopes only Delaporte's own parallel regions. Neither the global options registry nor the process-wide OpenMP settings are touched, so other OpenMP-using packages are unaffected.

On load, the thread count is initialized to the OpenMP runtime maximum at that moment, which respects environment variables such as OMP_NUM_THREADS and OMP_THREAD_LIMIT.

For systems which return valid values for detectCores, the maximum number of threads will be capped at that value.

Value

getDelapThreads returns an integer representing the maximum number of allowed threads.

setDelapThreads invisibly returns the integer value actually set after flooring and capping.

Author(s)

Avraham Adler Avraham.Adler@gmail.com

See Also

detectCores in parallel package.

Examples

getDelapThreads()
setDelapThreads(2L)
getDelapThreads()

Delaporte documentation built on Aug. 24, 2026, 9:07 a.m.