[Rcpp-devel] OpenMp and IntegerVector

Andreas Prescher apres at kabelmail.de
Tue Mar 11 20:30:31 CET 2014


Hello,

I got strange behaviour when using
OpenMp and IntegerVector (without
OpenMp all works fine!!)

 From my package (Rcpp 0.10.4 used, let some unimportant
arguments out)

Rcpp::List PsiMinRContainer::parInit(const Rcpp::List& seedList)
{
	Rcpp::List resultList(m_psiMinRVec.size() - 1);
	Rcpp::IntegerVector seedVec(seedList[0]);
	
	#pragma omp parallel for
	for(int i=1; i < m_psiMinRVec.size(); i++) {
		resultList[i - 1] = m_psiMinRVec[i]->init(seedVec);
	}
	return resultList;
}
in a module definition file:

function( "parInit", &parInit,List::create( _["seedList"]) ),
calling my internal pointer with psiMinRContainer->parInit(seedList)

The problem seems to be the seedVec.
(I also tried using seedvec as pointer allocated with new)
list created in in R:
seeds <- list(c(1,12),c(1,2))
parInit(seedList = seeds)

Some errors I can give:

SET_VECTOR_ELT() can only be applied to a 'list', not a 'character'

Warning: stack imbalance in '.External', 9 then 11
Warning: stack imbalance in '{', 6 then 8

error: getCharCE have to be called for CHARSXP
(Fehler: 'getCharCE' muss für CHARSXP aufgerufen werden)

What I found so far are hints about
protect/unprotect in writing R-extensions (eg 
http://www.hep.by/gnu/r-patched/r-exts/R-exts_103.html).

Any ideas?

Andreas




More information about the Rcpp-devel mailing list