开发者

Progress bar is not being written continuously in ifort while it is in gfortran

I have wrote a genetic algorithm in Fortran to be able to compute with a long double precision a generic fitness function. The first version (double precision) was written for gfortran where I implemented a progress bar.

Now I have to compile with ifort because gfortran is not capable of performing real*16 calculations. All wo开发者_运维知识库rks fine but in this case (ifort) the progress bar does not work properly. Namely, only when the whole cycle is completed the progress bar is printed to std output.

Here is the piece of code for the progress bar:

if (rate(i).gt.ratemax) then

ratemax=rate(i)

write(*,"(1x,A57,D12.4,A27,f6.2,A1)",advance="no") &

'\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b ff: ', & 

ratemax,'             Progress:',100.*real(nmix)/real(nmixing),'%'

end if

I use an Intel Xeon of 64bit and the options for ifort are:

ifort -O2 -assume bscc FFevalLD.f90  func.o -o FFevalLD

while when use gfortran I compile in this way:

gfortran -ffree-form -O2 -fbackslash FFeval.f func.o -o FFeval

in gfortran (but double precision) all works fine.


Here's a solution:

if (rate(i).gt.ratemax) then 
  ratemax=rate(i)
  1100 format(1x,A57,D12.4,A27,f6.2,A1,$) 
  write(*,1100) &
  '\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\‌​b\b\b\b\b\b\b$ ratemax,' Progress:',100.*real(nmix)/real(nmixing),'%' 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜