How Can I Track Subroutine Calls in My Fortran 90 CFD Solver?

  • Topic: Fortran 
  • Thread starter Thread starter minger
  • Start date Start date
  • Tags Tags
    Monitor
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
1 reply · 2K views
Science Advisor
Messages
1,494
Reaction score
2
Hey guys, I have a little problem with a code that I work with. The code is a full CFD solver written in Fortran 90. I need to make a change to a variable that gets passed all over the place. Basically its allocated to say N³, but at some point a routines operates on it thinking that it's only (N-x)³, so when it goes back to the original size, the data is essentially "shifted" to the lower indices.

Is there any way that I can track the calls that the program makes as it runs? I tried running gprof, but it doesn't seem to get everything. Furthermore it seems to be made more for optimization that tracking anyways.

This would really help a lot, thanks.
 
Physics news on Phys.org


Hello,

Thank you for reaching out with your issue. I understand that you are working with a CFD solver written in Fortran 90 and need to make a change to a variable that is causing issues. It seems that the data is being shifted to lower indices due to a routine operating on it with the assumption that it is only (N-x)³, instead of N³.

In order to track the calls that the program makes while it runs, you can use a debugger tool. A debugger allows you to step through the code line by line, keeping track of the values of variables and the flow of the program. This will help you identify where the issue is occurring and how the variable is being changed.

One popular debugger for Fortran programs is TotalView. It allows you to set breakpoints, watch variables, and step through the code. It also has a feature called "reverse debugging" which allows you to go back in time and see how a variable has changed over the course of the program.

Another option is to use print statements in strategic locations in the code to track the value of the variable as it goes through different routines. This can be a bit more time-consuming, but it can also be helpful in pinpointing the issue.

I hope this helps and good luck with your project! Let me know if you have any further questions.