RcppCore / RcppEigen

Rcpp integration for the Eigen templated linear algebra library
Other
111 stars 40 forks source link

Update call to RcppArmadillo_fastLm_impl #56

Closed michaelweylandt closed 6 years ago

michaelweylandt commented 6 years ago

The RcppEigen benchmark script calls a C++ function which is no longer provided by RcppArmadillo (since mid-August 2017). This updates the benchmark script to call the RcppAttributes-generated entry point _RcppArmadillo_fastLm_impl

$ R
The following objects are masked from package:base:

    F, pi, T

> # Before
> source("https://raw.githubusercontent.com/RcppCore/RcppEigen/master/inst/examples/lmBenchmark.R")
lm benchmark for n = 100000 and p = 40: nrep = 20
Error in .Call("RcppArmadillo_fastLm", mm, y, PACKAGE = "RcppArmadillo") :
  "RcppArmadillo_fastLm" not available for .Call() for package "RcppArmadillo"
Timing stopped at: 0.002 0 0.001

> # After
> source("https://raw.githubusercontent.com/michaelweylandt/RcppEigen/mw/update_armadillo_call_in_lmBenchmark/inst/examples/lmBenchmark.R")
lm benchmark for n = 100000 and p = 40: nrep = 20
      test relative elapsed user.self sys.self
3     LDLt    1.000   0.321     0.320    0.000
8      LLt    1.012   0.325     0.325    0.000
6  SymmEig    2.246   0.721     0.715    0.006
7       QR    7.255   2.329     2.329    0.000
2    PivQR    7.695   2.470     2.463    0.000
1   lm.fit   13.838   4.442     4.434    0.007
9     arma   18.209   5.845     5.843    0.000
4    GESDD   31.931  10.250    10.221    0.023
5      SVD   56.106  18.010    17.743    0.266
10     GSL  115.374  37.035    36.920    0.112
michaelweylandt commented 6 years ago

Pushed a new version which i) uses the fastLmPure functions and ii) switches to microbenchmark

Here's example output:

> source("lmBenchmark.R")
lm benchmark for n = 100000 and p = 40: nrep = 20
    Method   Relative Elapsed (milliseconds)
4     LDLt   1.000000               16.59547
5      LLt   1.001358               16.61801
10 SymmEig   2.177705               36.14004
8       QR   7.230222              119.98892
7    PivQR   7.772614              128.99018
6   lm.fit  13.522861              224.41823
1     arma  17.717057              294.02287
2    GESDD  31.514008              522.98975
9      SVD  56.295458              934.24953
3      GSL 112.837376             1872.58917
eddelbuettel commented 6 years ago

Thank you! Almost there -- the microbenchmark use requires a bit more care. Maybe tarball it at your end and run R CMD check --as-cran on it for good measure.

eddelbuettel commented 6 years ago

Now you must add r-cran-microbenchmark here to appease Travis.

michaelweylandt commented 6 years ago

Sorry about that - I didn't get a build-failed email from Travis.

Done now -- Travis passes with a WARNING about missing vignette source and a NOTE about large directories. Both appear to be unrelated to this change.

eddelbuettel commented 6 years ago

Yes, they are constants. In the setup I prefer at Travis, vignettes are skipped, and you get idea about directory sizes.