getDTthreads_R
C++ Function Reference
1 Signature
SEXP getDTthreads_R(SEXP verbose)2 Description
R interface for thread configuration inspection.
3 Parameters
verbose(SEXP): Whether to print detailed configuration
4 Returns
SEXP Integer SEXP with thread count
5 Details
verboseWhether to print detailed configuration SEXP Integer SEXP with thread count When verbose:Prints OpenMP versionShows processor countLists all relevant environment variablesDisplays current thread settings
6 Call Graph
7 Source Code
NoteImplementation
File: inst/include/Utilities/openme-utils.hpp • Lines 218-239
inline SEXP getDTthreads_R(SEXP verbose) {
if(!IS_TRUE_OR_FALSE(verbose))
Rf_error(("%s must be TRUE or FALSE"), "verbose");
if (LOGICAL(verbose)[0]) {
#ifndef _OPENMP
Rprintf(("This installation of BigDataStatMeth has not been compiled with OpenMP support.\n"));
#else
Rprintf((" OpenMP version (_OPENMP) %d\n"), _OPENMP); // user can use Google to map 201511 to 4.5; it's odd that OpenMP API does not provide 4.5
#endif
Rprintf((" omp_get_num_procs() %d\n"), omp_get_num_procs());
Rprintf((" R_DATATABLE_NUM_PROCS_PERCENT %s\n"), mygetenv("R_DATATABLE_NUM_PROCS_PERCENT", "unset (default 50)"));
Rprintf((" R_DATATABLE_NUM_THREADS %s\n"), mygetenv("R_DATATABLE_NUM_THREADS", "unset"));
Rprintf((" R_DATATABLE_THROTTLE %s\n"), mygetenv("R_DATATABLE_THROTTLE", "unset (default 1024)"));
Rprintf((" omp_get_thread_limit() %d\n"), omp_get_thread_limit());
Rprintf((" omp_get_max_threads() %d\n"), omp_get_max_threads());
Rprintf((" OMP_THREAD_LIMIT %s\n"), mygetenv("OMP_THREAD_LIMIT", "unset")); // CRAN sets to 2
Rprintf((" OMP_NUM_THREADS %s\n"), mygetenv("OMP_NUM_THREADS", "unset"));
Rprintf((" RestoreAfterFork %s\n"), RestoreAfterFork ? "true" : "false");
Rprintf((" BigDataStatMeth is using %d threads with throttle==%d.\n"), getDTthreads(INT_MAX, false), DTthrottle);
}
return Rf_ScalarInteger(getDTthreads(INT_MAX, false));
}8 Usage Example
#include "BigDataStatMeth.hpp"
// Example usage
auto result = getDTthreads_R(...);