3 ms·
Print statements, haha. My code is for linear algebra stuff, so it is pretty much a straight shot through/filling in some RCI loop most of the time, I usually
by bee_rider 5y ago
Print statements, haha.
My code is for linear algebra stuff, so it is pretty much a straight shot through/filling in some RCI loop most of the time, I usually just have to find which OpenMP or MPI barrier is misbehaving.
- mark_undoio 5y agoPrint statements are really really good for debugging because they give you a timeline of "things that happened that I was interested in". It's like using Google Maps to see the general shape of a landscape. A debugger is generally more like Google Streetview - you get strictly more detail and it makes some problems way easier to solve. It's just not always the easiest way to get an overview. With that in mind, though, GDB's "Dynamic Printf" is pretty cool: https://sourceware.org/gdb/onlinedocs/gdb/Dynamic-Printf.html https://sourceware.org/gdb/onlinedocs/gdb/Dynamic-Printf.htm... You basically configure GDB to add printfs to the program you're debugging, without having to rebuild it. You just run under GDB and the prints will run. As a bonus, you can also interact using normal debugging commands too.
- bally0241 5y agoNever underestimate the power of print statements for debugging, that being said, the gdb-based "poor man's profiler" has also been a life saver.