Advanced visualisation of Fortran variables while debugging

One thing missing (AFAIK) from the commonly used Fortran editors is visualisation of numerical data structures like arrays, matrices, trees, etc. whilst debugging.

In VS Code in particular, one extension has caught my eye, Debug Visualizer - Visual Studio Marketplace, I have had a play with it and I have been able to get it working for Fortran + GDB but at the moment I have to manually wrap my arrays into json formatted plottly snippets cast as strings, see Visualization Playground.

I also know that GDB has the ability to use Python scripts for pretty printing, I believe @zedthree wrote one for polymorphic types a while back. My general train of thought, is to use Python scripts at the VS Code extension level or at the GDB level to visualise arrays.

I am still in the brainstorming phase and I have yet to take a deep dive at Debug Visualizerā€™s code but I was wondering if:

  1. that is something people are interested
  2. there are tools already doing this (I think CLion might have one just for matrices)
  3. you have any ideas or comments on how to implement this
6 Likes

https://www.gnu.org/software/ddd/

Havenā€™t used it in years and not sure how it holds up, but DDD used to be THE tool for visualizing data while debugging. You might find some inspiration there.

In any case, this capability would be super helpful for my day to day work.

Iā€™m not in a place I can try right now, but I wonder if Gdbplotlib works with Fortran out of the box

@gnikit, really no need to ask if ā€œis something people are interestedā€!!

ā€œAdvanced visualizationā€ aka graphical debugging is a must anyone coding ā€œin angerā€ with modern Fortran will realize sooner or later.

You can assuredly enter the field of dreams and confidently be mindful of that inner voice telling you ā€œbuild it and they will comeā€!!

ddd is still available in modern Linux versions (RHEL/RockyLinux 8.5, Ubuntu 20.04) and in Homebrew for MacOS but its last released version (3.3.12) is ā€¦ 13 years old.

This would be so useful! I often resort to print based debugging in Fortran especially when debugging code that is part of a numerical iteration loop. Failing procedures will then often be called many times before the actual failure occurs. Having the opportunity to plot arbitrary variables across multiple calls would be a really useful tool in such cases.

Absoft (a company specialized in Fortran compilers) offers their own Fx3 Source Level Debugger which comes with graphical variable display. According to their website it can be used also with compilers from other vendors.

Thanks, I will have a look at gdbplotlib, as for ddd I havenā€™t used it in years but I recall serious limitations from the limited time I spent using it.

Thanks for the link, Fx3 seems to have some of the functionality I want to implement. The major problem I see with it (and a lot of other Fortran solutions) is that they require paid licenses.

My personal opinion is that hiding basic tooling like intuitive visualisation of data or Language Server-like functionality, behind paywalls is actively contributing to the decline in popularity of Fortran.

It sure made my life a lot harder when I started coding in Fortran back in 2017 and there were little to no supporting tools to get a novice up and running.

I will have a play with the VS Code extension and see if we can interface with it or highjack its API and pass Fortran data structures without having to compile our own Fortran codes to convert things into plottly requests

2 Likes

Attention @mkonecny , @greenrongreen : with respect to the thread at the Intel Fortran forum and with Intel Support opening a feature request (FR), you may be interested in engaging with @gnikit toward any collaboration opportunities.

It appears for the sake of Fortran this is crucially a matter of avoiding situations that can only otherwise be seen as ā€œfailure of imaginationā€.

If one can imagine up a debugger adapter of some kind that Intel can offer along with oneAPI, the open-source Community led by @gnikit et al. can really run with it and do a lot of heavy-lifting that then frees up Intel monumentally in this aspect.

This will be a major improvement compared to the situation with Intel Fortran debugging with Visual Studio on Windows where Intel simply has arrived at a place where the maintenance and support itself appear untenable, let alone introducing additional graphical capabilities. The users will be ill-served if things go the way with ArrayVisualizer that was dropped.

1 Like

Couldnā€™t agree more with this and other posts. It would help hugely.

I often use a fully fledged GIS program (and debug printouts) for debugging but that is basically static unlike the visualisation linked in the OP. Also much more limited in the types of display (I think!).

My ā€˜staticā€™ comment may be more my lack of DB experience. Fairly certain the GIS software can be dynamically linked to a database (with a wide variety of DB options). However, I have never used it that way so I am not certain if it is a practical option for debugging.

I really liked gdbplotlib functionality (or actually just how they present it since it doesnā€™t work with Fortran by default :c). I think that something like that with the vscode extension would be a very nice addition!

I have used this debugger in the past, and it supported very well the small part of modern fortran (i.e. its subset of f2003) that was allowed by the compiler. However, the compiler is now no longer supported, so I would not recommend building in any significant dependence on it in current fortran codes. ABSOFT ceases operation on Sept. 30, 2022

Is there any recent news about support/availability of the ABSOFT tools, including Fx3?