0

I am attempting to implement a particle filter within Rcpp and use OpenMP to parallelise the transition step. I am using dqrng to create threadsafe RNG with using the boost distribution functions as per here.

The code for the R API can be found here and introducing dqrng here

The issue I am having is that, using the R API, I achieve correct results, verified against alternate implementations, with the density of the estimator being roughly normally distributed as expected. However, for the dqrng version the density of the estimator does not appear correct with differing results being obtained. The density plots can be seen below.

Density of estimator with dqrng

Density of estimator with R API

Does anyone have any understanding of why this might be the case?

proverIdr
  • 13
  • 3
  • Different (and I may add _entirely different_) generators, different results. The most likely (but I am guessing here) answer may be that you are doing something wrong with `dqrng`. – Dirk Eddelbuettel May 26 '20 at 18:58
  • Indeed they are different generators but there is a significantly large difference in results which I do not believe should be present. I agree that the issue is almost definitely with the usage of `dqrng` but I cannot see a substantial difference from the linked example and was hoping someone more familiar with the library could spot the error. – proverIdr May 26 '20 at 19:03
  • 2
    Can you reduce the two code examples? This is quite for from a [mre]. – Ralf Stubner May 27 '20 at 17:03
  • 2
    From a quick look at the code I have the impression you are trying to change two things at the same time: Introduce `dqrng` and OpenMP. For the latter, you have switched from `Rcpp` to `RcppParallel` data structures. I would suggest to use a more step wise approach: Use your working code and only change it to `dqrng`. If that works, switch to `RcppParallel` data structures. Only in the end go to OpenMP. – Ralf Stubner May 27 '20 at 17:18

0 Answers0