[Rcpp-devel] Fwd: CRAN submission growfunctions 0.1

Dirk Eddelbuettel edd at debian.org
Sat Aug 9 13:55:55 CEST 2014


On 9 August 2014 at 07:30, terrance savitsky wrote:
| Hi Rcpp developers,  I recently added a new package (growfunctions) to
| CRAN (http://cran.r-project.org/web/packages/growfunctions/index.html)

[ Congrats. I actually saw that via CRANberries, and noted it on the page
  with CRAN users: http://dirk.eddelbuettel.com/code/rcpp.cranusers.html ]

| that uses Rcpp and RcppArmadillo.  The attached links report a
| memory-access error associated to the as<> wrapper for SpMat objects
| (that I use in the file 'dpmix.cpp' to wrap dgCMatrix objects of the
| Matrix package).  I'd appreciate your input on whether this is a known
| issue and whether there is a fix?

It is neither known nor is there a fix.  But read on ...

| http://www.stats.ox.ac.uk/pub/bdr/memtests/ASAN/growfunctions/
| http://www.stats.ox.ac.uk/pub/bdr/memtests/valgrind/?C=M;O=D
| 
| Thank you for your help and thoughts.

I just put together tools to test ASAN more easily, and blogged / wrote about it:

   http://dirk.eddelbuettel.com/blog/2014/08/03#sanitizers_0.1.0
   http://dirk.eddelbuettel.com/code/sanitizers.html

You can use this on Windows thanks to boot2docker.

Now, as for the bug, we see from the ASAN log provided by Prof Ripley

RcppArmadilloAs.h:

            // create space for values, and copy
            arma::access::rw(res.values) = arma::memory::acquire_chunked<T>(x.size() + 1);
            arma::arrayops::copy(arma::access::rwp(res.values), x.begin(), x.size() + 1);

calling the copy here in arraysops

template<typename eT>
arma_hot
arma_inline
void
arrayops::copy(eT* dest, const eT* src, const uword n_elem)
  {
  if( (n_elem <= 16) && (is_cx<eT>::no) )
    {
    arrayops::copy_small(dest, src, n_elem);
    }
  else
    {
    std::memcpy(dest, src, n_elem*sizeof(eT));
    }
  }

as our "as<>" is at fault.

Now -- I do not use sparse matrices.  I contributed this code because Soren
et al very kindly asked.  

In the same spirit, it would be really helpful if you could distill out a
pure C++ example so that I could triage and eventually discuss with Conrad
what we need.  The 'off by one error' may well be of my making, but test
cases would be good.  

I am traveling a little early next week so this may take a bit to get
focus.  Any help you can provide would be appreciated.

Dirk

 
| Terrance
| 
| 
| ---------- Forwarded message ----------
| From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
| Date: Sat, Aug 9, 2014 at 3:08 AM
| Subject: Re: CRAN submission growfunctions 0.1
| To: Uwe Ligges <ligges at statistik.tu-dortmund.de>, Terrance Savitsky
| <tds151 at gmail.com>, CRAN <cran at r-project.org>
| 
| 
| This has memory-access errors, see
| 
| http://www.stats.ox.ac.uk/pub/bdr/memtests/ASAN/growfunctions/
| http://www.stats.ox.ac.uk/pub/bdr/memtests/valgrind/?C=M;O=D
| 
| which will get linked from the CRAN results page in due course.
| 
| 
| On 08/08/2014 23:03, Uwe Ligges wrote:
| >
| > Thanks, on CRAN now.
| >
| > Best,
| > Uwe Ligges
| >
| > On 08.08.2014 20:57, Terrance Savitsky wrote:
| >>
| >> [This was generated from CRAN.R-project.org/submit.html]
| >>
| >> The following package was uploaded to CRAN:
| >> ===========================================
| >>
| >> Package Information:
| >> Package: growfunctions
| >> Version: 0.1
| >> Title: Bayesian non-parametric dependent models for time-indexed
| >>    functional data
| >> Author(s): Terrance Savitsky
| >> Maintainer: Terrance Savitsky <tds151 at gmail.com>
| >> Depends: R (>= 3.1.1), Rcpp (>= 0.11.2)
| >> Suggests: testthat(>= 0.8.1)
| >> Description: Estimates a collection of time-indexed functions under
| >> either
| >>    of Gaussian process (GP) or intrinsic Gaussian Markov random
| >>    field (iGMRF) prior formulations where a Dirichlet process
| >>    mixture allows sub-groupings of the functions to share the
| >>    same covariance or precision parameters. The GP and iGMRF
| >>    formulations both support any number of additive covariance
| >>    or precision terms, respectively, expressing either or both
| >>    of multiple trend and seasonality.
| >> License: GPL (>= 3)
| >> Imports: Matrix(>= 1.1), spam(>= 0.41-0), mvtnorm(>= 1.0-0), ggplot2(>=
| >>    0.9.3.1), reshape2(>= 1.2.2), scales(>= 0.2.3)
| >> LinkingTo: Rcpp (>= 0.11.2), RcppArmadillo (>= 0.4.000)
| >>
| >>
| >> The maintainer confirms that he or she
| >> has read and agrees to the CRAN policies.
| >>
| >> Submitter's comment: I upload growfunctions version 0.1, which is a new
| >>    package submission to CRAN.  It successfully checks
| >>    for me, without issue, under R-devel --as-cran.  The
| >>    examples run in < 5s on my hardware
| >>    configuration.
| >>
| >> Thank you for your work on my
| >>    package.
| >>
| >> Terrance Savitsky
| >>    (tds151 at gmail.com)
| >> growfunctions package maintainer.
| >>
| >
| 
| 
| --
| Brian D. Ripley,                  ripley at stats.ox.ac.uk
| Emeritus Professor of Applied Statistics, University of Oxford
| 1 South Parks Road, Oxford OX1 3TG, UK
| 
| 
| -- 
| Thank you, Terrance Savitsky
| _______________________________________________
| 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

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list