<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Progress bar in Fortran. in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Progress-bar-in-Fortran/m-p/745772#M3815</link>
    <description>It is not a bug in ifort. The Fortran standard does not guarantee that the output with advance='no' is immediately available - this is used to "build" a record. Some implementations do this, some do not.&lt;BR /&gt;&lt;BR /&gt;The following works in Intel Fortran, but may not be portable. Note that the unit has to be opened for FORTRAN carriage control.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[fortran]program test
use ifport
  implicit none
  integer(kind=4)::i
  open (unit=6, carriagecontrol='fortran')
  do i=1, 10
    ! Just spend some cpu time to calculate pi.
    ! This could be replaced by non-standard subroutine sleep(n).
    call sleepqq(300)
    call progress(i) ! generate the progress bar.
  enddo
  stop
end

subroutine progress(j)
  implicit none
  integer(kind=4)::j,k
  character(len=17)::bar="???% |          |"
  write(unit=bar(1:3),fmt="(i3)") 10*j
  do k=1, j
    bar(6+k:6+k)="*"
  enddo
  ! print the progress bar.
  write(unit=6,fmt="(a1,a1,a17)") '+',char(13), bar
  return
end subroutine progress[/fortran]&lt;/PRE&gt;</description>
    <pubDate>Thu, 22 Apr 2010 15:58:28 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2010-04-22T15:58:28Z</dc:date>
    <item>
      <title>Progress bar in Fortran.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Progress-bar-in-Fortran/m-p/745771#M3814</link>
      <description>Hi, everyone. I want to produce a simple progress bar in a text console by using Fortran 90. The bar would be like this.&lt;DIV&gt;&lt;PRE&gt;[bash] 10% |*         |[/bash]&lt;/PRE&gt; I want to use&lt;B&gt;advance="no"&lt;/B&gt;in a &lt;B&gt;write&lt;/B&gt; statement to generate the bar. Below is therelevantcode.&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[fortran]program test
  implicit none
  integer(kind=4)::i
  do i=1, 10
    ! Just spend some cpu time to calculate pi.
    ! This could be replaced by non-standard subroutine sleep(n).
    call pi
    call progress(i) ! generate the progress bar.
  enddo
  stop
end

subroutine progress(j)
  implicit none
  integer(kind=4)::j,k
  character(len=17)::bar="???% |          |"
  write(unit=bar(1:3),fmt="(i3)") 10*j
  do k=1, j
    bar(6+k:6+k)="*"
  enddo
  ! print the progress bar.
  write(unit=6,fmt="(a1,a17)",advance="no") char(13), bar
  if (j/=10) then
    flush(unit=6)
  else
    write(unit=6,fmt=*)
  endif
  return
end subroutine progress[/fortran]&lt;/PRE&gt; I found the binary produced by ifort could only print the final bar, which is&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[bash]100%|**********|[/bash]&lt;/PRE&gt; The intermediates are somehow omitted. Some other compilers could produce the desired results.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Is this a bug of my code or ifort?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance!&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Apr 2010 14:33:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Progress-bar-in-Fortran/m-p/745771#M3814</guid>
      <dc:creator>woshiwuxin</dc:creator>
      <dc:date>2010-04-22T14:33:46Z</dc:date>
    </item>
    <item>
      <title>Progress bar in Fortran.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Progress-bar-in-Fortran/m-p/745772#M3815</link>
      <description>It is not a bug in ifort. The Fortran standard does not guarantee that the output with advance='no' is immediately available - this is used to "build" a record. Some implementations do this, some do not.&lt;BR /&gt;&lt;BR /&gt;The following works in Intel Fortran, but may not be portable. Note that the unit has to be opened for FORTRAN carriage control.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[fortran]program test
use ifport
  implicit none
  integer(kind=4)::i
  open (unit=6, carriagecontrol='fortran')
  do i=1, 10
    ! Just spend some cpu time to calculate pi.
    ! This could be replaced by non-standard subroutine sleep(n).
    call sleepqq(300)
    call progress(i) ! generate the progress bar.
  enddo
  stop
end

subroutine progress(j)
  implicit none
  integer(kind=4)::j,k
  character(len=17)::bar="???% |          |"
  write(unit=bar(1:3),fmt="(i3)") 10*j
  do k=1, j
    bar(6+k:6+k)="*"
  enddo
  ! print the progress bar.
  write(unit=6,fmt="(a1,a1,a17)") '+',char(13), bar
  return
end subroutine progress[/fortran]&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Apr 2010 15:58:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Progress-bar-in-Fortran/m-p/745772#M3815</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-04-22T15:58:28Z</dc:date>
    </item>
    <item>
      <title>Progress bar in Fortran.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Progress-bar-in-Fortran/m-p/745773#M3816</link>
      <description>Thank you, Steve!&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I'm notmajoredin computer science. Prior to reading your post, I have no idea about byte-oriented and record-oriented file systems. I think the I/O facilities provided by record-oriented file systems, e.g. in VMS, are really more powerful than those provided in *nix.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;BTW, I find that the desired results could also be produced by using &lt;B&gt;-vms&lt;/B&gt; option without defining &lt;B&gt;carriagecontrol&lt;/B&gt; in &lt;B&gt;open&lt;/B&gt; statement. The only drawback is the first byte of each record is always wasted. Moreover, a compiler supports the VMS I/O system is also required. :(&lt;/DIV&gt;</description>
      <pubDate>Fri, 23 Apr 2010 12:40:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Progress-bar-in-Fortran/m-p/745773#M3816</guid>
      <dc:creator>woshiwuxin</dc:creator>
      <dc:date>2010-04-23T12:40:13Z</dc:date>
    </item>
    <item>
      <title>Progress bar in Fortran.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Progress-bar-in-Fortran/m-p/745774#M3817</link>
      <description>I personally think a non-standard, but least-demanded trick is to write it in this way.&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;[fortran]write(unit=6,fmt="(a1,a20,$)") char(13), bar[/fortran]&lt;/PRE&gt; &lt;/DIV&gt;&lt;DIV&gt;The only compiler I've tried that does NOT support the Dollar is f90 from SUN. However, f95 does support it.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;May we say that previously SUN was not compatible with "Dollar", but later this might be changed? :D&lt;/DIV&gt;</description>
      <pubDate>Fri, 23 Apr 2010 13:34:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Progress-bar-in-Fortran/m-p/745774#M3817</guid>
      <dc:creator>woshiwuxin</dc:creator>
      <dc:date>2010-04-23T13:34:29Z</dc:date>
    </item>
    <item>
      <title>Progress bar in Fortran.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Progress-bar-in-Fortran/m-p/745775#M3818</link>
      <description>The -vms option implicitly sets carriagecontrol='fortran'. What you're looking for is not really tied to the file system, but rather the semantics of Fortran record I/O.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Apr 2010 13:38:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Progress-bar-in-Fortran/m-p/745775#M3818</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-04-23T13:38:47Z</dc:date>
    </item>
  </channel>
</rss>

