OpenMP {SLmetrics} | R Documentation |
Control OpenMP
Description
Enable or disable OpenMP parallelization for computations.
Disclaimer
This toggle is a brute-force implementation and does not guard against data races or nested parallel regions. Nested OpenMP regions can introduce subtle race conditions if multiple layers of parallelism access shared data concurrently. If you combine this package’s OpenMP switch with other parallel machine-learning routines, you may encounter undefined behavior.
Usage
## enable OpenMP
openmp.on()
## disable OpenMP
openmp.off()
## set number of threads
openmp.threads(threads)
Arguments
threads |
A positive <integer>-value (Default: None). If |
Value
If OpenMP is unavailable, the function returns NULL.
Examples
## Not run:
## enable OpenMP
SLmetrics::openmp.on()
## disable OpenMP
SLmetrics::openmp.off()
## available threads
SLmetrics::openmp.threads()
## set number of threads
SLmetrics::openmp.threads(2)
## End(Not run)
[Package SLmetrics version 0.3-4 Index]