Skip to content

Segfault with eigen in R #703

@kyleam

Description

@kyleam

Hello,

The Guix package manager contains an OpenBLAS recipe. When used with
R, calling eigen with a matrix over some size results in a segfault:

R --vanilla -d valgrind
> x <- eigen(crossprod(matrix(rnorm(50 * 500), 50, 500)))
==12518== Invalid read of size 8
==12518==    at 0x8E400E0: dgemv_t_SANDYBRIDGE (in /gnu/store/hw9p1zyn1nh8pbm1cl69nm0i391lk6c7-openblas-0.2.15/lib/libopenblasp-r0.2.15.so)
==12518==    by 0x16BAED48: dlatrd_ (in /gnu/store/jb11p396a277rndb52da20ygdksccji8-r-3.2.2/lib/R/lib/libRlapack.so)
==12518==    by 0x16C61F92: dsytrd_ (in /gnu/store/jb11p396a277rndb52da20ygdksccji8-r-3.2.2/lib/R/lib/libRlapack.so)
==12518==    by 0x16CB9540: dsyevr_ (in /gnu/store/jb11p396a277rndb52da20ygdksccji8-r-3.2.2/lib/R/lib/libRlapack.so)
==12518==    by 0x19F42D5E: La_rs (in /gnu/store/jb11p396a277rndb52da20ygdksccji8-r-3.2.2/lib/R/modules/lapack.so)
==12518==    by 0x19F45B96: mod_do_lapack (in /gnu/store/jb11p396a277rndb52da20ygdksccji8-r-3.2.2/lib/R/modules/lapack.so)
==12518==    by 0x4F35635: bcEval (in /gnu/store/jb11p396a277rndb52da20ygdksccji8-r-3.2.2/lib/R/lib/libR.so)
==12518==    by 0x4F432DF: Rf_eval (in /gnu/store/jb11p396a277rndb52da20ygdksccji8-r-3.2.2/lib/R/lib/libR.so)
==12518==    by 0x4F48F4B: Rf_applyClosure (in /gnu/store/jb11p396a277rndb52da20ygdksccji8-r-3.2.2/lib/R/lib/libR.so)
==12518==    by 0x4F4345E: Rf_eval (in /gnu/store/jb11p396a277rndb52da20ygdksccji8-r-3.2.2/lib/R/lib/libR.so)
==12518==    by 0x4F46BBD: do_set (in /gnu/store/jb11p396a277rndb52da20ygdksccji8-r-3.2.2/lib/R/lib/libR.so)
==12518==    by 0x4F4367C: Rf_eval (in /gnu/store/jb11p396a277rndb52da20ygdksccji8-r-3.2.2/lib/R/lib/libR.so)
==12518==  Address 0xfb0 is not stack'd, malloc'd or (recently) free'd
==12518==

 *** caught segfault ***
address 0xfb0, cause 'memory not mapped'

Traceback:
 1: eigen(crossprod(matrix(rnorm(50 * 500), 50, 500)))

This does not occur when R is built without OpenBLAS.

System details:

  • Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz
  • GNU/Linux (GuixSD and Guix-build on Arch Linux)
  • gcc 4.9

OpenBLAS has been configured with NO_LAPACK=1,DYNAMIC_ARCH=1.

R is built with the following flags:

  • --with-blas=openblas
  • --with-lapack
  • --with-cairo
  • --with-libpng
  • --with-jpeglib
  • --with-libtiff
  • --with-ICU
  • --enable-R-shlib
  • --enable-BLAS-shlib
  • --with-system-zlib
  • --with-system-bzlib
  • --with-system-pcre
  • --with-system-tre
  • --with-system-xz

Any ideas on what the source of this problem might be? (While
discussing this on the Guix ticket, it was suggested that the
issue may be on the R side.)

Thanks in advance.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions