Learn to Use ITensor

main / formulas / debug_mode

Running Your Program in Debug Mode

Compiling a code based on ITensor which is in "debug" mode is easy if you use the Makefile provided in the itensor/tutorial/project_template/ folder.

One you set up this Makefile correctly, by editing the fields at the top then you can compile your program in optimized mode by just typing make and in debug mode by typing make debug.

The command make debug creates an executable whose name is the usual name of your program (what you set the APP variable to in the Makefile) but with an extra -g appended at the end. So if APP=myappname then doing make debug will produce an executable called myappname-g.

A program compiled in debug mode differs from an optimized program in a few key ways:

When you suspect your program contains a bug, often it is helpful to run your program in debug mode to see if ITensor reports a more helpful error message. Some checking is disabled in fully optimized ITensor programs for maximum speed.

If ITensor still doesn't report a helpful enough error message, you can run your debug-mode program in a C++ debugger to get a more fine-grained report of what state your program was in when it crashed.


Back to Formulas
Back to Main