Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-18 Thread Rolf Turner
On Fri, 18 Aug 2023 12:17:51 +0200 Martin Maechler wrote: > I think it would be nice to provide the average R user with a > (possibly super small) R package that allows to turn on (and off) > such CNR reproducibility. Would it be possible to effect this on/off via options()? cheers,

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-18 Thread Martin Maechler
> Bill Dunlap > on Thu, 17 Aug 2023 07:31:12 -0700 writes: > MKL's results can depend on the number of threads running and perhaps other > things. They blame it on the non-associativity of floating point > arithmetic. This article gives a way to make results

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Shu Fai Cheung
Thanks a lot! I am not aware of this behavior! I will take this into account in my work. Regards, Shu Fai On Thu, Aug 17, 2023 at 10:31 PM Bill Dunlap wrote: > > MKL's results can depend on the number of threads running and perhaps other > things. They blame it on the non-associativity of

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Viechtbauer, Wolfgang (NP)
Ah, super interesting! Thanks for the pointer, Bill. I might not have seen the issue because I have export MKL_NUM_THREADS=1 in my .profile, so MKL never goes beyond using one thread on my machine. That's a potential source of non-reproducibility I have not come across. So the 'wisdom' that

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Ben Bolker
Thanks, I was missing the point that this was *non-repeatability on the same platform*. On 2023-08-17 10:31 a.m., Bill Dunlap wrote: MKL's results can depend on the number of threads running and perhaps other things. They blame it on the non-associativity of floating point arithmetic. This

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Shu Fai Cheung
Sorry for the confusion caused by that sentence. I did not expect using the same seed generates the same sequence of numbers unconditionally. What puzzled me is not having the same sequence when running the same code repeatedly in the same computer in the same session of R. The following four sets

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Bill Dunlap
MKL's results can depend on the number of threads running and perhaps other things. They blame it on the non-associativity of floating point arithmetic. This article gives a way to make results repeatable:

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Viechtbauer, Wolfgang (NP)
But I have never seen a case where, on the same machine and using the same math routines, using the same seed repeatedly generated different values. That is quite bizarre (the issue I was discussing in the thread is quite simple in comparison). I tried to reproduce the issue below, but was

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Ben Bolker
> However, should the numbers > generated identical if the same seed is used? I don't see how using the same seed can overcome floating-point differences across platforms (compilers etc.) stemming from differences in an eigen() computation (based on arcane details like use of registers,

[R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-16 Thread Shu Fai Cheung
Hi All, When addressing an error in one of my packages in the CRAN check at CRAN, I found something strange which, I believe, is unrelated to my package. I am not sure whether it is a bug or a known issue. Therefore, I would like to have advice from experts here. The error at CRAN check occurred