[R] inconsistency in mclapply.....

akshay kulkarni @k@h@y_e4 @end|ng |rom hotm@||@com
Sat Jun 10 15:46:12 CEST 2023

Dear Ivan,
                   What if I switch to Ubuntu?
I had a similar ( but not exactly the same) problem way back in 2018 and switching to Ubuntu solved it.

Thanking you,
Yours sincerely,
Akshay M Kulkarni

From: Ivan Krylov <krylov.r00t using gmail.com>
Sent: Saturday, June 10, 2023 5:42 PM
To: akshay kulkarni <akshay_e4 using hotmail.com>
Cc: R help Mailing list <r-help using r-project.org>
Subject: Re: [R] inconsistency in mclapply.....

On Sat, 10 Jun 2023 11:49:10 +0000
akshay kulkarni <akshay_e4 using hotmail.com> wrote:

> (gdb) backtrace
> #0  0x00007f94b6454053 in gomp_team_barrier_wait_end () from /lib64/libgomp.so.1
> #1  0x00007f94b6452a7d in gomp_team_end () from /lib64/libgomp.so.1
> #2  0x00007f94b3c280cf in exec_blas () from /lib64/libopenblaso.so.0
> #3  0x00007f94b3c263e4 in gemm_thread_n () from /lib64/libopenblaso.so.0
> #4  0x00007f94b3c39077 in dgetrs_N_parallel () from /lib64/libopenblaso.so.0
> #5  0x00007f94b39f7f65 in dgesv_ () from /lib64/libopenblaso.so.0
> #6  0x00007f948556aebe in La_solve () from /usr/lib64/R/modules//lapack.so
> #7  0x00007f948556e555 in mod_do_lapack () from /usr/lib64/R/modules//lapack.so
> #8  0x00007f94b67a9c93 in bcEval () from /usr/lib64/R/lib/libR.so

I'm afraid this is exactly OpenBLAS trying to use OpenMP and failing
because it currently breaks in programs that fork().

Related links are <https://github.com/xianyi/OpenBLAS/issues/294> and

I was hoping that setting OPENBLAS_NUM_THREADS=1 would prevent OpenBLAS
from trying to use OpenMP, but that doesn't seem to work. If you
replace OPENBLAS_NUM_THREADS with OMP_NUM_THREADS (in order to limit
the number on OpenMP side), does it also not work?

How did you install OpenBLAS on this machine? If my environment
variable adjustments don't work, you'll need to either replace OpenBLAS
with a different build (for example, one that uses pthreads instead of
OpenMP, or a pure single-thread build, since you're already using
mclapply), or even remove OpenBLAS altogether and replace it with a
different BLAS that is fork()-safe.

Best regards,

	[[alternative HTML version deleted]]

More information about the R-help mailing list