Is it possible to view the data stored in the various PETSc data types from within totalview?

Ordinarily, PETSc types are integers which act as pointers to the actual data (obviously my understanding of this is quite weak). So when debugging and troubleshooting, my workflow looks like 1) Edit the source to save the PETSc data to a file 2) recompile 3) run and inspect output.

This is quite slow.

It would be quite nice to view this data directly from a GUI parallel debugger like totalview.

I am using fortran 90, by the way.


PETSc even recommends TotalView as a parallel debugger, so you should be fine using it. However, you must ensure you are using a version of the library with debug symbols in it:

Most code development for PETSc codes should be done on one processor; hence, using a standard debugger such as dbx, gdb, xdbx, etc. is fine. For debugging parallel runs we suggest Totalview if it is available on your machine. Otherwise, you can run each process in a separate debugger; this is not the same as using a parallel debugger, but in most cases it is not so bad. The PETSc run-time options -start_in_debugger [-display xdisplay:0] will open separate windows and debuggers for each process. You should debug using the debugging versions of the libraries (run ./configure with the additional option --with-debugging (the default)).

Even though TotalView is a very nice parallel debugger, more common serial debuggers might serve you better. Especially since the debugging is commonly done on relatively small examples. So, I would use gdb for most of my debugging, unless I am interested in the debugging of parallel features (say some MPI communications I coded up myself).

  • $\begingroup$ In retrospect, my question was not clear enough. Suppose I create a petsc vec called V and store some values in it. Totalview will show a variable called V, and show that it has memory allocated, but will invariably show it as an integer data type. $\endgroup$ – Mr.Weathers May 20 '19 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.