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

Segmentation Fault #2

Open
FlorianMaile opened this issue Mar 22, 2018 · 9 comments
Open

Segmentation Fault #2

FlorianMaile opened this issue Mar 22, 2018 · 9 comments
Assignees

Comments

@FlorianMaile
Copy link

When I try to run the examples provided with this repo I always run into Segmentation faults in Ubuntu 16.04. Furthermore I would be interested to use this code in Windows, some parts of the code only work for Unis systems. Is there a Windows version also available ?

Thank you in advance!

@finostro
Copy link
Collaborator

Hi Florian,

We currently don't have plans to add support for windows.
I just redownloaded the repo and compiled it in Ubuntu 16.04.3 LTS 64-bit.
I am not getting any segmentation Faults. Some of the examples are made to be run from the source folder, although the error I get when running from somewhere else is not a SegFault.
Could you post which executable you are getting the error in?

Cheers

@finostro finostro self-assigned this Mar 22, 2018
@FlorianMaile
Copy link
Author

Hi,

I got following error when I try to run the code:

~/Documents/RFS_SLAM$ build/bin/rbphdslam2dSim
Configuration file: cfg/rbphdslam2dSim.xml
Trajectory: 2053816324
Segmentation fault (core dumped)

@finostro
Copy link
Collaborator

I am not able to reproduce the error.
Can I get you to run the program using gdb so we can get more info on the crash?
To do that you would need to:
recompile in Debug mode:
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
Then, from the source folder:
gdb build/bin/rbphdslam2dSim

Once in gdb:
run
Then after the Segfault happens:
backtrace

And post the output.
That would be a big help to find the error.

Thanks!

@FlorianMaile
Copy link
Author

FlorianMaile commented Mar 26, 2018

the output is the following:

~/Documents/RFS_SLAM$ gdb build/bin/rbphdslam2dSim
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from build/bin/rbphdslam2dSim...done.
(gdb) run
Starting program: /home/zf/Documents/RFS_SLAM/build/bin/rbphdslam2dSim 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Configuration file: cfg/rbphdslam2dSim.xml
Trajectory: 1299280619

Program received signal SIGSEGV, Segmentation fault.
0x000000000067a399 in _mm256_load_pd (__P=0xa1dad0)
	at /usr/lib/gcc/x86_64-linux-gnu/5/include/avxintrin.h:836
836	  return *(__m256d *)__P;

Thank you in advance!

@finostro
Copy link
Collaborator

I tried a few different computers, still cannot reproduce it.

I think you forgot to do a backtrace in gdb, can you run
backtrace
After the segmentation fault and send the output.
Also if you just want to run the code you may be able to get rid of the error by commenting out the following line from the CMakeLists.txt file:
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native ")
to look like
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native ")

Thanks

@FlorianMaile
Copy link
Author

Sorry! I definitely forgot the backtrace:

(gdb) backtrace
#0  0x000000000067a399 in _mm256_load_pd (__P=0xa1dad0)
	at /usr/lib/gcc/x86_64-linux-gnu/5/include/avxintrin.h:836
#1  Eigen::internal::pload<double __vector(4)>(Eigen::internal::unpacket_traits<double __vector(4)>::type const*) (from=0xa1dad0)
	at /usr/include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h:207
#2  0x00000000006f2d6a in Eigen::internal::ploadt<double __vector(4), 32>(Eigen::internal::unpacket_traits<double __vector(4)>::type const*) (from=0xa1dad0)
	at /usr/include/eigen3/Eigen/src/Core/GenericPacketMath.h:475
#3  Eigen::internal::evaluator<Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> > >::packet<32, double __vector(4)>(long, long) const (
	this=0x7fffffffc8e0, row=0, col=0)
	at /usr/include/eigen3/Eigen/src/Core/CoreEvaluators.h:183
#4  0x00000000006ee39e in Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Matrix<double, 2, 2, 0, 2, 2> >, Eigen::internal::evaluator<Eigen::Matrix<double, 2, 2, 0, 2, 2> >, Eigen::internal::assign_op<double>, 0>::assignPacket<16, 32, double __vector(4)>(long, long) (
	this=0x7fffffffc8f0, row=0, col=0)
	at /usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:592
#5  0x00000000006ea4a1 in Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Matrix<double, 2, 2, 0, 2, 2> >, Eigen::internal::evaluator<Eigen::Matrix<double, 2, 2, 0, 2, 2> >, Eigen::internal::assign_op<double>, 0>::assignPacketByOuterInner<16, 32, double __vector(4)>(long, long) (
	this=0x7fffffffc8f0, outer=0, inner=0)
---Type <return> to continue, or q <return> to quit---
	at /usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:606
#6  0x00000000006e4cfc in Eigen::internal::copy_using_evaluator_innervec_CompleteUnrolling<Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Matrix<double, 2, 2, 0, 2, 2> >, Eigen::internal::evaluator<Eigen::Matrix<double, 2, 2, 0, 2, 2> >, Eigen::internal::assign_op<double>, 0>, 0, 4>::run (kernel=...) at /usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:244
#7  0x00000000006dfed4 in Eigen::internal::dense_assignment_loop<Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Matrix<double, 2, 2, 0, 2, 2> >, Eigen::internal::evaluator<Eigen::Matrix<double, 2, 2, 0, 2, 2> >, Eigen::internal::assign_op<double>, 0>, 3, 2>::run (kernel=...)
	at /usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:403
#8  0x00000000006cfd93 in Eigen::internal::call_dense_assignment_loop<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::internal::assign_op<double> > (dst=..., src=..., func=...)
	at /usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:653
#9  0x00000000006c6051 in Eigen::internal::Assignment<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::internal::assign_op<double>, Eigen::internal::Dense2Dense, double>::run (dst=..., src=..., func=...)
	at /usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:790
#10 0x00000000006baed5 in Eigen::internal::call_assignment_no_alias<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::internal::assign_op<double> > (dst=..., src=..., func=...)
	at /usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:747
---Type <return> to continue, or q <return> to quit---
#11 0x00000000006af5d9 in Eigen::internal::call_assignment<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::internal::assign_op<double> >(Eigen::Matrix<double, 2, 2, 0, 2, 2>&, Eigen::Matrix<double, 2, 2, 0, 2, 2> const&, Eigen::internal::assign_op<double> const&, Eigen::internal::enable_if<!Eigen::internal::evaluator_assume_aliasing<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::internal::evaluator_traits<Eigen::Matrix<double, 2, 2, 0, 2, 2> >::Shape>::value, void*>::type) (dst=..., src=..., func=...)
	at /usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:712
#12 0x00000000006a234d in Eigen::internal::call_assignment<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2> > (dst=..., src=...)
	at /usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:693
#13 0x00000000006951f3 in Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >::_set<Eigen::Matrix<double, 2, 2, 0, 2, 2> > (this=0x7fffffffcb20, 
	other=...) at /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:682
#14 0x0000000000689da3 in Eigen::Matrix<double, 2, 2, 0, 2, 2>::operator= (
	this=0x7fffffffcb20, other=...)
	at /usr/include/eigen3/Eigen/src/Core/Matrix.h:208
#15 0x000000000068a08a in rfs::RandomVec<2u>::operator= (this=0x7fffffffcb00, 
	rhs=...) at /home/zf/Documents/RFS_SLAM/include/RandomVec.hpp:185
#16 0x0000000000683ff1 in rfs::Landmark<2u, 2u, int>::operator= (
	this=0x7fffffffcb00) at /home/zf/Documents/RFS_SLAM/include/Landmark.hpp:56
#17 0x0000000000684139 in rfs::MeasurementModel<rfs::Pose<3u, 2u, 1u>, rfs::Landmark<2u, 2u, int>, rfs::RandomVec<2u> >::sample (this=0x7fffffffce20, 
---Type <return> to continue, or q <return> to quit---
	pose=..., landmark=..., measurement=..., 
	useAdditiveWhiteGaussianNoise=true, usePoseWhiteGaussianNoise=false, 
	useLandmarkWhiteGaussianNoise=false)
	at /home/zf/Documents/RFS_SLAM/include/MeasurementModel.hpp:147
#18 0x000000000067dbd7 in Simulator_RBPHDSLAM_2d::generateMeasurements (
	this=0x7fffffffd8e0)
	at /home/zf/Documents/RFS_SLAM/src/rbphdslam2dSim.cpp:328
#19 0x0000000000676d55 in main (argc=1, argv=0x7fffffffdc98)
	at /home/zf/Documents/RFS_SLAM/src/rbphdslam2dSim.cpp:856
(gdb) 

Got the code running after your suggestion thanks. What exactly is the effect of this compiler flag ?

Thank you!

@finostro
Copy link
Collaborator

Thanks!
The march=native tells the compiler to enable all possible optimizations for the current processor architecture, like vectorization.

@FlorianMaile
Copy link
Author

FlorianMaile commented May 8, 2018

Hi Finostro,
i got the mentioned error above on a virtual machine. I was curious if I receive also the same error on a native Ubuntu system with Ubuntu 16.04 and I still run into the same segmentation fault. Seems like the value assignment in RandomVec causes the problem.

@SubMishMar
Copy link

SubMishMar commented Mar 26, 2021

I tried a few different computers, still cannot reproduce it.

I think you forgot to do a backtrace in gdb, can you run
backtrace
After the segmentation fault and send the output.
Also if you just want to run the code you may be able to get rid of the error by commenting out the following line from the CMakeLists.txt file:
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native ")
to look like
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native ")

Thanks

Funny thing is, doing the reverse worked for me. Not in this package, but in a GTSAM related package :)

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

3 participants