Welcome to the KDE Community Forums, the official forum board for KDE.
You are currently viewing the forums as an unregistered user. Registration allows you to post and discuss topics, receive private messages, vote on ideas, subscribe to topics and many such great features. Registration is a simple process and completely free. So register now and be a part of the community!
You are currently viewing the forums as an unregistered user. Registration allows you to post and discuss topics, receive private messages, vote on ideas, subscribe to topics and many such great features. Registration is a simple process and completely free. So register now and be a part of the community!
Segfault in Cholesky factorization
18 posts • Page 2 of 2
• 1, 2
Re: Segfault in Cholesky factorization
ok, the problem is that on a 32 bits linux system, objects lying on the stack are only aligned on a 4 bytes boundary while I assumed doubles were are least aligned on a 8 bytes boundary. Performance wise it is always a good idea to align doubles on 8 bytes, so the solutions are:
- on the user side: use this gcc's flag: -malign-double
- on the Eigen side: enforce the alignment of objects of doubles (or complex of double) on 8 bytes.
- on the user side: use this gcc's flag: -malign-double
- on the Eigen side: enforce the alignment of objects of doubles (or complex of double) on 8 bytes.
ggael, proud to be a member of KDE forums since 2008-Dec.
Re: Segfault in Cholesky factorization
Performance wise it is always a good idea to align doubles on 8 bytes, so the solutions are:
- on the user side: use this gcc's flag: -malign-double
- on the Eigen side: enforce the alignment of objects of doubles (or complex of double) on 8 bytes.
I'm OK to enforce 8byte alignment of doubles, since this doesn't lead to additional memory consumption. We just need to document that well, e.g. for Map...
Then we are going to run into one of the issues with the UnalignedArrayAssert, namely: when passing-by-value. But precisely that's OK because that only matters when vectorization is on, and then that's already covered by the UnalignedArrayAssert.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
Have a serious interest in Eigen? Then join the mailing list!
Re: Segfault in Cholesky factorization
ok, the changes are done.
TaMo: seems to be fixed now.
Gael: i align based only on total size, so e.g. Vector2f gets aligned. Do you prefer to only align to 8byte if sizeof(T) itself is multiple of 8? No big important reason for my choice, it was just easier to document.
TaMo: seems to be fixed now.
Gael: i align based only on total size, so e.g. Vector2f gets aligned. Do you prefer to only align to 8byte if sizeof(T) itself is multiple of 8? No big important reason for my choice, it was just easier to document.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
Have a serious interest in Eigen? Then join the mailing list!
Re: Segfault in Cholesky factorization
Could this be the same bug affecting my inability to create an std::vector or std::valarray of SparseMatrix's? When I try, I get a bus error. I can create a raw array of SparseMatrix's just fine and a vector/valarray of DynamicSparseMatrix's just fine, too. Here is code to reproduce the problem (eigen 2.0.6):
and then one of
or
or
The code with the new[] works fine, while the others crash. If I change solve_matrix_t to assembly_matrix_t it doesn't crash.
This is on Mac OS X, in case the problem is platform specific.
Thanks for making such a great library, by the way! I wouldn't have found this if I wasn't using Eigen so heavily.
Yotam
- Code: Select all
// g++ -Iext/eigen2 foo.c
#include "Eigen/Eigen"
typedef double real_t;
typedef Eigen::DynamicSparseMatrix< real_t, Eigen::RowMajor > assembly_matrix_t;
typedef Eigen::SparseMatrix< real_t, Eigen::RowMajor > solve_matrix_t;
and then one of
- Code: Select all
#include <vector>
int main( int argc, char* argv[] )
{
std::vector< solve_matrix_t > foo;
foo.resize( 100 );
return 0;
}
or
- Code: Select all
#include <valarray>
int main( int argc, char* argv[] )
{
std::valarray< solve_matrix_t > foo;
foo.resize( 100 );
return 0;
}
or
- Code: Select all
int main( int argc, char* argv[] )
{
solve_matrix_t* foo = new solve_matrix_t[ 100 ];
delete [] foo;
return 0;
}
The code with the new[] works fine, while the others crash. If I change solve_matrix_t to assembly_matrix_t it doesn't crash.
This is on Mac OS X, in case the problem is platform specific.
Thanks for making such a great library, by the way! I wouldn't have found this if I wasn't using Eigen so heavily.

Yotam
Re: Segfault in Cholesky factorization
No, this doesn't seem to be the same error. The error discussed in this thread was a very special issue about a specific function assuming double's to be 8 byte aligned.
Can you please open an issue on the tracker, and post a full back-trace of your crash (compile with -g3) ?
Can you please open an issue on the tracker, and post a full back-trace of your crash (compile with -g3) ?
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
Have a serious interest in Eigen? Then join the mailing list!
Re: Segfault in Cholesky factorization
bjacob wrote:No, this doesn't seem to be the same error. The error discussed in this thread was a very special issue about a specific function assuming double's to be 8 byte aligned.
Can you please open an issue on the tracker, and post a full back-trace of your crash (compile with -g3) ?
Done: http://bitbucket.org/eigen/eigen2/issue ... alarray-of
Thanks,
Yotam
Re: Segfault in Cholesky factorization
Thanks! Now we can't forget about it.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
Have a serious interest in Eigen? Then join the mailing list!
Re: Segfault in Cholesky factorization
here is my answer:
"This bug is not present in the devel branch, and since the sparse module was marked as experimental in the 2.0.x branch I won't try to backport the fix. Well actually I tried to backport a few fixes, but there have been too many changes now and this would take me hours to fix it. So please, use the devel branch."
"This bug is not present in the devel branch, and since the sparse module was marked as experimental in the 2.0.x branch I won't try to backport the fix. Well actually I tried to backport a few fixes, but there have been too many changes now and this would take me hours to fix it. So please, use the devel branch."
ggael, proud to be a member of KDE forums since 2008-Dec.
18 posts • Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 2 guests

Search
FAQ
Policy
KDE.org
KDE.news
Planet KDE
More 