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

Fortran output to screen problems

Webster__William
Beginner
840 Views

I have a commercial software package that I developed in Fortran which runs perfectly using Intel's 18.0 compiler with Visual Studio 2017.  

With the new Fortran compiler in oneAPI (latest version 2022.3) running with Visual Studio 2022 (latest version) I have problems with output to the screen.  My program writes many lines to screen using the construct "write (*, ..."  at the start of the run.  After about writing 20 or so lines to screen, the screen becomes jumbled and the program freezes.  After many hours, I found a work around.  If I include a pause statement anywhere in the program before too many lines are written to the screen, then the problem goes away, and the program runs as before.  This is a clumsy solution.

I suspect that in the oneAPI version, the buffer for writing to the screen is not flushed by the compiler or linker before the program is executed and overflow occurs after about 20 lines are written to the buffer.  Somehow the pause statement causes the buffer to be flushed and things are back to normal.

After 60+ years of programming in Fortran, I have almost always found run problems to be my code's problems.  However, in this case, I suspect these problems do indeed lie with the compiler or linker.  

Anyone else have a similar problem?

Labels (1)
0 Kudos
3 Replies
jimdempseyatthecove
Honored Contributor III
821 Views

I've never seen that happen. Although I use the prior version of oneAPI and MS VS 2019.

What happens with a simple program

program test
  implicit none
  integer :: i
  do i=999,0,-1
    write(*,*) i,"bottles of beer on the wall"
  end do
  pause "no more bottles of beer on the wall"
end program test

Try both with ifx and ifort.

Jim Dempsey

 

0 Kudos
FortranFan
Honored Contributor III
818 Views

@Webster__William ,

You likely know the drill given your vast experience: a reproducer will help you figure out a workaround or a solution faster.

By the way, have you tried the FLUSH statement in the Fortran language, a standard feature?  You may know PAUSE is non-standard.

0 Kudos
Ron_Green
Moderator
785 Views

Are you running the application from the command line, or from within Visual Studio?  Try to run from the command line.

 

How large is the problem or simulation?  Large arrays?  How much physical RAM do you have on that PC?  Can you run a performance monitor first, then start the application?  Are you running out of memory on the PC?  Can you try a small simulation or problem, same behavior?

 

Exactly how many lines are you writing?  Hundreds, thousands, millions?

 

Console application?  Quickwin?  Windows app? what project type?

Any other languages involved besides Fortran?

0 Kudos
Reply