Discussion:
[eigen] segment fault in "Eigen::internal::gemm_pack_rhs" when call MatrixXd multiplication on a memory limited 32 bit platform
extr15
2017-07-20 16:09:22 UTC
Permalink
Hello, it seems I can't log in "http://eigen.tuxfamily.org/bz/?GoAheadAndLogIn=1" as I am a new user, so I write this mail to ask for your help, thanks!
I have a project which runs OK on my 64bit laptop( ubuntu), but when I run this program on a 32 bit linux platform, it will crash with the output:
"
*** Aborted at 2926 (unix time) try "date -d @2926" if you are using GNU date ***
PC: @ 0x206384 Eigen::internal::gemm_pack_rhs<>::operator()()
segment fault
"
I use gdb to debug, and the "bt" output:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 1138]
0x0020b65c in Eigen::internal::gemm_pack_rhs<double, int, 2, 0, false, false>::operator() (blockB=0xb6e3dc00, rhs=***@entry=0x1cda940, rhsStride=1071644672,
***@entry=106, depth=***@entry=106, cols=106,
this=<optimized out>, offset=0, stride=0)
at eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1236
1236eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h: No such file or directory.
(gdb) #0 0x0020b65c in Eigen::internal::gemm_pack_rhs<double, int, 2, 0, false, false>::operator() (blockB=0xb6e3dc00, rhs=***@entry=0x1cda940,
rhsStride=1071644672, ***@entry=106, depth=***@entry=106,
cols=106, this=<optimized out>, offset=0, stride=0)
at eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1236
#1 0x00212664 in Eigen::internal::general_matrix_matrix_product<int, double, 0, false, double, 0, false, 0>::run (rows=3, cols=<optimized out>,
depth=<optimized out>, _lhs=<optimized out>, lhsStride=3, _rhs=0x1cda940,
rhsStride=106, res=0x1e39ac0, resStride=3, alpha=1, blocking=..., info=0x0)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:171
#2 0x0021cacc in Eigen::internal::gemm_functor<double, int, Eigen::internal::general_matrix_matrix_product<int, double, 0, false, double, 0, false, 0>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::internal::gemm_blocking_space<0, double, double, -1, -1, -1, 1, false> >::operator() (info=0x0,
cols=<optimized out>, col=0, rows=<optimized out>, row=0,
this=<optimized out>)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:221
#3 Eigen::internal::parallelize_gemm<true, Eigen::internal::gemm_functor<double, int, Eigen::internal::general_matrix_matrix_product<int, double, 0, false, dou---Type <return> to continue, or q <return> to quit---ble, 0, false, 0>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::internal::gemm_blocking_space<0, double, double, -1, -1, -1, 1, false> >, int> (
transpose=false, cols=<optimized out>, rows=<optimized out>, func=...)
at eigen3/Eigen/src/Core/products/Parallelizer.h:96
#4 Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>::scaleAndAddTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (alpha=<optimized out>, dst=..., this=0xb6e546a4)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:421
#5 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::scaleAndAddTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (alpha=<optimized out>, dst=...,
this=0xb6e546a4)
at eigen3/Eigen/src/Core/ProductBase.h:118
#6 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::evalTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (dst=..., this=0xb6e546a4)
at eigen3/---Type <return> to continue, or q <return> to quit---Eigen/src/Core/ProductBase.h:109
#7 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::operator Eigen::Matrix<double, -1, -1, 0, -1, -1> const& (this=0xb6e546a4)
at eigen3/Eigen/src/Core/ProductBase.h:127
#8 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const>, 5>, Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const> >::ProductBase (a_rhs=..., a_lhs=..., this=<optimized out>)
at eigen3/Eigen/src/Core/ProductBase.h:98
#9 Eigen::GeneralProduct<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const>, 5>::GeneralProduct (rhs=...,
lhs=..., this=<optimized out>)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:391
#10 Eigen::MatrixBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5> >::operator*<Eigen::Transpose---Type <return> to continue, or q <return> to quit---<Eigen::Matrix<double, -1, -1, 0, -1, -1> const> > (other=..., this=0xb6e546a4)
at eigen3/Eigen/src/Core/GeneralProduct.h:595
-----------------------------------------------------------------------------------------------------------------------------------------------------------------


and I find this is called by a matrix multiplication like:
" MatrixXd cov2= H.transpose() * cov * H; "
when I comment out this line and the segment fault will gone.
also, if I use opencv's matrix multiplication here and no segment fault will happen, so I think it's a bug of eigen.


the rows of H may be 6~200, and the cols of H is 3. I write a simple code to test but no segment fault happen, here's my simple code:
"
MatrixXd H(2*num, 3);
MatrixXd cov = MatrixXd::Zero(2*num, 2*num);
H = MatrixXd::Random(2*num, 3);
cov = MatrixXd::Random(2*num, 2*num);
cout<<"H"<<endl<<H<<endl;
cout<<"cov"<<endl<<cov<<endl;
MatrixXd cov2= H.transpose() * cov * H;
cout<<cov2<<endl;
"


I have tried to use gdb to debug, but no more info I can get.
Could you please have a look or tell me how to debug this problem? thanks!


some info about my platform:

uname -a
Linux 3.4.39 #375 SMP PREEMPT Mon Jul 17 09:07:31 UTC 2017 armv7l GNU/Linux


free
total used free shared buff/cache available
Mem: 524288 21000 270188 1372 233100 491107
Swap: 0 0 0


df -h
Filesystem Size Used Available Use% Mounted on
rootfs 5.0M 528.0K 4.5M 10% /
/dev/root 5.8M 5.8M 0 100% /rom
tmpfs 250.9M 1.3M 249.5M 1% /tmp
/dev/mtdblock5 5.0M 528.0K 4.5M 10% /overlay
overlayfs:/overlay 5.0M 528.0K 4.5M 10% /
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mmcblk0p1 7.4G 3.1G 4.3G 42% /mnt/SDCARD
/dev/by-name/UDISK 1.1M 196.0K 892.0K 18% /mnt/UDISK
/dev/by-name/boot 2.0M 1.7M 322.0K 84% /boot
/dev/by-name/boot-res
8.0M 39.0K 7.9M 0% /boot-res


Thanks again!
--

Best Regards!
--
extr15
Gael Guennebaud
2017-07-25 08:44:43 UTC
Permalink
Hi,

since you cannot reproduce with a self-contained example this is gonna be
difficult to fix. Some question to help isolate the issue:

1 - Does it crash for any problem size or for specific sizes only?

2 - Is your program multi-threaded?

3 - What is your exact version of Eigen? (lines are not matching the latest
3.3.4 stable release)

4 - You could try to run it within a memory debugger like valgrind.


Gael
Post by extr15
Hello, it seems I can't log in "http://eigen.tuxfamily.org/
bz/?GoAheadAndLogIn=1" as I am a new user, so I write this mail to ask
for your help, thanks!
I have a project which runs OK on my 64bit laptop( ubuntu), but when I run
"
segment fault
"
------------------------------------------------------------
------------------------------------------------------------
--------------------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 1138]
0x0020b65c in Eigen::internal::gemm_pack_rhs<double, int, 2, 0, false,
rhsStride=1071644672,
this=<optimized out>, offset=0, stride=0)
at eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1236
1236 eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h: No such
file or directory.
(gdb) #0 0x0020b65c in Eigen::internal::gemm_pack_rhs<double, int, 2, 0,
cols=106, this=<optimized out>, offset=0, stride=0)
at eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1236
#1 0x00212664 in Eigen::internal::general_matrix_matrix_product<int,
double, 0, false, double, 0, false, 0>::run (rows=3, cols=<optimized out>,
depth=<optimized out>, _lhs=<optimized out>, lhsStride=3,
_rhs=0x1cda940,
rhsStride=106, res=0x1e39ac0, resStride=3, alpha=1, blocking=..., info=0x0)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:171
#2 0x0021cacc in Eigen::internal::gemm_functor<double, int,
Eigen::internal::general_matrix_matrix_product<int, double, 0, false,
double, 0, false, 0>, Eigen::Matrix<double, -1, -1, 0, -1, -1>,
Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0,
-1, -1>, Eigen::internal::gemm_blocking_space<0, double, double, -1, -1,
-1, 1, false> >::operator() (info=0x0,
cols=<optimized out>, col=0, rows=<optimized out>, row=0,
this=<optimized out>)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:221
#3 Eigen::internal::parallelize_gemm<true, Eigen::internal::gemm_functor<double,
int, Eigen::internal::general_matrix_matrix_product<int, double, 0,
false, dou---Type <return> to continue, or q <return> to quit---ble, 0,
false, 0>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double,
-1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>,
Eigen::internal::gemm_blocking_space<0, double, double, -1, -1, -1, 1,
false> >, int> (
transpose=false, cols=<optimized out>, rows=<optimized out>, func=...)
at eigen3/Eigen/src/Core/products/Parallelizer.h:96
#4 Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>,
Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>::scaleAndAddTo<Eigen::Matrix<double,
-1, -1, 0, -1, -1> > (alpha=<optimized out>, dst=..., this=0xb6e546a4)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:421
#5 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1,
-1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>,
Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0,
-1, -1> >::scaleAndAddTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> >
(alpha=<optimized out>, dst=...,
this=0xb6e546a4)
at eigen3/Eigen/src/Core/ProductBase.h:118
#6 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1,
-1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>,
Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0,
-1, -1> >::evalTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (dst=...,
this=0xb6e546a4)
at eigen3/---Type <return> to continue, or q <return> to
quit---Eigen/src/Core/ProductBase.h:109
#7 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1,
-1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>,
Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0,
-1, -1> >::operator Eigen::Matrix<double, -1, -1, 0, -1, -1> const&
(this=0xb6e546a4)
at eigen3/Eigen/src/Core/ProductBase.h:127
GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>,
Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double,
-1, -1, 0, -1, -1> const>, 5>, Eigen::GeneralProduct<Eigen::Matrix<double,
-1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>,
Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const>
Post by extr15
::ProductBase (a_rhs=..., a_lhs=..., this=<optimized out>)
at eigen3/Eigen/src/Core/ProductBase.h:98
#9 Eigen::GeneralProduct<Eigen::GeneralProduct<Eigen::Matrix<double, -1,
-1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>,
Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const>,
5>::GeneralProduct (rhs=...,
lhs=..., this=<optimized out>)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:391
#10 Eigen::MatrixBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1,
0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>
Post by extr15
::operator*<Eigen::Transpose---Type <return> to continue, or q <return>
to quit---<Eigen::Matrix<double, -1, -1, 0, -1, -1> const> > (other=...,
this=0xb6e546a4)
at eigen3/Eigen/src/Core/GeneralProduct.h:595
------------------------------------------------------------
------------------------------------------------------------
-----------------------------------------
" MatrixXd cov2= H.transpose() * cov * H; "
when I comment out this line and the segment fault will gone.
also, if I use opencv's matrix multiplication here and no segment fault
will happen, so I think it's a bug of eigen.
the rows of H may be 6~200, and the cols of H is 3. I write a simple code
"
MatrixXd H(2*num, 3);
MatrixXd cov = MatrixXd::Zero(2*num, 2*num);
H = MatrixXd::Random(2*num, 3);
cov = MatrixXd::Random(2*num, 2*num);
cout<<"H"<<endl<<H<<endl;
cout<<"cov"<<endl<<cov<<endl;
MatrixXd cov2= H.transpose() * cov * H;
cout<<cov2<<endl;
"
I have tried to use gdb to debug, but no more info I can get.
Could you please have a look or tell me how to debug this problem? thanks!
uname -a
Linux 3.4.39 #375 SMP PREEMPT Mon Jul 17 09:07:31 UTC 2017 armv7l GNU/Linux
free
total used free shared buff/cache
available
Mem: 524288 21000 270188 1372 233100
491107
Swap: 0 0 0
df -h
Filesystem Size Used Available Use% Mounted on
rootfs 5.0M 528.0K 4.5M 10% /
/dev/root 5.8M 5.8M 0 100% /rom
tmpfs 250.9M 1.3M 249.5M 1% /tmp
/dev/mtdblock5 5.0M 528.0K 4.5M 10% /overlay
overlayfs:/overlay 5.0M 528.0K 4.5M 10% /
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mmcblk0p1 7.4G 3.1G 4.3G 42% /mnt/SDCARD
/dev/by-name/UDISK 1.1M 196.0K 892.0K 18% /mnt/UDISK
/dev/by-name/boot 2.0M 1.7M 322.0K 84% /boot
/dev/by-name/boot-res
8.0M 39.0K 7.9M 0% /boot-res
Thanks again!
--
Best Regards!
--
extr15
extr15
2017-08-03 14:58:20 UTC
Permalink
Hi Christoph,
Thanks for your reply. I also think it could be stack-overflow, but I don't very familiar with gdb and didn't figure it out how to get the stack frame length at that time. I'll try to learn the usage of `frame` and rsp/esp.
The `ulimit -s` of my platform is 8192.
Thanks for the clue of `EIGEN_STACK_ALLOCATION_LIMIT `, I'll try it.
Thanks for all your help, and once I have some progress, I'll post it, but maybe take some days, just too busy recently...

--

Best Regards!
--
extr15
Hi,
just speculating, but it could be a stack-overflow problem.
`ulimit -s`. The default for most linuxes today is 8192KiB, if it is
smaller than that, this might be the reason.
Is your matrix multiplication called inside a function, which already is
relatively deep in your call-stack (with some functions having
relatively big objects on the stack -- you can walk through your
stack-trace and check the value of rsp/esp at each stage to find
possible culprits).
If that is indeed the reason, you can try to reduce the space Eigen is
allowed to allocate for temporaries on the stack, by defining
EIGEN_STACK_ALLOCATION_LIMIT before including Eigen. (The default is
131072 == 128 KiB; maybe try 8192 bytes, then increase it until you get
crashes again). This could significantly reduce the performance, since
all temporaries above that size will be allocated on the heap.
Cheers,
Christoph
Hi Gael, thanks for your reply, I will try to reproduce a example but it's difficult.
1. it seems crash for matrix size bigger than about 100*100.
2. my program is multi-threaded.
3. the eigen version is 3.2.4, eigen-eigen-10219c95fe65, maybe I should try the latest stable release.
4. I don't think I can try it with valgrind, because the system has only 512MB memory, even running a gdb is not that easy.
Thank you again.
--
Best Regards!
--
extr15
Hi,
1 - Does it crash for any problem size or for specific sizes only?
2 - Is your program multi-threaded?
3 - What is your exact version of Eigen? (lines are not matching the latest 3.3.4 stable release)
4 - You could try to run it within a memory debugger like valgrind.
Gael
Hello, it seems I can't log in "http://eigen.tuxfamily.org/bz/?GoAheadAndLogIn=1" as I am a new user, so I write this mail to ask for your help, thanks!
"
segment fault
"
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 1138]
this=<optimized out>, offset=0, stride=0)
at eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1236
1236eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h: No such file or directory.
cols=106, this=<optimized out>, offset=0, stride=0)
at eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1236
#1 0x00212664 in Eigen::internal::general_matrix_matrix_product<int, double, 0, false, double, 0, false, 0>::run (rows=3, cols=<optimized out>,
depth=<optimized out>, _lhs=<optimized out>, lhsStride=3, _rhs=0x1cda940,
rhsStride=106, res=0x1e39ac0, resStride=3, alpha=1, blocking=..., info=0x0)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:171
#2 0x0021cacc in Eigen::internal::gemm_functor<double, int, Eigen::internal::general_matrix_matrix_product<int, double, 0, false, double, 0, false, 0>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::internal::gemm_blocking_space<0, double, double, -1, -1, -1, 1, false> >::operator() (info=0x0,
cols=<optimized out>, col=0, rows=<optimized out>, row=0,
this=<optimized out>)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:221
#3 Eigen::internal::parallelize_gemm<true, Eigen::internal::gemm_functor<double, int, Eigen::internal::general_matrix_matrix_product<int, double, 0, false, dou---Type <return> to continue, or q <return> to quit---ble, 0, false, 0>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::internal::gemm_blocking_space<0, double, double, -1, -1, -1, 1, false> >, int> (
transpose=false, cols=<optimized out>, rows=<optimized out>, func=...)
at eigen3/Eigen/src/Core/products/Parallelizer.h:96
#4 Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>::scaleAndAddTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (alpha=<optimized out>, dst=..., this=0xb6e546a4)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:421
#5 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::scaleAndAddTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (alpha=<optimized out>, dst=...,
this=0xb6e546a4)
at eigen3/Eigen/src/Core/ProductBase.h:118
#6 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::evalTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (dst=..., this=0xb6e546a4)
at eigen3/---Type <return> to continue, or q <return> to quit---Eigen/src/Core/ProductBase.h:109
#7 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::operator Eigen::Matrix<double, -1, -1, 0, -1, -1> const& (this=0xb6e546a4)
at eigen3/Eigen/src/Core/ProductBase.h:127
#8 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const>, 5>, Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const> >::ProductBase (a_rhs=..., a_lhs=..., this=<optimized out>)
at eigen3/Eigen/src/Core/ProductBase.h:98
#9 Eigen::GeneralProduct<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const>, 5>::GeneralProduct (rhs=...,
lhs=..., this=<optimized out>)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:391
#10 Eigen::MatrixBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5> >::operator*<Eigen::Transpose---Type <return> to continue, or q <return> to quit---<Eigen::Matrix<double, -1, -1, 0, -1, -1> const> > (other=..., this=0xb6e546a4)
at eigen3/Eigen/src/Core/GeneralProduct.h:595
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
" MatrixXd cov2= H.transpose() * cov * H;"
when I comment out this line and the segment fault will gone.
also, if I use opencv's matrix multiplication here and no segment fault will happen, so I think it's a bug of eigen.
"
MatrixXd H(2*num, 3);
MatrixXd cov = MatrixXd::Zero(2*num, 2*num);
H = MatrixXd::Random(2*num, 3);
cov = MatrixXd::Random(2*num, 2*num);
cout<<"H"<<endl<<H<<endl;
cout<<"cov"<<endl<<cov<<endl;
MatrixXd cov2= H.transpose() * cov * H;
cout<<cov2<<endl;
"
I have tried to use gdb to debug, but no more info I can get.
Could you please have a look or tell me how to debug this problem? thanks!
uname -a
Linux 3.4.39 #375 SMP PREEMPT Mon Jul 17 09:07:31 UTC 2017 armv7l GNU/Linux
free
total used free shared buff/cache available
Mem: 524288 21000 270188 1372 233100 491107
Swap: 0 0 0
df -h
Filesystem Size Used Available Use% Mounted on
rootfs 5.0M 528.0K 4.5M 10% /
/dev/root 5.8M 5.8M 0 100% /rom
tmpfs 250.9M 1.3M 249.5M 1% /tmp
/dev/mtdblock5 5.0M 528.0K 4.5M 10% /overlay
overlayfs:/overlay 5.0M 528.0K 4.5M 10% /
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mmcblk0p1 7.4G 3.1G 4.3G 42% /mnt/SDCARD
/dev/by-name/UDISK 1.1M 196.0K 892.0K 18% /mnt/UDISK
/dev/by-name/boot 2.0M 1.7M 322.0K 84% /boot
/dev/by-name/boot-res
8.0M 39.0K 7.9M 0% /boot-res
Thanks again!
--
Best Regards!
--
extr15
--
Dipl. Inf., Dipl. Math. Christoph Hertzberg
UniversitÀt Bremen
FB 3 - Mathematik und Informatik
AG Robotik
Robert-Hooke-Straße 1
28359 Bremen, Germany
Zentrale: +49 421 178 45-6611
Robert-Hooke-Straße 5
28359 Bremen, Germany
Tel.: +49 421 178 45-4021
Empfang: +49 421 178 45-6600
Fax: +49 421 178 45-4150
Weitere Informationen: http://www.informatik.uni-bremen.de/robotik
extr15
2017-08-09 07:20:42 UTC
Permalink
Hi Christoph, it seems to be stack-overflow.
I changed the `EIGEN_STACK_ALLOCATION_LIMIT` in `Eigen/src/Core/util/Macros.h` to 8KB or 64KB (original is 128KB), and the segment fault disappeared.
But if I just add a `#define EIGEN_STACK_ALLOCATION_LIMIT 8192` in the source cpp file where segment fault happen, it doesn't work. My project is pretty big and eigen is used in many place.
Then I want to check the stack with gdb. When the segment fault happen, by typing `info frame`, I can get the frame address, likes `Stack level 0, frame at 0xb5484108`.
so I can get all the stack frame address, and the result is:
~~~~~~~~~........................Split Line........................~~~~~~~~~
Stack level 0, frame at 0xb5484108:
1 Stack frame at 0xb54a35c0:
2 Stack frame at 0xb54a3858:
3 Stack frame at 0xb54a3858:
4 Stack frame at 0xb54a3858:
5 Stack frame at 0xb54a3858:
6 Stack frame at 0xb54a3858:
7 Stack frame at 0xb54a3858:
8 Stack frame at 0xb54a3858:
9 Stack frame at 0xb54a3858:
10 Stack frame at 0xb54a3858:
11 Stack frame at 0xb54a3858:
12 Stack frame at 0xb54a38e8:
13 Stack frame at 0xb54a3908:
14 Stack frame at 0xb54a3950:
15 Stack frame at 0xb54a3960:
16 Stack frame at 0xb54a3988:
17 Stack frame at 0xb54a3998:
18 Stack frame at 0xb54a39b0:
19 Stack frame at 0xb54a39e8:
20 Stack frame at 0xb54a39f0:
21 Stack frame at 0xb54a3cd0:
~~~~~~~~~........................Split Line........................~~~~~~~~~


the delta address between frame 0 and frame 1 is: 0xb54a35c0 - 0xb5484108 = 0x1f4b8= 128184 Bytes = 121KB.
and the other delta address between successive frames are much smaller, for example:
frame 1 and frame 2: 0xb54a3858 - 0xb54a35c0 = 0x298 = 664 bytes.
In my function, a typical matrix is about 100*100 MatrixXd, so the size is about: 100*100*8 bytes = 80KB.
What confused me is: in this function, I define the matrix with:
Eigen::VectorXd A(N);
Eigen::MatrixXd B(N, 3);
Eigen::MatrixXd C=Eigen::MatrixXd::Zero(N, N);
so I think the matrix alloc is on the heap instead of on the stack, am I right?
Also I still don't know how to get the available stack space size?
The `ulimit -s` is 8192KB, I thinks it is enough?


below are some other infos maybe useful.


cat /proc/1586/maps:
~~~~~~~~~........................Split Line........................~~~~~~~~~
00010000-00ba8000 r-xp 00000000 b3:01 53 /mnt/SDCARD/my_program
00bb8000-00bde000 rw-p 00b98000 b3:01 53 /mnt/SDCARD/my_program
00bde000-01f94000 rw-p 00000000 00:00 0 [heap]
b543f000-b548e000 rw-p 00000000 00:00 0 [stack:1608]
b548e000-b548f000 ---p 00000000 00:00 0
b548f000-b54a4000 rw-p 00000000 00:00 0
b5c79000-b5c7a000 ---p 00000000 00:00 0
b5c7a000-b5c8f000 rw-p 00000000 00:00 0 [stack:1598]
b5d16000-b5d73000 rw-p 00000000 00:00 0
b5d73000-b5d74000 ---p 00000000 00:00 0
b5d74000-b5d89000 rw-p 00000000 00:00 0 [stack:1594]
b5dac000-b5dad000 ---p 00000000 00:00 0
b5dad000-b5dc2000 rw-p 00000000 00:00 0 [stack:1618]
b5dc2000-b5dc3000 ---p 00000000 00:00 0
b5dc3000-b5dd8000 rw-p 00000000 00:00 0 [stack:1617]
b5dd8000-b5dd9000 ---p 00000000 00:00 0
b5dd9000-b5dee000 rw-p 00000000 00:00 0 [stack:1616]
b5dee000-b5def000 ---p 00000000 00:00 0
b5def000-b5e04000 rw-p 00000000 00:00 0 [stack:1615]
b5e04000-b5e05000 ---p 00000000 00:00 0
b5e05000-b5e1a000 rw-p 00000000 00:00 0 [stack:1614]
b5e1a000-b5e1b000 ---p 00000000 00:00 0
b5e1b000-b5e30000 rw-p 00000000 00:00 0 [stack:1613]
b5e30000-b5e31000 ---p 00000000 00:00 0
b5e31000-b5e46000 rw-p 00000000 00:00 0 [stack:1612]
b5e46000-b5e47000 ---p 00000000 00:00 0
b5e47000-b5e5c000 rw-p 00000000 00:00 0 [stack:1611]
b5e6d000-b5eb9000 rw-p 00000000 00:00 0
b5ef4000-b5f51000 rw-p 00000000 00:00 0
b5f51000-b5f52000 ---p 00000000 00:00 0
b5f52000-b5fb3000 rw-p 00000000 00:00 0 [stack:1593]
b5fc3000-b5fff000 rw-p 00000000 00:00 0
b5fff000-b6000000 ---p 00000000 00:00 0
b6000000-b6015000 rw-p 00000000 00:00 0 [stack:1592]
b6015000-b6016000 ---p 00000000 00:00 0
b6016000-b602b000 rw-p 00000000 00:00 0 [stack:1591]
b602b000-b609d000 rw-s 59190000 00:0d 1208 /dev/video0
b609d000-b610f000 rw-s 59110000 00:0d 1208 /dev/video0
b610f000-b6181000 rw-s 59090000 00:0d 1208 /dev/video0
b6181000-b61f3000 rw-s 59010000 00:0d 1208 /dev/video0
b61f3000-b6265000 rw-s 58f90000 00:0d 1208 /dev/video0
b6265000-b62d7000 rw-s 58f10000 00:0d 1208 /dev/video0
b62d7000-b6349000 rw-s 58e90000 00:0d 1208 /dev/video0
b6349000-b63bb000 rw-s 58e10000 00:0d 1208 /dev/video0
b63bb000-b642d000 rw-s 58d90000 00:0d 1208 /dev/video0
b642d000-b649f000 rw-s 58d10000 00:0d 1208 /dev/video0
b649f000-b6511000 rw-s 58c90000 00:0d 1208 /dev/video0
b6511000-b6583000 rw-s 58c10000 00:0d 1208 /dev/video0
b6583000-b65f5000 rw-s 58b90000 00:0d 1208 /dev/video0
b65f5000-b6667000 rw-s 58b10000 00:0d 1208 /dev/video0
b6667000-b66d9000 rw-s 58a90000 00:0d 1208 /dev/video0
b66d9000-b674b000 rw-s 58a10000 00:0d 1208 /dev/video0
b674b000-b67bd000 rw-s 58990000 00:0d 1208 /dev/video0
b67bd000-b682f000 rw-s 58910000 00:0d 1208 /dev/video0
b682f000-b68a1000 rw-s 58890000 00:0d 1208 /dev/video0
b68a1000-b6913000 rw-s 58810000 00:0d 1208 /dev/video0
b6913000-b6985000 rw-s 58790000 00:0d 1208 /dev/video0
b6985000-b69f7000 rw-s 58710000 00:0d 1208 /dev/video0
b69f7000-b6a69000 rw-s 58690000 00:0d 1208 /dev/video0
b6a69000-b6adb000 rw-s 58610000 00:0d 1208 /dev/video0
b6adb000-b6b4d000 rw-s 58590000 00:0d 1208 /dev/video0
b6b4d000-b6bbf000 rw-s 58510000 00:0d 1208 /dev/video0
b6bbf000-b6c31000 rw-s 58490000 00:0d 1208 /dev/video0
b6c31000-b6ca3000 rw-s 58410000 00:0d 1208 /dev/video0
b6ca3000-b6d15000 rw-s 58390000 00:0d 1208 /dev/video0
b6d15000-b6d87000 rw-s 58310000 00:0d 1208 /dev/video0
b6d87000-b6df9000 rw-s 58290000 00:0d 1208 /dev/video0
b6df9000-b6e6b000 rw-s 58210000 00:0d 1208 /dev/video0
b6e6b000-b6e84000 r-xp 00000000 1f:04 549 /lib/libgcc_s.so.1
b6e84000-b6e85000 rw-p 00009000 1f:04 549 /lib/libgcc_s.so.1
b6e85000-b6f7d000 r-xp 00000000 1f:04 495 /lib/libstdc++.so.6.0.21
b6f7d000-b6f82000 r--p 000e8000 1f:04 495 /lib/libstdc++.so.6.0.21
b6f82000-b6f85000 rw-p 000ed000 1f:04 495 /lib/libstdc++.so.6.0.21
b6f85000-b6f87000 rw-p 00000000 00:00 0
b6f87000-b6fed000 r-xp 00000000 1f:04 547 /lib/libc.so
b6ffb000-b6ffc000 r--s 00000000 00:0c 170 /tmp/TZ
b6ffc000-b6ffd000 r--p 00065000 1f:04 547 /lib/libc.so
b6ffd000-b6ffe000 rw-p 00066000 1f:04 547 /lib/libc.so
b6ffe000-b7000000 rw-p 00000000 00:00 0
befdf000-bf000000 rw-p 00000000 00:00 0 [stack]
ffff0000-ffff1000 r-xp 00000000 00:00 0 [vectors]
~~~~~~~~~........................Split Line........................~~~~~~~~~


we can see:
00bde000-01f94000 rw-p 00000000 00:00 0 [heap]
b543f000-b548e000 rw-p 00000000 00:00 0 [stack:1608]
The ` [stack:1608]` should be the problem stack, and its size: 0xb548e000 - 0xb543f000 =0x4f000 = 316KB
If I understand right, the heap address is in `00bde000-01f94000`, which is far from the stack address b543f000, so how can stack-overflow happen?


pmap -d 1586
~~~~~~~~~........................Split Line........................~~~~~~~~~
1586: my_program
Address Kbytes Mode Offset Device Mapping
00010000 11872 r-x-- 0000000000000000 0b3:00001 my_program
00bb8000 152 rw--- 0000000000b98000 0b3:00001 my_program
00bde000 20184 rw--- 0000000000000000 000:00000 [ anon ]
b543f000 316 rw--- 0000000000000000 000:00000 [ anon ]
b548e000 4 ----- 0000000000000000 000:00000 [ anon ]
b548f000 84 rw--- 0000000000000000 000:00000 [ anon ]
b5c79000 4 ----- 0000000000000000 000:00000 [ anon ]
b5c7a000 84 rw--- 0000000000000000 000:00000 [ anon ]
b5d16000 372 rw--- 0000000000000000 000:00000 [ anon ]
b5d73000 4 ----- 0000000000000000 000:00000 [ anon ]
b5d74000 84 rw--- 0000000000000000 000:00000 [ anon ]
b5dac000 4 ----- 0000000000000000 000:00000 [ anon ]
b5dad000 84 rw--- 0000000000000000 000:00000 [ anon ]
b5dc2000 4 ----- 0000000000000000 000:00000 [ anon ]
b5dc3000 84 rw--- 0000000000000000 000:00000 [ anon ]
b5dd8000 4 ----- 0000000000000000 000:00000 [ anon ]
b5dd9000 84 rw--- 0000000000000000 000:00000 [ anon ]
b5dee000 4 ----- 0000000000000000 000:00000 [ anon ]
b5def000 84 rw--- 0000000000000000 000:00000 [ anon ]
b5e04000 4 ----- 0000000000000000 000:00000 [ anon ]
b5e05000 84 rw--- 0000000000000000 000:00000 [ anon ]
b5e1a000 4 ----- 0000000000000000 000:00000 [ anon ]
b5e1b000 84 rw--- 0000000000000000 000:00000 [ anon ]
b5e30000 4 ----- 0000000000000000 000:00000 [ anon ]
b5e31000 84 rw--- 0000000000000000 000:00000 [ anon ]
b5e46000 4 ----- 0000000000000000 000:00000 [ anon ]
b5e47000 84 rw--- 0000000000000000 000:00000 [ anon ]
b5e6d000 304 rw--- 0000000000000000 000:00000 [ anon ]
b5ef4000 372 rw--- 0000000000000000 000:00000 [ anon ]
b5f51000 4 ----- 0000000000000000 000:00000 [ anon ]
b5f52000 388 rw--- 0000000000000000 000:00000 [ anon ]
b5fc3000 240 rw--- 0000000000000000 000:00000 [ anon ]
b5fff000 4 ----- 0000000000000000 000:00000 [ anon ]
b6000000 84 rw--- 0000000000000000 000:00000 [ anon ]
b6015000 4 ----- 0000000000000000 000:00000 [ anon ]
b6016000 84 rw--- 0000000000000000 000:00000 [ anon ]
b602b000 456 rw-s- 0000000059190000 000:0000d video0
b609d000 456 rw-s- 0000000059110000 000:0000d video0
b610f000 456 rw-s- 0000000059090000 000:0000d video0
b6181000 456 rw-s- 0000000059010000 000:0000d video0
b61f3000 456 rw-s- 0000000058f90000 000:0000d video0
b6265000 456 rw-s- 0000000058f10000 000:0000d video0
b62d7000 456 rw-s- 0000000058e90000 000:0000d video0
b6349000 456 rw-s- 0000000058e10000 000:0000d video0
b63bb000 456 rw-s- 0000000058d90000 000:0000d video0
b642d000 456 rw-s- 0000000058d10000 000:0000d video0
b649f000 456 rw-s- 0000000058c90000 000:0000d video0
b6511000 456 rw-s- 0000000058c10000 000:0000d video0
b6583000 456 rw-s- 0000000058b90000 000:0000d video0
b65f5000 456 rw-s- 0000000058b10000 000:0000d video0
b6667000 456 rw-s- 0000000058a90000 000:0000d video0
b66d9000 456 rw-s- 0000000058a10000 000:0000d video0
b674b000 456 rw-s- 0000000058990000 000:0000d video0
b67bd000 456 rw-s- 0000000058910000 000:0000d video0
b682f000 456 rw-s- 0000000058890000 000:0000d video0
b68a1000 456 rw-s- 0000000058810000 000:0000d video0
b6913000 456 rw-s- 0000000058790000 000:0000d video0
b6985000 456 rw-s- 0000000058710000 000:0000d video0
b69f7000 456 rw-s- 0000000058690000 000:0000d video0
b6a69000 456 rw-s- 0000000058610000 000:0000d video0
b6adb000 456 rw-s- 0000000058590000 000:0000d video0
b6b4d000 456 rw-s- 0000000058510000 000:0000d video0
b6bbf000 456 rw-s- 0000000058490000 000:0000d video0
b6c31000 456 rw-s- 0000000058410000 000:0000d video0
b6ca3000 456 rw-s- 0000000058390000 000:0000d video0
b6d15000 456 rw-s- 0000000058310000 000:0000d video0
b6d87000 456 rw-s- 0000000058290000 000:0000d video0
b6df9000 456 rw-s- 0000000058210000 000:0000d video0
b6e6b000 100 r-x-- 0000000000000000 01f:00004 libgcc_s.so.1
b6e84000 4 rw--- 0000000000009000 01f:00004 libgcc_s.so.1
b6e85000 992 r-x-- 0000000000000000 01f:00004 libstdc++.so.6.0.21
b6f7d000 20 r---- 00000000000e8000 01f:00004 libstdc++.so.6.0.21
b6f82000 12 rw--- 00000000000ed000 01f:00004 libstdc++.so.6.0.21
b6f85000 8 rw--- 0000000000000000 000:00000 [ anon ]
b6f87000 408 r-x-- 0000000000000000 01f:00004 libc.so
b6ffb000 4 r--s- 0000000000000000 000:0000c TZ
b6ffc000 4 r---- 0000000000065000 01f:00004 libc.so
b6ffd000 4 rw--- 0000000000066000 01f:00004 libc.so
b6ffe000 8 rw--- 0000000000000000 000:00000 [ anon ]
befdf000 132 rw--- 0000000000000000 000:00000 [ stack ]
ffff0000 4 r-x-- 0000000000000000 000:00000 [ anon ]
mapped: 51640K writeable/private: 23588K shared: 14596K
~~~~~~~~~........................Split Line........................~~~~~~~~~


There is no esp/rsp register on my platform.
`info registers` only gives:
~~~~~~~~~........................Split Line........................~~~~~~~~~
r0 0xb54849003041413376
r1 0xb5fcc9103053242640
r2 0xb548e0103041452048
r3 0x7c124
r4 0x12684712
r5 0xb5fcc3503053241168
r6 0x7c124
r7 0x2840
r8 0xf8248
r9 0x7c01984
r10 0x7c01984
r11 0x3e0992
r12 0xb5fcc5383053241656
sp 0xb54840d80xb54840d8
lr 0xb5fccb10-1241724144
pc 0x24144c0x24144c <Eigen::internal::gemm_pack_rhs<double, int, 2, 0, false, false>::operator()(double*, double const*, int, int, int, int, int)+108>
cpsr 0x20000010536870928
~~~~~~~~~........................Split Line........................~~~~~~~~~


Could you give me some suggestion? how to determine the problem and how to solve it.
Thanks!


--

Best Regards!
--
extr15

At 2017-08-03 22:58:20, "extr15" <***@126.com> wrote:

Hi Christoph,
Thanks for your reply. I also think it could be stack-overflow, but I don't very familiar with gdb and didn't figure it out how to get the stack frame length at that time. I'll try to learn the usage of `frame` and rsp/esp.
The `ulimit -s` of my platform is 8192.
Thanks for the clue of `EIGEN_STACK_ALLOCATION_LIMIT `, I'll try it.
Thanks for all your help, and once I have some progress, I'll post it, but maybe take some days, just too busy recently...

--

Best Regards!
--
extr15
Hi,
just speculating, but it could be a stack-overflow problem.
`ulimit -s`. The default for most linuxes today is 8192KiB, if it is
smaller than that, this might be the reason.
Is your matrix multiplication called inside a function, which already is
relatively deep in your call-stack (with some functions having
relatively big objects on the stack -- you can walk through your
stack-trace and check the value of rsp/esp at each stage to find
possible culprits).
If that is indeed the reason, you can try to reduce the space Eigen is
allowed to allocate for temporaries on the stack, by defining
EIGEN_STACK_ALLOCATION_LIMIT before including Eigen. (The default is
131072 == 128 KiB; maybe try 8192 bytes, then increase it until you get
crashes again). This could significantly reduce the performance, since
all temporaries above that size will be allocated on the heap.
Cheers,
Christoph
Hi Gael, thanks for your reply, I will try to reproduce a example but it's difficult.
1. it seems crash for matrix size bigger than about 100*100.
2. my program is multi-threaded.
3. the eigen version is 3.2.4, eigen-eigen-10219c95fe65, maybe I should try the latest stable release.
4. I don't think I can try it with valgrind, because the system has only 512MB memory, even running a gdb is not that easy.
Thank you again.
--
Best Regards!
--
extr15
Hi,
1 - Does it crash for any problem size or for specific sizes only?
2 - Is your program multi-threaded?
3 - What is your exact version of Eigen? (lines are not matching the latest 3.3.4 stable release)
4 - You could try to run it within a memory debugger like valgrind.
Gael
Hello, it seems I can't log in "http://eigen.tuxfamily.org/bz/?GoAheadAndLogIn=1" as I am a new user, so I write this mail to ask for your help, thanks!
"
segment fault
"
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 1138]
this=<optimized out>, offset=0, stride=0)
at eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1236
1236eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h: No such file or directory.
cols=106, this=<optimized out>, offset=0, stride=0)
at eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1236
#1 0x00212664 in Eigen::internal::general_matrix_matrix_product<int, double, 0, false, double, 0, false, 0>::run (rows=3, cols=<optimized out>,
depth=<optimized out>, _lhs=<optimized out>, lhsStride=3, _rhs=0x1cda940,
rhsStride=106, res=0x1e39ac0, resStride=3, alpha=1, blocking=..., info=0x0)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:171
#2 0x0021cacc in Eigen::internal::gemm_functor<double, int, Eigen::internal::general_matrix_matrix_product<int, double, 0, false, double, 0, false, 0>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::internal::gemm_blocking_space<0, double, double, -1, -1, -1, 1, false> >::operator() (info=0x0,
cols=<optimized out>, col=0, rows=<optimized out>, row=0,
this=<optimized out>)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:221
#3 Eigen::internal::parallelize_gemm<true, Eigen::internal::gemm_functor<double, int, Eigen::internal::general_matrix_matrix_product<int, double, 0, false, dou---Type <return> to continue, or q <return> to quit---ble, 0, false, 0>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::internal::gemm_blocking_space<0, double, double, -1, -1, -1, 1, false> >, int> (
transpose=false, cols=<optimized out>, rows=<optimized out>, func=...)
at eigen3/Eigen/src/Core/products/Parallelizer.h:96
#4 Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>::scaleAndAddTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (alpha=<optimized out>, dst=..., this=0xb6e546a4)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:421
#5 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::scaleAndAddTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (alpha=<optimized out>, dst=...,
this=0xb6e546a4)
at eigen3/Eigen/src/Core/ProductBase.h:118
#6 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::evalTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (dst=..., this=0xb6e546a4)
at eigen3/---Type <return> to continue, or q <return> to quit---Eigen/src/Core/ProductBase.h:109
#7 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::operator Eigen::Matrix<double, -1, -1, 0, -1, -1> const& (this=0xb6e546a4)
at eigen3/Eigen/src/Core/ProductBase.h:127
#8 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const>, 5>, Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const> >::ProductBase (a_rhs=..., a_lhs=..., this=<optimized out>)
at eigen3/Eigen/src/Core/ProductBase.h:98
#9 Eigen::GeneralProduct<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const>, 5>::GeneralProduct (rhs=...,
lhs=..., this=<optimized out>)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:391
#10 Eigen::MatrixBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5> >::operator*<Eigen::Transpose---Type <return> to continue, or q <return> to quit---<Eigen::Matrix<double, -1, -1, 0, -1, -1> const> > (other=..., this=0xb6e546a4)
at eigen3/Eigen/src/Core/GeneralProduct.h:595
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
" MatrixXd cov2= H.transpose() * cov * H;"
when I comment out this line and the segment fault will gone.
also, if I use opencv's matrix multiplication here and no segment fault will happen, so I think it's a bug of eigen.
"
MatrixXd H(2*num, 3);
MatrixXd cov = MatrixXd::Zero(2*num, 2*num);
H = MatrixXd::Random(2*num, 3);
cov = MatrixXd::Random(2*num, 2*num);
cout<<"H"<<endl<<H<<endl;
cout<<"cov"<<endl<<cov<<endl;
MatrixXd cov2= H.transpose() * cov * H;
cout<<cov2<<endl;
"
I have tried to use gdb to debug, but no more info I can get.
Could you please have a look or tell me how to debug this problem? thanks!
uname -a
Linux 3.4.39 #375 SMP PREEMPT Mon Jul 17 09:07:31 UTC 2017 armv7l GNU/Linux
free
total used free shared buff/cache available
Mem: 524288 21000 270188 1372 233100 491107
Swap: 0 0 0
df -h
Filesystem Size Used Available Use% Mounted on
rootfs 5.0M 528.0K 4.5M 10% /
/dev/root 5.8M 5.8M 0 100% /rom
tmpfs 250.9M 1.3M 249.5M 1% /tmp
/dev/mtdblock5 5.0M 528.0K 4.5M 10% /overlay
overlayfs:/overlay 5.0M 528.0K 4.5M 10% /
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mmcblk0p1 7.4G 3.1G 4.3G 42% /mnt/SDCARD
/dev/by-name/UDISK 1.1M 196.0K 892.0K 18% /mnt/UDISK
/dev/by-name/boot 2.0M 1.7M 322.0K 84% /boot
/dev/by-name/boot-res
8.0M 39.0K 7.9M 0% /boot-res
Thanks again!
--
Best Regards!
--
extr15
--
Dipl. Inf., Dipl. Math. Christoph Hertzberg
UniversitÀt Bremen
FB 3 - Mathematik und Informatik
AG Robotik
Robert-Hooke-Straße 1
28359 Bremen, Germany
Zentrale: +49 421 178 45-6611
Robert-Hooke-Straße 5
28359 Bremen, Germany
Tel.: +49 421 178 45-4021
Empfang: +49 421 178 45-6600
Fax: +49 421 178 45-4150
Weitere Informationen: http://www.informatik.uni-bremen.de/robotik
extr15
2017-08-03 15:00:56 UTC
Permalink
Hi Dan,
Thanks for your tips! I may try it if other methods are not work, which I don't hope it happen :)


--

Best Regards!
--
extr15
Hi,
you could try ASAN (https://github.com/google/sanitizers, it is included
in mainline GCC & Clang) instead of valgrind, it might have a smaller
memory overhead. But 512 MB is not a lot, so you still might run into
trouble.
Cheers,
Dan
Hi Gael, thanks for your reply, I will try to reproduce a example but it's difficult.
1. it seems crash for matrix size bigger than about 100*100.
2. my program is multi-threaded.
3. the eigen version is 3.2.4, eigen-eigen-10219c95fe65, maybe I should try the latest stable release.
4. I don't think I can try it with valgrind, because the system has only 512MB memory, even running a gdb is not that easy.
Thank you again.
--
Best Regards!
--
extr15
Hi,
1 - Does it crash for any problem size or for specific sizes only?
2 - Is your program multi-threaded?
3 - What is your exact version of Eigen? (lines are not matching the latest 3.3.4 stable release)
4 - You could try to run it within a memory debugger like valgrind.
Gael
Hello, it seems I can't log in "http://eigen.tuxfamily.org/bz/?GoAheadAndLogIn=1" as I am a new user, so I write this mail to ask for your help, thanks!
"
segment fault
"
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 1138]
this=<optimized out>, offset=0, stride=0)
at eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1236
1236eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h: No such file or directory.
cols=106, this=<optimized out>, offset=0, stride=0)
at eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1236
#1 0x00212664 in Eigen::internal::general_matrix_matrix_product<int, double, 0, false, double, 0, false, 0>::run (rows=3, cols=<optimized out>,
depth=<optimized out>, _lhs=<optimized out>, lhsStride=3, _rhs=0x1cda940,
rhsStride=106, res=0x1e39ac0, resStride=3, alpha=1, blocking=..., info=0x0)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:171
#2 0x0021cacc in Eigen::internal::gemm_functor<double, int, Eigen::internal::general_matrix_matrix_product<int, double, 0, false, double, 0, false, 0>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::internal::gemm_blocking_space<0, double, double, -1, -1, -1, 1, false> >::operator() (info=0x0,
cols=<optimized out>, col=0, rows=<optimized out>, row=0,
this=<optimized out>)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:221
#3 Eigen::internal::parallelize_gemm<true, Eigen::internal::gemm_functor<double, int, Eigen::internal::general_matrix_matrix_product<int, double, 0, false, dou---Type <return> to continue, or q <return> to quit---ble, 0, false, 0>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::internal::gemm_blocking_space<0, double, double, -1, -1, -1, 1, false> >, int> (
transpose=false, cols=<optimized out>, rows=<optimized out>, func=...)
at eigen3/Eigen/src/Core/products/Parallelizer.h:96
#4 Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>::scaleAndAddTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (alpha=<optimized out>, dst=..., this=0xb6e546a4)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:421
#5 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::scaleAndAddTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (alpha=<optimized out>, dst=...,
this=0xb6e546a4)
at eigen3/Eigen/src/Core/ProductBase.h:118
#6 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::evalTo<Eigen::Matrix<double, -1, -1, 0, -1, -1> > (dst=..., this=0xb6e546a4)
at eigen3/---Type <return> to continue, or q <return> to quit---Eigen/src/Core/ProductBase.h:109
#7 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >::operator Eigen::Matrix<double, -1, -1, 0, -1, -1> const& (this=0xb6e546a4)
at eigen3/Eigen/src/Core/ProductBase.h:127
#8 Eigen::ProductBase<Eigen::GeneralProduct<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const>, 5>, Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const> >::ProductBase (a_rhs=..., a_lhs=..., this=<optimized out>)
at eigen3/Eigen/src/Core/ProductBase.h:98
#9 Eigen::GeneralProduct<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5>, Eigen::Transpose<Eigen::Matrix<double, -1, -1, 0, -1, -1> const>, 5>::GeneralProduct (rhs=...,
lhs=..., this=<optimized out>)
at eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h:391
#10 Eigen::MatrixBase<Eigen::GeneralProduct<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, 5> >::operator*<Eigen::Transpose---Type <return> to continue, or q <return> to quit---<Eigen::Matrix<double, -1, -1, 0, -1, -1> const> > (other=..., this=0xb6e546a4)
at eigen3/Eigen/src/Core/GeneralProduct.h:595
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
" MatrixXd cov2= H.transpose() * cov * H; "
when I comment out this line and the segment fault will gone.
also, if I use opencv's matrix multiplication here and no segment fault will happen, so I think it's a bug of eigen.
"
MatrixXd H(2*num, 3);
MatrixXd cov = MatrixXd::Zero(2*num, 2*num);
H = MatrixXd::Random(2*num, 3);
cov = MatrixXd::Random(2*num, 2*num);
cout<<"H"<<endl<<H<<endl;
cout<<"cov"<<endl<<cov<<endl;
MatrixXd cov2= H.transpose() * cov * H;
cout<<cov2<<endl;
"
I have tried to use gdb to debug, but no more info I can get.
Could you please have a look or tell me how to debug this problem? thanks!
uname -a
Linux 3.4.39 #375 SMP PREEMPT Mon Jul 17 09:07:31 UTC 2017 armv7l GNU/Linux
free
total used free shared buff/cache available
Mem: 524288 21000 270188 1372 233100 491107
Swap: 0 0 0
df -h
Filesystem Size Used Available Use% Mounted on
rootfs 5.0M 528.0K 4.5M 10% /
/dev/root 5.8M 5.8M 0 100% /rom
tmpfs 250.9M 1.3M 249.5M 1% /tmp
/dev/mtdblock5 5.0M 528.0K 4.5M 10% /overlay
overlayfs:/overlay 5.0M 528.0K 4.5M 10% /
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mmcblk0p1 7.4G 3.1G 4.3G 42% /mnt/SDCARD
/dev/by-name/UDISK 1.1M 196.0K 892.0K 18% /mnt/UDISK
/dev/by-name/boot 2.0M 1.7M 322.0K 84% /boot
/dev/by-name/boot-res
8.0M 39.0K 7.9M 0% /boot-res
Thanks again!
--
Best Regards!
--
extr15
Loading...