[Rcpp-devel] compiling an RInside and RCppEigen application using the Intel compiler, icpc

Dirk Eddelbuettel edd at debian.org
Mon Aug 13 14:20:41 CEST 2012


On 13 August 2012 at 00:19, Stephen J. Barr wrote:
| Greetings, 
| 
| Over the weekend I had wanted to compile an application using RInside and
| RCppEigen using icpc. I found the following two pieces of information helpful.

Thanks for summarizing here.
 
| 1. The order of the includes in important. In particular
| 
| #include "mpi.h"
| #include <RInside.h>
| #include <Rcpp.h>
| #include <RcppEigen.h>

.... which is exactly what the existing example does:

#include <mpi.h>     // mpi header file
#include <RInside.h> // for the embedded R via RInside

Note that the include for Rcpp.h is redundant, RInside gets you that.
 
| mpi.h must be first. If mpi.h is after RInside.h, you get the following sort of
| errors:
| 
| -------------------------------
| /usr/local/include/openmpi/ompi/mpi/cxx/datatype.h(142): error: expected a type
| specifier
|     virtual void Free();
|                  ^
| 
| /usr/local/include/openmpi/ompi/mpi/cxx/datatype.h(142): error: expected a ")"
|     virtual void Free();
|                  ^
| 
| /usr/local/include/openmpi/ompi/mpi/cxx/datatype.h(142): error: expected an
| identifier
|     virtual void Free();
|                  ^
| --------------------------------
| 
| 2. The compile string that I used was
| 
| icpc -I/usr/local/include -pthread -I/usr/share/R/include -I/usr/lib/R/
| site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -O3
| -pipe -g -Wall    sjb_simple_smle_with_Rinside.cpp  -pthread -L/usr/local/lib
| -lmpi_cxx -lmpi -ldl -lm -Wl,--export-dynamic -lrt -lnsl -lutil -L/usr/lib/R/
| lib -lR -lblas -llapack -L/usr/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/
| usr/lib/R/site-library/Rcpp/lib -L/usr/local/lib/R/site-library/RInside/lib
| -lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -o
| sjb_simple_smle_with_Rinside -I/usr/local/lib/R/site-library/RcppEigen/include

Is there a reason you avoid Makefiles?

As an aside, RInside 0.2.7 is now on CRAN, and I added new examples
directories for using it with RcppArmadillo and RcppEigen, respectively.

Dirk
 
| This was based on the compile string generated by the make file for the mpi
| examples that come with RInside. This took me a while to figure out, so I hope
| it is useful for someone else.
| 
| Best regards and have a good week!
| Stephen
| 
| ----------------------------------------------------------------------
| _______________________________________________
| 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
-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  


More information about the Rcpp-devel mailing list