<div dir="ltr"><div>Hi Dirk, The revised version of this toy package, sparseList, does exactly what you request.  I've included a data set that is of the same construction (of dgCMatrix elements from R::Matrix wrapped into a list object) and have added both an example and test that call this data.  The package is minimal, with a simple .cpp function (that reads in the list of dgCMatrix objects and writes the elements to an arma::field<arma:sp_mat>)  to isolate the source of the error in growfunctions.</div>
<div> </div><div>I attach the tarball, which you may also access through the following URL:</div><div> </div><div><a href="https://drive.google.com/file/d/0B0DIDcaf6yMwZDRDZUNLd0lBbmZ3OHlHSzIyeV9hZ3RxZ0xr/edit?usp=sharing">https://drive.google.com/file/d/0B0DIDcaf6yMwZDRDZUNLd0lBbmZ3OHlHSzIyeV9hZ3RxZ0xr/edit?usp=sharing</a></div>
<div> </div><div>I hope this gives you what you need and thanks very much for looking into this.</div><div> </div><div>Terrance</div><div>​<br><div style="padding:5px;border:1px solid rgb(221,221,221);width:396px;height:18px;color:rgb(34,34,34);line-height:1;font-family:arial;font-size:13px;font-style:normal;font-weight:bold;max-height:18px;background-color:rgb(245,245,245)" class="gmail_chip gmail_drive_chip">
<a style="padding:1px 0px;border:currentColor;width:100%;overflow:hidden;text-decoration:none;display:inline-block;white-space:nowrap;text-overflow:ellipsis" href="https://docs.google.com/file/d/0B0DIDcaf6yMwZDRDZUNLd0lBbmZ3OHlHSzIyeV9hZ3RxZ0xr/edit?usp=drive_web" target="_blank"><img style="border: currentColor; vertical-align: bottom;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span style="color:rgb(17,85,204);text-decoration:none;vertical-align:bottom" dir="ltr">sparseList_1.1.tar.gz</span></a></div>
​</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 9, 2014 at 5:25 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi Terrance,<br>
<div><br>
On 9 August 2014 at 16:58, terrance savitsky wrote:<br>
| Hi Guys, <br>
|  <br>
| I embed a data list object of dgCMatrix elements (produced in the same manner<br>
| as used in package, growfunctions) in an .RData file located in the sparseList<br>
| \data folder. I'm not sure what script and data ASAN uses to conduct the memory<br>
| check.  I'm guessing the package examples are run.  So I added an example that<br>
| loads the .RData object embedded with this toy package, sparseList.  Please<br>
| pardon me if my understanding is off.   I also embedd an R script in the single<br>
<br>
</div>It's not complicated.<br>
<br>
'R CMD check' needs a code path that does this, which can be as simple as an<br>
example section in the manual page (mayne you meant this by 'added an<br>
example').  Or something tickled via a test script in tests/.<br>
<br>
You submitted a CRAN package. It has testable code. It failed. We now need a<br>
_minimal reproducible example_, ideally without a long tail of dependencies,<br>
to examine it.<br>
<div><br>
| toy package .cpp file that generates the same data (list object of dgCMatrix<br>
| objects created using R::Matrix) and runs an example.<br>
|  <br>
| Terrance<br>
| ​<br>
|<br>
</div>| [icon_10_ge] sparseList_1.1.tar.gz<br>
<br>
Can you update to a version which loads data and passes down to the code<br>
which was seen to tickle this?<br>
<br>
And then place it somewhere where we can get it with a simple wget or curl call.<br>
<br>
Thanks, Dirk<br>
<div class="HOEnZb"><div class="h5"> ​<br>
<br>
|<br>
| On Sat, Aug 9, 2014 at 3:02 PM, Kevin Ushey <<a href="mailto:kevinushey@gmail.com">kevinushey@gmail.com</a>> wrote:<br>
|<br>
|     Hi Terrance,<br>
|<br>
|     Can you please try to construct a reproducible example based on the<br>
|     (tagged, potentially offending) line of code -- that is,<br>
|<br>
|         #4 0x7f79b6541df0 in IGMRFDPMIX<br>
|     /data/gannet/ripley/R/packages/tests-49x/growfunctions/src/dpmix.cpp:63<br>
|<br>
|     which has the line:<br>
|<br>
|         C(k,0)          = as<sp_mat>(Cr[k]);<br>
|<br>
|     Can you construct a small, reproducible example using objects 'C',<br>
|     'Cr' as you construct in the package, and then see if that gives a<br>
|     similar error?<br>
|<br>
|     Preferably you can construct this using Rcpp Attributes, so an example<br>
|     of the form<br>
|<br>
|         // [[Rcpp::depends(RcppArmadillo)]]<br>
|<br>
|         #include <RcppArmadillo.h><br>
|         using namespace Rcpp;<br>
|<br>
|         // [[Rcpp::export]]<br>
|         SEXP test(SEXP C, SEXP Cr) {<br>
|           ... use C, Cr as above...<br>
|         }<br>
|<br>
|         /*** R<br>
|         ... construct C, Cr on the R side as necessary ...<br>
|         */<br>
|<br>
|     That way, we can 'sourceCpp' it and immediately investigate.<br>
|<br>
|     Thanks,<br>
|     Kevin<br>
|<br>
|     On Sat, Aug 9, 2014 at 11:31 AM, terrance savitsky <<a href="mailto:tds151@gmail.com">tds151@gmail.com</a>><br>
|     wrote:<br>
|     > Dirk,  Thanks much for taking the time to investigate this issue.  I've<br>
|     > created a package (sparseList_1.0.tar.gz) with a minimal example of what<br>
|     > writing from a list of dgCMatrix matrices at the R layer to a field<br>
|     <sp_mat>.<br>
|     > I had intended to install boot2docker and use load your R-devel set-up to<br>
|     a<br>
|     > container so that I could replicate the ASAN-generated error.  Its taking<br>
|     me<br>
|     > longer than I'd hoped, however, so - for now - I include the package<br>
|     tarball<br>
|     > with the minimal example and also an R script (sparse_list_to_field.R) so<br>
|     > that you may see what the function does.<br>
|     > Terrance<br>
|     >  sparse_list_to_field.R<br>
|     ><br>
|     >  sparseList_1.0.tar.gz<br>
|     ><br>
|     ><br>
|     ><br>
|     > On Sat, Aug 9, 2014 at 11:50 AM, Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>><br>
|     wrote:<br>
|     >><br>
|     >><br>
|     >> Terrance,<br>
|     >><br>
|     >> So I took a look with one of the prebuilt versions of R using the Docker<br>
|     >> container I prepare (see the blog / sanitizers write-up I linked to) as<br>
|     I<br>
|     >> realized that we had a Rcpp Gallery post similar to what that as<><br>
|     >> conversion<br>
|     >> does.<br>
|     >><br>
|     >> And no issue with that code.<br>
|     >><br>
|     >> From a brief look at your package it seems like you are pushing the<br>
|     >> envelope<br>
|     >> a lot harder with fields and list of sparse matrices ( in dpmix.cpp,<br>
|     where<br>
|     >> another ASAN log pointed to ) so you may have to debug around there.<br>
|     >><br>
|     >> A small reproducible example would surely help us. So far I don't have<br>
|     one<br>
|     >> for as<sp_mat>.<br>
|     >><br>
|     >> Dirk<br>
|     >><br>
|     >> --<br>
|     >> <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a><br>
|     ><br>
|     ><br>
|     ><br>
|     ><br>
|     > --<br>
|     > Thank you, Terrance Savitsky<br>
|     ><br>
|     > _______________________________________________<br>
|     > Rcpp-devel mailing list<br>
|     > <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
|     > <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
|<br>
|<br>
|<br>
|<br>
| --<br>
| Thank you, Terrance Savitsky<br>
<br>
--<br>
<a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Thank you, Terrance Savitsky
</div>