Re: [eigen] Getting started / Compiling and running your first program

[ Thread Index | Date Index | More Archives ]

I agree on that we could/should mention that for good performance Eigen-code should be compiled with something like `-O2 -DNDEBUG -march=native` (`-mtune` is implied by `-march`). Or link to this:

I would however strongly discourage compiling with `-DNDEBUG` until you tested your code for correctness, since this prevents several trivial beginner mistakes (or rather exposes them). We actually also have quite a few questions/"bug reports" about unexpected behavior which was in fact caused by some wrong usage.


On 31/01/2019 18.30, Thomas Klimpel wrote:

in section
Compiling and running your first program

g++ -I /path/to/eigen/ my_program.cpp -o my_program

How about also suggesting an example with typical release compile
flags? Something like:

g++ -I /path/to/eigen/ my_program.cpp -o my_program -O2 -DNDEBUG
-march=native -mtune=native

Not sure whether it would really save any beginner from unknowingly
benchmarking different linear algebra libraries in debug mode, but at
least we can try. (I just read such a benchmarking report, with Eigen
and PETSc as the libraries... As you can imagine, the C library had
some speed advantages over the C++ template library under those


 Dr.-Ing. Christoph Hertzberg

 Besuchsadresse der Nebengeschäftsstelle:
 Robotics Innovation Center
 Robert-Hooke-Straße 5
 28359 Bremen, Germany

 Postadresse der Hauptgeschäftsstelle Standort Bremen:
 Robotics Innovation Center
 Robert-Hooke-Straße 1
 28359 Bremen, Germany

 Tel.:     +49 421 178 45-4021
 Zentrale: +49 421 178 45-0
 E-Mail:   christoph.hertzberg@xxxxxxx

 Weitere Informationen:
 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
 Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
 Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
 (Vorsitzender) Dr. Walter Olthoff
 Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
 Amtsgericht Kaiserslautern, HRB 2313
 Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
 USt-Id.Nr.:    DE 148646973
 Steuernummer:  19/672/50006

Mail converted by MHonArc 2.6.19+