bug message reminder

When adressing a model crash or bug, please remember to include an entire model setup in your post that reproduces the crash or exposes the bug. Also add the XBlog.txt file. This is necessary information for people that are trying to help you. Including your model setup can be achieved by adding the zipped run directory (excluding output) as an attachment to the post.


Debugging XBeach in Visual Studio

Pieter van Geer, modified 7 Years ago.

Debugging XBeach in Visual Studio

Swell Posts: 176 Join Date: 1/5/11 Recent Posts
With changing the solution files (see here), some people asked me how to debug. This post shortly describes the steps one needs to take to debug xbeach in Visual Studio.

  • Set the xbeach project as startup project. This can be done by right clicking the xbeach project and select Set as StartUp Project. Although the xbeachlibrary project contains the source code, the xbeach project produces the executable. That is the reason it has to be the startup project.
  • Specify the working dir for debugging in the xbeach project. (Right click the xbeach project and select Properties, or press Alt+Enter when the project is selected, Select "Debugging" and set the "working directory" property). The working directory should contain the model setup you would like to debug (including a params.txt file).
  • Place a breakpoint at the desired location in the source code. Most of the source code is located in the xbeachlibrary project. The xbeach project only contains xbeach.F90, that defines the main time loop. A breakpoint can be placed by either clicking the border left of the line you would like the breakpoint to appear, press F9 if the cursor is on the desired location or right click in the code and select Breakpoint -> Insert breakpoint. Breakpoints can be monitored with the Breakpoints toolwindow (Debugging menu -> Windows -> Breakpoints, or Alt + D, B ).
  • Hit F5 to compile and run the code until a breakpoint was hit or the program stops.

There is lots of information on debugging in Visual Studio on the web. Search google to find how to use conditional breakpoints or how to find the stack trace whenever a breakpoint was hit for example.
Onur Kurum, modified 7 Years ago.

RE: Debugging XBeach in Visual Studio

Capillary Posts: 12 Join Date: 4/28/11 Recent Posts
Hi Pieter,

while debugging a test case, is it possible to use multiple cores? If not, how do you increase the speed (decrease waiting time) between time steps?

Is there any similar tools you can recommend to debug XBeach in linux ?

Bas Hoonhout, modified 7 Years ago.

RE: Debugging XBeach in Visual Studio

Infra-gravity Posts: 362 Join Date: 5/20/11 Recent Posts
Hi Onur,

There is such thing as the MPI Cluster Debugger for Visual Studio, which is supposed to work with the Intel Fortran compiler as well. However, I never succeeded in getting it running. I doubt if it will be any faster. I think it will be quite annoying, because you are debugging several processes at once...

With linux you can use the gdb debugger. There are several GUI's available for this debugger. Debugging in MPI mode is quite easy with gdb: just run it using mpirun and X cores and X debug windows will pop-up. Still annoying, though :-)

If you really want to debug a specific, huge model after some simulation time has passed (I guess that's why you want to speed up things), you may consider to use the optimized library version of XBeach and Fedor's rewind function ;-) I do not have a clue how that works, but it's probably brilliant!