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

  • Context: Fortran 
  • Thread starter Thread starter minger
  • Start date Start date
  • Tags Tags
    Monitor
Click For Summary
SUMMARY

The discussion focuses on tracking subroutine calls in a Fortran 90 CFD solver, specifically addressing issues with a variable that is incorrectly assumed to be of size (N-x)³ instead of N³. The user initially attempted to use gprof for profiling but found it inadequate for tracking calls. The recommended solutions include using the TotalView debugger for step-by-step execution and reverse debugging, as well as strategically placing print statements in the code to monitor variable changes.

PREREQUISITES
  • Understanding of Fortran 90 programming
  • Familiarity with Computational Fluid Dynamics (CFD) concepts
  • Knowledge of debugging techniques and tools
  • Experience with variable memory allocation and indexing
NEXT STEPS
  • Research how to use TotalView for debugging Fortran applications
  • Learn about reverse debugging techniques in TotalView
  • Explore best practices for using print statements for debugging in Fortran
  • Investigate alternative profiling tools for Fortran, such as Valgrind or Intel VTune
USEFUL FOR

This discussion is beneficial for Fortran developers, computational fluid dynamics researchers, and anyone involved in debugging complex numerical simulations.

minger
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.
 
Technology 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.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 8 ·
Replies
8
Views
4K
Replies
11
Views
16K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
25K