[Rcpp-devel] RcppEigen fails on win-builder i386, and a possibly related issue.

François Rousset francois.rousset at umontpellier.fr
Sun May 22 12:09:01 CEST 2016


Hi,

RcppEigen no longer passes the CRAN checks for Windows i386 architecture:
https://cran.r-project.org/web/checks/check_results_RcppEigen.html
This problem seems to have appeared in the middle of last month, 
presumably following some change on CRAN.

A similar problem appeared at the same time in some packages I maintain, 
which link to RcppEigen. For one package, execution stops on a line of 
the form
MatrixXd 
someMatrix(MatrixXd(nb,nb).setZero().selfadjointView<Lower>().rankUpdate( 
anotherMatrix ));
I have reduced the code causing the error to a small reproducible 
example, and since I can reproduce the error only on the win-builder 
service on CRAN, not on my Windows PC, this example takes the form of a 
package 'minimalTest'. It can be downloaded from 
http://kimura.univ-montp2.fr/~rousset/minimalTest_1.1.3.tar.gz.

I hope the following may help in correcting RcppEigen (as I think I can 
circumvent the problem in my package), but I am also curious whether I 
am missing some obvious error in my code.

In this small example, the checks fail (on Windows i386 only; the 
relevant part of the check log is pasted at the end of this message) 
when executing

mini(14)

where the mini() function is

// [[Rcpp::export]]
int mini( int nb ){
   MatrixXd swZ(nb,nb);
   swZ.setZero();
   Rcout <<"Trivial code: 
swZ.selfadjointView<Lower>().rankUpdate(swZ):"<<std::endl;
   swZ.selfadjointView<Lower>().rankUpdate(swZ);
   Rcout << "after minimal test. "<<std::endl; // not printed when error 
occurs
   return(0);
}

However, the problem occurs only when two other functions, derived from 
more meaningful functions in the original package, are included in the 
sources (yet are not called by the tests):

// [[Rcpp::export]]
List unusedFn1( SEXP XX ) {
   const MappedSparseMatrix<double> X(as<MappedSparseMatrix<double> >(XX));
   SparseQR<SparseMatrix<double, Eigen::ColMajor>, 
Eigen::COLAMDOrdering<int> > spQR(X);
   SparseMatrix<double> Q_ap(5,5);
   Q_ap.setZero();
   List out = List::create(Named("Q_ap") = Q_ap);
   return(out);
}

// [[Rcpp::export]]
SEXP unusedFn2( SEXP ZZ ) {
   const Map<MatrixXd> Z(as<Map<MatrixXd> >(ZZ));
   int c(Z.cols());
   if (c==0) return(wrap(MatrixXd(0,0)));
   MatrixXd bidon(MatrixXd(c,c).setZero());
   MatrixXd 
swZ(MatrixXd(c,c).setZero().selfadjointView<Lower>().rankUpdate(bidon.transpose()));
   return(wrap(swZ));
}

The problem does not occur if either of these two functions is removed 
from the sources. I found that I could resolve the problem in my 
original package by removing any Eigen::SparseMatrix-related code from 
it. Much as in the checks for the small example package, that code was 
not called in the checks for my original package.

The small example package does not contain other C++ or R functions 
(except those generated automatically by Rcpp).

Can anyone make sense of this?

Thanks in advance,

F.R.

==============================================
** running examples for arch 'i386' ... ERROR
Running examples in 'minimalTest-Ex.R' failed
The error most likely occurred in:

 > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
 > ### Name: mini
 > ### Title: Test RcppEigen code
 > ### Aliases: mini unusedFn1 unusedFn2
 >
 > ### ** Examples
 >
 > sessionInfo()
R Under development (unstable) (2016-05-21 r70655)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows Server 2008 x64 (build 6002) Service Pack 2

locale:
[1] LC_COLLATE=C                 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=C                LC_NUMERIC=C
[5] LC_TIME=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] minimalTest_1.1.3

loaded via a namespace (and not attached):
[1] Rcpp_0.12.5
 > mini(14)
Trivial code: swZ.selfadjointView<Lower>().rankUpdate(swZ):
** running examples for arch 'x64' ... [1s] OK
* checking PDF version of manual ... OK
* DONE
===============================================


More information about the Rcpp-devel mailing list