-
Notifications
You must be signed in to change notification settings - Fork 79
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 (core dumped) #183
Comments
Let me see if I understand this correctly: when you are compiling the binary file with libcmaes makefiles, it works fine and they run fine. Whenever you are using your own compilation command line your program is crashing, is this correct ? |
Yes, this is exactly my issue. |
Try adding
My guess is that since we compile the lib with FMA (https://en.wikipedia.org/wiki/FMA_instruction_set) as default, you need to compile with the same flags. Note that the flags used for building libcmaes can be retrieved from the build output. It'd be better if we could pass these flags automatically via pkg-config for instance. Not sure how to do this. Please let me know whether this solves your issue. |
No. After adding -mfma, I still encountered the same issue. |
Try the other flags then, by looking at the building trace. |
Same issue here. Not sure how to solve this. |
Hi, this was due to optimization flags used to build the library by default. Share your full build trace maybe. |
Here is what I tried: g++ -DHAVE_CONFIG_H -I/home/tsun/bin/libcmaes-master/install/include/libcmaes I copied several flags from the ones used when compiling the libcmaes.so. But still when I run the compiled "testOptim", I got the following: cmaes... INFO - CMA-ES / dim=10 / lambda=10 / sigma0=0.1 / mu=5 / mueff=3.41477 / c1=0.015255 / cmu=0.0231675 / tpa=0 / threads=80 And Valgrind seems failed to receive a valid instruction so I cannot tell what happened exactly. Tao |
Hi, try removing the mfma and mavx flags. |
That did not help. This time I got more information when building an example by myself. Not sure if this was the actual reason that caused my previous trouble. INFO - stopping criteria tolHistFun => frange=9.07430966327435e-13 More similar to this closed issue now (#190), except removing -mfma does not help. |
Could you share your full build log of |
Hi again, I think now everything works fine. The problem was due to that I built the Eigen3 without -std=c++11 support. Not sure why only using download header files not working. Thank you for your response. |
How did you build Eigen3? Eigen3 is a pure template library. I am facing segmentation faults and I'm trying to understand what your solution to the problem was. Thank you in advance! EDIT: Was compiling against Eigen 3.3.7 in system. Compiled against 3.3.90 cloned from repo. Debug mode was now working. Release was still causing a segmentation fault. I have OpenMP code in my program, not sure if that's causing the necessary inclusion of -favx. Adding the flag made no difference to executable size, hence it was included from the start. Valgrind's output when compiling with -fopenmp -g -mavx:
Memory alignment issue. Had to re-compile libcmaes in Release mode with -favx and it finally worked! |
I have successfully compiled the libcmaes and passed all the tests by typing './test_functions -all'. However, when I compiled the sample-code.cc in the examples fold by following command:
g++ -fopenmp -std=gnu++11 -I /usr/local/include/eigen3 -I /home/boyuan/include/libcmaes -L/home/boyuan/lib -o sample_code sample-code.cc -lcmaes
and run the sample_code by ./sample_code. I received 'segmentation fault(core dump)'.
By using gdb, the detailed information is:
Reading symbols from ./sample_code...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/boyuan/libcmaes/examples/sample_code
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
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::CwiseNullaryOp<Eigen::internal::scalar_constant_op, Eigen::Matrix<double, -1, 1, 0, -1, 1> > >, Eigen::internal::assign_op<double, double>, 0>, 3, 0>::run (
kernel=) at /usr/local/include/eigen3/Eigen/src/Core/AssignEvaluator.h:416
416 kernel.template assignPacket<dstAlignment, srcAlignment, PacketType>(index);
(gdb) Quit
I wonder what causes this issue. Thanks.
The text was updated successfully, but these errors were encountered: