diff --git a/R/RcppExports.R b/R/RcppExports.R index de8d113..65fd7f3 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -5,6 +5,10 @@ run_mcmc_rcpp <- function(args) { .Call(`_moire_run_mcmc`, args) } +openmp_enabled <- function() { + .Call(`_moire_openmp_enabled`) +} + start_profiler <- function(str) { .Call(`_moire_start_profiler`, str) } diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 714c620..3e0aaa3 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -21,6 +21,16 @@ BEGIN_RCPP return rcpp_result_gen; END_RCPP } +// openmp_enabled +SEXP openmp_enabled(); +RcppExport SEXP _moire_openmp_enabled() { +BEGIN_RCPP + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + rcpp_result_gen = Rcpp::wrap(openmp_enabled()); + return rcpp_result_gen; +END_RCPP +} // start_profiler SEXP start_profiler(SEXP str); RcppExport SEXP _moire_start_profiler(SEXP strSEXP) { @@ -45,6 +55,7 @@ END_RCPP static const R_CallMethodDef CallEntries[] = { {"_moire_run_mcmc", (DL_FUNC) &_moire_run_mcmc, 1}, + {"_moire_openmp_enabled", (DL_FUNC) &_moire_openmp_enabled, 0}, {"_moire_start_profiler", (DL_FUNC) &_moire_start_profiler, 1}, {"_moire_stop_profiler", (DL_FUNC) &_moire_stop_profiler, 0}, {NULL, NULL, 0} diff --git a/src/mcmc.cpp b/src/mcmc.cpp index e8b240b..fa0e33d 100644 --- a/src/mcmc.cpp +++ b/src/mcmc.cpp @@ -284,3 +284,13 @@ void MCMC::finalize() float MCMC::get_llik() { return chains[swap_indices[0]].get_llik(); } float MCMC::get_prior() { return chains[swap_indices[0]].get_prior(); } float MCMC::get_posterior() { return chains[swap_indices[0]].get_posterior(); } + +// [[Rcpp::export]] +SEXP openmp_enabled() +{ + #ifdef _OPENMP + return Rcpp::wrap(true); + #else + return Rcpp::wrap(false); + #endif +} \ No newline at end of file