- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm having a frustrating time debugging a problem with a fortran 77 code that I'm working on. I observe a certain array 'grad' is filled with large values of order 1.0E+154. When I add debugging statements to print the values of varibles used in the the calculation of 'grad', the problem disappears!, i.e. the array 'grad' contains the values I expect to see. I could just leave the debugging print statements in the code and move on, but this behaviour is unsettling and makes me think there is a more serious problem lurking just beneath the surface.
Here are some details:
- It is a parallel code written in fortran 77 and uses MPI for the parallel stuff
- code is compiled using mpif90 to be run on intel itanium 2 processors
- Linux Redhat Fedora OS
Any help with this problem would be greatly appreciated
Thanks,
Howard
I'm having a frustrating time debugging a problem with a fortran 77 code that I'm working on. I observe a certain array 'grad' is filled with large values of order 1.0E+154. When I add debugging statements to print the values of varibles used in the the calculation of 'grad', the problem disappears!, i.e. the array 'grad' contains the values I expect to see. I could just leave the debugging print statements in the code and move on, but this behaviour is unsettling and makes me think there is a more serious problem lurking just beneath the surface.
Here are some details:
- It is a parallel code written in fortran 77 and uses MPI for the parallel stuff
- code is compiled using mpif90 to be run on intel itanium 2 processors
- Linux Redhat Fedora OS
Any help with this problem would be greatly appreciated
Thanks,
Howard
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you bypassing initialization of your data? (i.e. incorrectly assuming variables default to initialization to 0.0)
print statements indirectly insert a critical section into the code. This may affect code that has data race conditions.
Also, inserting print statements will change optimizations (i.e. varible may need to be saved from register to memory across call to print).
You might experiment by enclosing the questionable section of code in a critical section, then move the begin/end of critical section closer together. When you transition from good results to bad results this may disclose the source of the problem.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'd turn on all error checks:
-check all -g -traceback -fp-stack-check -fpe0
use these on your compile and link (assuming you use ifort for the link step)
What optimization options have you tried? O0, O2, O3?
-check all -g -traceback -fp-stack-check -fpe0
use these on your compile and link (assuming you use ifort for the link step)
What optimization options have you tried? O0, O2, O3?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - jimdempseyatthecove
Are you bypassing initialization of your data? (i.e. incorrectly assuming variables default to initialization to 0.0)
Jim Dempsey
Is not true that ifort initializes all uninitialized variable to zero? I guess i read it somwhere! If not, is there any other way of initializing them(those are not initialized) in one go to zero and keep the values for those who are initialized?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
/Qzero[-]
enable/disable(DEFAULT) implicit initialization to zero of local
scalar variables of intrinsic type INTEGER, REAL, COMPLEX, or
LOGICAL that are saved and not initialized
That is for local variables not global nor module
You may need to explicitly initialize global and module data.
What you see in Debug build is not necessarily what you will get in release mode.
Steve could answer if the FORTRAN spec requires initialization global and module data to 0 (when not otherwise initialized).
Program load time and file image size can be reduced by NOT having implicit initializaton to 0.
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - jimdempseyatthecove
Steve could answer if the FORTRAN spec requires initialization global and module data to 0 (when not otherwise initialized).
No, it does not. If you don't explicitly initialize any variable, it has an undefined initial value. This includes module variables and COMMON.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page