On Wednesday, May 14th, 2025 at 10:33 AM, Dirk Eddelbuettel <e...@debian.org> 
wrote:

> 
> 
> Section 'A.3.1.3 Intel MKL' of the R Installation and Administration manual
> covers that for the MKL case (and general OpenMP cases)
> 
> The default number of threads will be chosen by the OpenMP software, but
> can be controlled by setting ‘OMP_NUM_THREADS’ or ‘MKL_NUM_THREADS’, and
> in recent versions seems to default to a sensible value for sole use of
> the machine.

Are these options to be set using Sys.setenv()? I tried that on a Linux 
machine, and it did not prevent the problem. I am not sure that is actually how 
these settings are controlled, though. Specifically,

Sys.setenv(MKL_NUM_THREADS = 1)
n <- 50
set.seed(20250504)
Sigma <- rWishart(1, df = n, Sigma = diag(n))[,,1]
e1 <- eigen(Sigma)
e2 <- eigen(Sigma)
identical(e1, e2)

results in FALSE. I am not sure whether the age of the hardware is relevant, 
but it is about 14 years old. If anyone tests this and generally gets TRUE, 
what happens when n is increased?

> 
> The entire section makes for good reading, it mixes 'how to install MKL' with
> 'how to use MKL' and touches upon the parellism issue you have here.
> 

A minor point, which might be relevant: the discussion I see in A.3 is about 
results differing across implementations, not within a given implementation.

> Dirk
> 
> --
> dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to