<?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 To add: the test fails at in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071098#M119511</link>
    <description>&lt;P&gt;To add: the test fails at runtime on 17.0.4&lt;/P&gt;</description>
    <pubDate>Wed, 27 Sep 2017 23:37:29 GMT</pubDate>
    <dc:creator>Devorah_H_Intel</dc:creator>
    <dc:date>2017-09-27T23:37:29Z</dc:date>
    <item>
      <title>Unformatted IO and buffering</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071091#M119504</link>
      <description>&lt;P&gt;I am using Fortran Compiler 17.0.2.187.&lt;/P&gt;

&lt;P&gt;I think I have come across a bug in the compiler.&amp;nbsp; The following test program writes out data to an unformatted file.&amp;nbsp; It then reads it back in, and compares with the original data to make sure the IO was done correctly.&amp;nbsp; If I use the default options, the test passes.&amp;nbsp; However, if I enable buffering with /assume:buffered_io , the test fails.&lt;/P&gt;

&lt;P&gt;Roman&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;   
module unformattedIO_mod

   integer,parameter,private:: mcell=150000

   integer(kind=8),allocatable,private:: wtz(:),  gdiag(:)
   integer(kind=8),allocatable,private:: wtz2(:), gdiag2(:)

   character(len=*),parameter:: testfilename='testIO.dat'

   contains

   !---------------------------------------------------------------------------------

   subroutine writefile()
   implicit none
   integer i
   
      allocate(wtz(mcell), gdiag(mcell) )
      do i = 1, mcell
         wtz(i) = i
         gdiag(i) = 100 * i
      end do

      open(unit=8, file=testfilename, form='unformatted', action='write')
   
      write(8) wtz
      write(8) gdiag

      close(8)
      
   return
   end subroutine writefile

   !----------------------------------------------------------------

   subroutine readfile()
   implicit none

      allocate(wtz2(mcell), gdiag2(mcell) )

      open(unit=9, file=testfilename, form='unformatted', action='read')

      read(9) wtz2
      read(9) gdiag2
   
      close(9)
      
      if ( all(gdiag == gdiag2) .and. all(wtz == wtz2) ) then
         write(*,*) 'Test passed.'
      else
         write(*,*) 'Test failed.'
      end if
   
   return
   end subroutine readfile

end module unformattedIO_mod

!=============================================================

program testUnformattedIO

use unformattedIO_mod, only: writefile, readfile
implicit none

call writefile()
call readfile()

stop
end program testUnformattedIO
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 21:34:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071091#M119504</guid>
      <dc:creator>Roman1</dc:creator>
      <dc:date>2017-03-30T21:34:37Z</dc:date>
    </item>
    <item>
      <title>This appears to be a</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071092#M119505</link>
      <description>&lt;P&gt;This appears to be a regression with the 17.0.2 compiler. The&amp;nbsp;failure does not occur&amp;nbsp;with the 17.0.1 (or earlier) compiler. If you have 17.0.1 available you could use that as a work around, or as you noted do not use buffered I/O, or with buffered I/O the failure is avoidable&amp;nbsp;(at least for the test case provided) by setting the blocksize to 1200000 via the environment variable FORT_BLOCKSIZE.&lt;/P&gt;

&lt;P&gt;Thank you for the convenient reproducer. I escalated this to Development.&lt;/P&gt;

&lt;P&gt;(Internal tracking id: DPD200419523)&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 10:10:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071092#M119505</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2017-03-31T10:10:21Z</dc:date>
    </item>
    <item>
      <title>Replicating this comment to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071093#M119506</link>
      <description>&lt;P&gt;Replicating this comment to ensure you receive it Roman - This is possibly the same as my problem, as I use the buffered I/O option by default. &amp;nbsp;But, the problem I identify also arises when buffered I/O is suppressed - as indicated by the VERSION2.zip that is included in my post&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 20:07:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071093#M119506</guid>
      <dc:creator>Justin_v_</dc:creator>
      <dc:date>2017-07-06T20:07:30Z</dc:date>
    </item>
    <item>
      <title>The original issue reported</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071094#M119507</link>
      <description>&lt;P&gt;The original issue reported in this thread is fixed in the upcoming 18.0 compiler.&lt;/P&gt;

&lt;P&gt;Thank you,&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 16:29:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071094#M119507</guid>
      <dc:creator>Devorah_H_Intel</dc:creator>
      <dc:date>2017-07-07T16:29:07Z</dc:date>
    </item>
    <item>
      <title>I think I just rediscovered</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071095#M119508</link>
      <description>&lt;P&gt;I think I just spent a week or so rediscovering this bug in 2017 FORTRAN Update 4.&lt;/P&gt;

&lt;P&gt;Devorah - can you verify the below example runs to completion using the new 18.0 compiler when compiled with the buffered IO optimization?&lt;/P&gt;

&lt;P&gt;When I test with&amp;nbsp;&lt;SPAN style="font-size: 13.008px;"&gt;2017 FORTRAN Update 4 and&amp;nbsp;the buffered IO optimization it crashes while reading in the file it writes.&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;      program main
          IMPLICIT NONE
          
      integer :: scencqs = 53
      
      integer, pointer :: myreg(:), myk(:), myi(:), myj(:)
      real, pointer :: cq(:,:)
      real, pointer :: cvol(:), crhot(:)
      real, pointer :: cdt(:), ped(:), ued(:), ged(:), bed(:), sob(:)
      real, pointer :: pgd(:), pxd(:), ppd(:), pud(:)
      integer*4 :: lun,ic
      integer :: nctot = 0
      
      integer, pointer :: wmyreg(:), wmyk(:), wmyi(:), wmyj(:)
      real, pointer :: wcq(:,:)
      real, pointer :: wcvol(:), wcrhot(:)
      real, pointer :: wcdt(:), wped(:), wued(:),
     &amp;amp;                 wged(:), wbed(:), wsob(:)
      real, pointer :: wpgd(:), wpxd(:), wppd(:), wpud(:)
      integer*4 :: luno,wic
      integer :: wnctot
      
      print *, "Writing file..."
      
      luno=10
      open(unit=luno,form='unformatted',
     &amp;amp;file='test.input')
      
      wnctot=71445
      
      allocate(wmyreg(wnctot),wmyk(wnctot),wmyi(wnctot),wmyj(wnctot),
     &amp;amp;      wcq(scencqs,wnctot),wcvol(wnctot),wcrhot(wnctot),
     &amp;amp;      wcdt(wnctot),wged(wnctot),wbed(wnctot),
     &amp;amp;      wsob(wnctot),wped(wnctot),wued(wnctot))
      allocate(wpgd(wnctot),wpxd(wnctot),
     &amp;amp;      wppd(wnctot),wpud(wnctot))
      
      write(luno) (wmyreg(wic),wmyk(wic),wmyi(wic),wmyj(wic),
     &amp;amp;      wic=1,wnctot)
      write(luno) (wcq(1:scencqs,wic),wic=1,wnctot)
      write(luno) (wcvol(wic),wcrhot(wic),wcdt(wic),wged(wic),
     &amp;amp;      wbed(wic),wsob(wic),wped(wic),wued(wic),wic=1,wnctot)
      write(luno) (wpgd(wic),wpxd(wic),wppd(wic),wpud(wic),
     &amp;amp;      wic=1,wnctot)
      call flush(luno)
      close(luno)
          
      print *, "Reading file..."
            
      lun = 10
      open(unit=luno,form='unformatted',
     &amp;amp;file='test.input')
      
      nctot=71445
      
      allocate(myreg(nctot),myk(nctot),myi(nctot),myj(nctot),
     &amp;amp;      cq(scencqs,nctot),cvol(nctot),crhot(nctot),
     &amp;amp;      cdt(nctot),ged(nctot),bed(nctot),
     &amp;amp;      sob(nctot),ped(nctot),ued(nctot))
      allocate(pgd(nctot),pxd(nctot),
     &amp;amp;      ppd(nctot),pud(nctot))
      read(lun) (myreg(ic),myk(ic),myi(ic),myj(ic),ic=1,nctot)
      read(lun) (cq(1:scencqs,ic),ic=1,nctot)
      read(lun) (cvol(ic),crhot(ic),cdt(ic),ged(ic),
     &amp;amp;      bed(ic),sob(ic),ped(ic),ued(ic),ic=1,nctot)
      read(lun) (pgd(ic),pxd(ic),ppd(ic),
     &amp;amp;      pud(ic),ic=1,nctot)

      write(*,*) "Finished"
      close(lun)
      
      end program main
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 20:51:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071095#M119508</guid>
      <dc:creator>James_Pearson</dc:creator>
      <dc:date>2017-09-27T20:51:26Z</dc:date>
    </item>
    <item>
      <title>The code in #5 does not</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071096#M119509</link>
      <description>&lt;P&gt;The code in #5 does not follow either the fixed form or the free form of Fortran source. The compiler refuses to accept this nonstandard source form.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 23:21:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071096#M119509</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2017-09-27T23:21:00Z</dc:date>
    </item>
    <item>
      <title>Hi James,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071097#M119510</link>
      <description>&lt;P&gt;Hi James,&lt;/P&gt;

&lt;P&gt;Yes it builds and runs in 18.0&lt;/P&gt;

&lt;P&gt;$ ifort -v&lt;BR /&gt;
	ifort version 18.0.0&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;$ ifort -g -traceback -assume buffered_io test2.f90&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;$ ./a.out&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;Writing file...&lt;BR /&gt;
	&amp;nbsp;Reading file...&lt;BR /&gt;
	&amp;nbsp;Finished&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 23:32:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071097#M119510</guid>
      <dc:creator>Devorah_H_Intel</dc:creator>
      <dc:date>2017-09-27T23:32:09Z</dc:date>
    </item>
    <item>
      <title>To add: the test fails at</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071098#M119511</link>
      <description>&lt;P&gt;To add: the test fails at runtime on 17.0.4&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 23:37:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071098#M119511</guid>
      <dc:creator>Devorah_H_Intel</dc:creator>
      <dc:date>2017-09-27T23:37:29Z</dc:date>
    </item>
    <item>
      <title>My organization appears to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071099#M119512</link>
      <description>&lt;P&gt;My organization appears to have been burned by this same problem using 17.0.6.270.&lt;/P&gt;

&lt;P&gt;Devorah H., can you elucidate the scope of the problem fixed? Are there any situations where it's known that buffered and unformatted I/O using ifort2017 should still be safe?&lt;/P&gt;

&lt;P&gt;Note my organization can not adopt ifort2018 because its run-time performance degraded for our code compared to ifort2017 for still unknown reasons.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 15:10:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unformatted-IO-and-buffering/m-p/1071099#M119512</guid>
      <dc:creator>Craig_T_</dc:creator>
      <dc:date>2018-04-13T15:10:08Z</dc:date>
    </item>
  </channel>
</rss>

