<font color='black' size='2' face='arial'><font size="2">Dear Rcpp Developer List subscribers,<br>
<br>
I am experimenting with OpenMP on Rcpp. Here is a simple program I'm trying to run on my (4-core MacBookPro 8,3, Intel Cor i7, 2.3 GHz) computer (clang-omp compiler):<br>
<br>
#include <RcppArmadillo.h><br>
#include <math.h><br>
#ifdef _OPENMP<br>
#include <omp.h><br>
#endif<br>
#include<map><br>
#include<vector><br>
#include<random><br>
<br>
//[[Rcpp::plugins(openmp)]]<br>
//[[Rcpp::depends(RcppArmadillo)]]<br>
using namespace Rcpp;<br>
using namespace arma;<br>
<br>
<br>
// [[Rcpp::export]]<br>
void nof(int nn_thrds)<br>
{<br>
omp_set_num_threads(nn_thrds);<br>
#pragma omp parallel for<br>
for(int i = 0; i < 100; i++) {<br>
#pragma omp critical<br>
{<br>
Rcout << i << std::endl;<br>
}<br>
}<br>
}<br>
<br>
/***R<br>
nof(2)<br>
*/<br>
<br>
<b>PROBLEMS:<br>
1. (Minor): Diagnostics message <i>use of undeclared identifier omp_set_num_threads</i>,<br>
2. (Major): The program terminates the R session with<br>
</b>R Session Aborted<br>
R encountered a fatal error<br>
The session was terminated<br>
<br>
<b>Sometimes I receive the messages<br>
</b> Error C stack is too close to the limit<br>
Error during wrapup: C stack usage is too close to the limit<br>
Type Error: 'null' is not an object (evaluating 'c[a]')<br>
<br>
I use RStudio 0.99.893<br>
<br>
<b>QUESTIONS:<br>
1. What is going on?<br>
2. Is there any legible description of such error messages on the Internet?--I mean, they seem way too cryptic to me...<br>
<br>
</b>Thank you in advance.<br>
<br>
Anguel<br>
<b></b></font>
</font>