Skip to content
Prev 8844 / 10988 Next

[Rcpp-devel] When calling same Rcpp function several times different results are returned

The examples in the RcppParallel documentation assume that access to
vectors and matrixes are *aligned* (i.e. fall into neat buckets
whereby reading and writing doesn't overlap between worker instances).
Your example appears to access arbitrary elements of sg (depending on
what's passed in gi) which probably creates overlapping reads/writes.
You should also study the documentation for join carefully.

There's nothing incorrect about RcppParallel's behavior here, rather
you need to think more carefully about the access patterns of your
data and how they might conflict. You may need to introduce locking to
overcome the conflicts, which in turn could kill the performance
benefit you gain from parallelism. No easy answers here :-\
On Tue, Jul 14, 2015 at 7:15 AM, Danas Zuokas <danas.zuokas at gmail.com> wrote: