Skip to content

[Rcpp-devel] lmBenchmark broken for RcppArmadillo?

4 messages · Matt, Dirk Eddelbuettel

#
When I try running lmBenchmark.R I get the following error:

Rscript -e "source(system.file(\"examples\", \"lmBenchmark.R\", package =
\"RcppEigen\"))"

lm benchmark for n = 100000 and p = 40: nrep = 20

Error in .Call("fastLm", mm, y, PACKAGE = "RcppArmadillo") :

  "fastLm" not available for .Call() for package "RcppArmadillo"

Calls: source ... replicate -> sapply -> lapply -> FUN -> eval -> eval ->
.Call

Timing stopped at: 0.001 0 0

Execution halted

This happens on both Mac OS X and Ubuntu 14, with R 3.1.1, Rcpp 0.11.3,
RcppArmadillo 0.4.450.1.0, RcppEigen 0.3.2.2.0, RcppGSL 0.2.2 and
rbenchmark 1.0.0

Note that if I run do_bench() manually but remove exprs$arma then it runs
fine:
lm benchmark for n = 100000 and p = 40: nrep = 20
     test relative elapsed user.self sys.self
3    LDLt    1.000   0.489     0.483    0.006
8     LLt    1.004   0.491     0.484    0.007
6 SymmEig    3.043   1.488     1.321    0.162
7      QR    5.681   2.778     2.612    0.166
2   PivQR    5.873   2.872     2.723    0.150
1  lm.fit    7.229   3.535     3.467    0.069
4   GESDD   18.826   9.206     8.968    0.240
5     SVD   35.307  17.265    16.893    0.376
9     GSL  140.135  68.526    68.304    0.209

RcppGSL doesn't have this problem, only RcppArmadillo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20141017/b279f7c0/attachment.html>
#
On 17 October 2014 at 18:11, Matt wrote:
| When I try running lmBenchmark.R I get the following error:
| 
| 
| Rscript -e "source(system.file(\"examples\", \"lmBenchmark.R\", package = \
| "RcppEigen\"))"
| 
| lm benchmark for n = 100000 and p = 40: nrep = 20
| 
| Error in .Call("fastLm", mm, y, PACKAGE = "RcppArmadillo") :?
| 
| ? "fastLm" not available for .Call() for package "RcppArmadillo"

The signature changed when we changed the function to using Rcpp
Attributes.  This should be pretty easy to fix.
List fastLm(const arma::mat& X, const arma::colvec& y);
  RcppExport SEXP RcppArmadillo_fastLm(SEXP XSEXP, SEXP ySEXP) {

The file examples/fastLm.r in RcppArmadillo now does 

  fastLmPureDotCall <- function(X, y) {
      .Call("RcppArmadillo_fastLm", X, y, PACKAGE = "RcppArmadillo")
  }

so try that.  In case you get something working, consider sending in a patch.

Thanks, Dirk


| 
| Calls: source ... replicate -> sapply -> lapply -> FUN -> eval -> eval -> .Call
| 
| Timing stopped at: 0.001 0 0?
| 
| Execution halted
| 
| 
| This happens on both Mac OS X and Ubuntu 14, with R 3.1.1, Rcpp 0.11.3,
| RcppArmadillo?0.4.450.1.0, RcppEigen 0.3.2.2.0, RcppGSL 0.2.2 and rbenchmark
| 1.0.0
| 
| Note that if I run do_bench() manually but remove?exprs$arma then it runs fine:
| 
| > print(do_bench())
| lm benchmark for n = 100000 and p = 40: nrep = 20
| ? ? ?test relative elapsed user.self sys.self
| 3 ? ?LDLt ? ?1.000 ? 0.489 ? ? 0.483 ? ?0.006
| 8 ? ? LLt ? ?1.004 ? 0.491 ? ? 0.484 ? ?0.007
| 6 SymmEig ? ?3.043 ? 1.488 ? ? 1.321 ? ?0.162
| 7 ? ? ?QR ? ?5.681 ? 2.778 ? ? 2.612 ? ?0.166
| 2 ? PivQR ? ?5.873 ? 2.872 ? ? 2.723 ? ?0.150
| 1 ?lm.fit ? ?7.229 ? 3.535 ? ? 3.467 ? ?0.069
| 4 ? GESDD ? 18.826 ? 9.206 ? ? 8.968 ? ?0.240
| 5 ? ? SVD ? 35.307 ?17.265 ? ?16.893 ? ?0.376
| 9 ? ? GSL ?140.135 ?68.526 ? ?68.304 ? ?0.209
| 
| RcppGSL doesn't have this problem, only RcppArmadillo.
| _______________________________________________
| 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
2 days later
#
I've confirmed that this works on R 3.1.1 under OS X, using RcppArmadillo
0.4.450.1.0:

*diff --git a/inst/examples/lmBenchmark.R b/inst/examples/lmBenchmark.R*

*index 9037107..dd49375 100644*

*--- a/inst/examples/lmBenchmark.R*

*+++ b/inst/examples/lmBenchmark.R*

@@ -37,7 +37,7 @@ exprs$QR <- expression(.Call("fastLm", mm, y, 1L,
PACKAGE="Rcp

 exprs$LLt <- expression(.Call("fastLm", mm, y, 3L, PACKAGE="RcppEigen"))



 if (suppressMessages(require("RcppArmadillo", character=TRUE,
quietly=TRUE))) {

-    exprs$arma <- expression(.Call("fastLm", mm, y,
PACKAGE="RcppArmadillo"))

+    exprs$arma <- expression(.Call("RcppArmadillo_fastLm", mm, y,
PACKAGE="Rcpp

 }



 if (suppressMessages(require("RcppGSL", character=TRUE, quietly=TRUE))) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20141020/7c09dc2a/attachment.html>
#
On 20 October 2014 at 12:26, Matt wrote:
| I've confirmed that this works on R 3.1.1 under OS X, using RcppArmadillo?
| 0.4.450.1.0:

Thanks for testing / conforming, and of course for having alterted us in the
first place -- I am updating the example code.

Dirk
| 
| 
| diff --git a/inst/examples/lmBenchmark.R b/inst/examples/lmBenchmark.R
| 
| index 9037107..dd49375 100644
| 
| --- a/inst/examples/lmBenchmark.R
| 
| +++ b/inst/examples/lmBenchmark.R
| 
| @@ -37,7 +37,7 @@ exprs$QR <- expression(.Call("fastLm", mm, y, 1L, PACKAGE=
| "Rcp
| 
| ?exprs$LLt <- expression(.Call("fastLm", mm, y, 3L, PACKAGE="RcppEigen"))
| 
| ?
| 
| ?if (suppressMessages(require("RcppArmadillo", character=TRUE, quietly=TRUE)))
| {
| 
| -? ? exprs$arma <- expression(.Call("fastLm", mm, y, PACKAGE="RcppArmadillo"))
| 
| +? ? exprs$arma <- expression(.Call("RcppArmadillo_fastLm", mm, y, PACKAGE=
| "Rcpp
| 
| ?}
| 
| ?
| 
| ?if (suppressMessages(require("RcppGSL", character=TRUE, quietly=TRUE))) {
|