[Rcpp-devel] OpenMP/Rcpp Error: C stack usage is too close to the limit

aakremena at aol.com aakremena at aol.com
Sat Mar 19 20:48:44 CET 2016


Dirk,

Thanks for the quick reply.

Just to let you know that 
    1. When I replace Rcout with cout, the nof function is running just fine
             Why is Rcout messing up?
    2. When omp_set_num_threads is explicitly declared before the void nof(int nn_thrds) function, the diagnostic warnings disappear. 
            Why?  I thought these function WERE already explicitly declared in the omp.h header file...  What am I missing?

Thank you in advance.

Anguel

 

 

 

-----Original Message-----
From: Dirk Eddelbuettel <edd at debian.org>
To: aakremena <aakremena at aol.com>
Cc: rcpp-devel <rcpp-devel at lists.r-forge.r-project.org>
Sent: Sat, Mar 19, 2016 1:45 pm
Subject: Re: [Rcpp-devel] OpenMP/Rcpp Error: C stack usage is too close to the limit


On 19 March 2016 at 14:11, aakremena at aol.com wrote:
| Dear Rcpp Developer List subscribers,
| 
| 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):
| 
| #include <RcppArmadillo.h>
| #include <math.h>
| #ifdef _OPENMP
| #include <omp.h>
| #endif
| #include<map>
| #include<vector>
| #include<random>
| 
| //[[Rcpp::plugins(openmp)]]
| //[[Rcpp::depends(RcppArmadillo)]]
| using namespace Rcpp;
| using namespace arma;
| 
| 
| // [[Rcpp::export]]
| void nof(int nn_thrds)
| {
|   omp_set_num_threads(nn_thrds);
|   #pragma omp parallel for
|   for(int i = 0; i < 100; i++) {
|     #pragma omp critical
|  {
|       Rcout << i << std::endl;
|     }
|   }
| }
| 
| /***R
| nof(2)
| */
| 
| PROBLEMS:
|     1. (Minor): Diagnostics message use of undeclared identifier
| omp_set_num_threads,

So you don't declare OMP correct.

|     2. (Major): The program terminates the R session with
|       R Session Aborted
|             R encountered a fatal error
|             The session was terminated
| 
|     Sometimes I receive the messages
|         Error C stack is too close to the limit
|         Error during wrapup: C stack usage is too close to the limit
|         Type Error: 'null' is not an object (evaluating 'c[a]')

That means you are messing your calls up and the stack does not get
unwound. Simplify.
 
| I use RStudio 0.99.893

Irrelevant.
 
| QUESTIONS:
|     1. What is going on?

You have bugs.

|     2. Is there any legible description of such error messages on the Internet?
| --I mean, they seem way too cryptic to me...

At least the resources are free...

Dirk

    
| Thank you in advance.
| 
| Anguel
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160319/57e95625/attachment.html>


More information about the Rcpp-devel mailing list