Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28499 Discussions

Print statement not printing variables inside a do loop

chaitu123
Beginner
481 Views

Hi everyone! This is my first time posting a question here.

In my fortran code (very long), there is a subroutine in which I have a do loop. For debugging purposes, I am trying to print array variables that are assigned value inside the loop. But the print statement prints nothing. It only prints the variable value, when the statement is out of the loop. I am not a pro coder, so I have no clue why this might be happening.

Can anyone give me some clues where to look?

 

Thanks and regards,

Chaitanya

0 Kudos
2 Replies
mecej4
Honored Contributor III
463 Views

What does the DO statement contain? If it resembles DO I = Ja, Jb, and Ja is less than Jb when this statement is reached, the DO repeat count is zero, and the loop body is not executed.

Add a print statement just before the DO to see the values of Ja, Jb.

0 Kudos
Ron_Green
Moderator
369 Views

What you are reporting is unusual.  You have not give any details to help either. 

WIndows or Linux?  Version of OS and if linux distribution.  VM or not?

Remote connection or local workstation?

If on a cluster, know that stdout/stderr are buffered by the runtime and have to be forwarded from the compute nodes and can get thrown if the app aborts.

So you see, we really don't know your environment.  More than likely it's that you are using remote servers and/or clusters.  You can investigate adding FLUSH to see if that helps (sometimes it does, sometimes not)

 

0 Kudos
Reply