Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seg fault when compiling with certain compiler options #178

Open
mirams opened this issue Feb 7, 2018 · 1 comment
Open

Seg fault when compiling with certain compiler options #178

mirams opened this issue Feb 7, 2018 · 1 comment

Comments

@mirams
Copy link

mirams commented Feb 7, 2018

I came across a seg fault when compiling the bounded example with certain optimisation flags (g++ 5.4.0).

g++ -fopenmp -std=gnu++11 -I/usr/include/eigen3/ -I/export/libcmaes/include/libcmaes 
-L/export/libcmaes/lib -o sample-code-bounds sample-code-bounds.cc -lcmaes -Wall -Werror

works fine, and runs to give the right output.

But

g++ -fopenmp -std=gnu++11 -I/usr/include/eigen3/ -I/export/libcmaes/include/libcmaes 
-L/export/libcmaes/lib -o sample-code-bounds sample-code-bounds.cc -lcmaes -Wall -Werror
-mavx

causes a seg fault. The backtrace suggests a bug either in Eigen or libcmaes's use of it?

Program received signal SIGSEGV, Segmentation fault.
0x000000000041309d in double __vector Eigen::internal::pload<double __vector>(Eigen::internal::unpacket_traits<double __vector>::type const*) ()
(gdb) bt
#0  0x000000000041309d in double __vector Eigen::internal::pload<double __vector>(Eigen::internal::unpacket_traits<double __vector>::type const*) ()
#1  0x0000000000429a07 in double __vector Eigen::internal::evaluator<Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >::packet<32, double __vector>(long) const ()
#2  0x0000000000427e90 in void Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Matrix<double, -1, 1, 0, -1, 1> >, Eigen::internal::evaluator<Eigen::Matrix<double, -1, 1, 0, -1, 1> >, Eigen::internal::assign_op<double>, 0>::assignPacket<32, 32, double __vector>(long) ()
#3  0x0000000000424c90 in Eigen::internal::dense_assignment_loop<Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Matrix<double, -1, 1, 0, -1, 1> >, Eigen::internal::evaluator<Eigen::Matrix<double, -1, 1, 0, -1, 1> >, Eigen::internal::assign_op<double>, 0>, 3, 0>::run(Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Matrix<double, -1, 1, 0, -1, 1> >, Eigen::internal::evaluator<Eigen::Matrix<double, -1, 1, 0, -1, 1> >, Eigen::internal::assign_op<double>, 0>&) ()
#4  0x000000000041fbfa in void Eigen::internal::call_dense_assignment_loop<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::internal::assign_op<double> >(Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, Eigen::internal::assign_op<double> const&) ()
#5  0x000000000041ae07 in Eigen::internal::Assignment<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::internal::assign_op<double>, Eigen::internal::Dense2Dense, double>::run(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, Eigen::internal::assign_op<double> const&) ()
#6  0x000000000041893f in void Eigen::internal::call_assignment_no_alias<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::internal::assign_op<double> >(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, Eigen::internal::assign_op<double> const&) ()
#7  0x000000000041ab97 in void Eigen::internal::call_assignment<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::internal::assign_op<double> >(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, Eigen::internal::assign_op<double> const&, Eigen::internal::enable_if<!Eigen::internal::evaluator_assume_aliasing<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::internal::evaluator_traits<Eigen::Matrix<double, -1, 1, 0, -1, 1> >::Shape>::value, void*>::type) ()
#8  0x00000000004187b8 in void Eigen::internal::call_assignment<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::Matrix<double, -1, 1, 0, -1, 1> const&) ()
#9  0x0000000000416ca7 in Eigen::Matrix<double, -1, 1, 0, -1, 1>& Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >::_set<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::DenseBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&) ()
#10 0x000000000041405d in Eigen::Matrix<double, -1, 1, 0, -1, 1>::operator=(Eigen::Matrix<double, -1, 1, 0, -1, 1> const&) ()
#11 0x00000000004131fd in libcmaes::pwqBoundStrategy::operator=(libcmaes::pwqBoundStrategy const&) ()
#12 0x000000000041466b in libcmaes::GenoPheno<libcmaes::pwqBoundStrategy, libcmaes::NoScalingStrategy>::GenoPheno(double const*, double const*, int const&) ()
#13 0x0000000000412630 in main ()
@beniz
Copy link
Collaborator

beniz commented Feb 7, 2018

Hi I'm not familiar enough with GCC low level optimizations to give you a useful hint here. Maybe try with clang and/or more recent GCC if only for ruling this out. See #174 as there seems to be issues with some versions of eigen and GCC. Finally, see whether this occurs with all of the libcmaes sample programs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants