[Rcpp-devel] R/Rcpp/RcppEigen Optimization WAS: NumericVector Double mismatch when indexing an array

Douglas Bates bates at stat.wisc.edu
Wed Oct 24 18:24:18 CEST 2012

On Tue, Oct 23, 2012 at 6:01 PM, Darren Cook <darren at dcook.org> wrote:
>> What gives?  What I found that does speed up the code dramatically
>> is the -march switch.  I guess that can't be repo-ed because it is
>> CPU dependent, right?  Here's the important settings that I used to
>> compile R from source:
>> CC="gcc"
>> CFLAGS="-g -O2 -march=amdfam10"
>> CXX="g++"
>> CXXFLAGS="-g -O2 -march=amdfam10"
>> With these settings...
>> MCMC Code    Switches        Relative Time
>> R        none or -O2        1.0
>> RcppEigen    none or -O2        0.09
>> R        -O2 -march=amdfam10    0.5
>> RcppEigen    -O2 -march=amdfam10    0.013
> Wow, those are huge differences. Am I misreading, or does that say
> RcppEigen runs *seven* times quicker with the -march=amdfam10 option?
> Can that be explained? (e.g. does the AMDFAM10 processor have some
> feature that speeds it up 7 times in ideal conditions?)

Eigen does use SSE2 and SSE3 pipelined instructions when they are
determined to be available.

More information about the Rcpp-devel mailing list