<?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 The file size is twice bigger when writing real8 into binary file. in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053407#M115757</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am a newbie to Fortran language. I try to write a real8 array into binary file using code as follow (compiler: Intel Fortran 2015)&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;open(unit=219, status='replace',file='data.bin',form='unformatted')
do j=1,ny2dval
do i=1,nx2dval
   write(219) fzavg(i,j)
end do
end do&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;But the file size is twice bigger than expected. It seems to write a real16 array. Why does it happen? Any suggestions?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks a lot!&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;

&lt;P&gt;ZHAO Peng&lt;/P&gt;</description>
    <pubDate>Tue, 05 May 2015 03:37:07 GMT</pubDate>
    <dc:creator>zhaopeng</dc:creator>
    <dc:date>2015-05-05T03:37:07Z</dc:date>
    <item>
      <title>The file size is twice bigger when writing real8 into binary file.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053407#M115757</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am a newbie to Fortran language. I try to write a real8 array into binary file using code as follow (compiler: Intel Fortran 2015)&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;open(unit=219, status='replace',file='data.bin',form='unformatted')
do j=1,ny2dval
do i=1,nx2dval
   write(219) fzavg(i,j)
end do
end do&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;But the file size is twice bigger than expected. It seems to write a real16 array. Why does it happen? Any suggestions?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks a lot!&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;

&lt;P&gt;ZHAO Peng&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2015 03:37:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053407#M115757</guid>
      <dc:creator>zhaopeng</dc:creator>
      <dc:date>2015-05-05T03:37:07Z</dc:date>
    </item>
    <item>
      <title>When you write an unformatted</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053408#M115758</link>
      <description>&lt;P&gt;When you write an unformatted sequential file, extra bytes are written to save information about the length of each record. Each length marker is four bytes long, so if you write records that each contain only four bytes of information (the size of a REAL), the record length markers take up as much space as the "payload", so your file will be twice as long. If you wish to reduce the space consumed by the record markers, you could write fewer but longer records. For example,&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;write(219) ((fzavg(i,j), i=1,nx2dval), j=1,ny2dval)
&lt;/PRE&gt;

&lt;P&gt;would write a single record, assuming that nx2dval and ny2dval are not so big that record size limits are breached.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2015 12:15:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053408#M115758</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-05-05T12:15:00Z</dc:date>
    </item>
    <item>
      <title>Quote:mecej4 wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053409#M115759</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;mecej4 wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;When you write an unformatted sequential file, extra bytes are written to save information about the length of each record. Each length marker is four bytes long, so if you write records that each contain only four bytes of information (the size of a REAL), the record length markers take up as much space as the "payload", so your file will be twice as long.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Thanks for your information!&lt;/P&gt;

&lt;P&gt;Actually the file size is not a problem, what I want is to write a binary file using Fortran and read it using C++. So if I use my Fortran codes to generate binary file, the C++ codes should read 8 bytes real value (double precision) and then skip 8 bytes to read next one, right?&lt;/P&gt;

&lt;P&gt;Thanks again!&lt;/P&gt;

&lt;P&gt;ZHAO Peng&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 02:47:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053409#M115759</guid>
      <dc:creator>zhaopeng</dc:creator>
      <dc:date>2015-05-06T02:47:22Z</dc:date>
    </item>
    <item>
      <title>If you are not going to use</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053410#M115760</link>
      <description>&lt;P&gt;If you are not going to use the record length markers, consider opening the file with ACCESS='STREAM' before writing to it. You may also consider the older nonstandard FORM='BINARY' specifier in the file OPEN statement.&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 03:22:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053410#M115760</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-05-06T03:22:04Z</dc:date>
    </item>
    <item>
      <title>Quote:mecej4 wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053411#M115761</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;mecej4 wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;If you are not going to use the record length markers, consider opening the file with ACCESS='STREAM' before writing to it. You may also consider the older nonstandard FORM='BINARY' specifier in the file OPEN statement.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Great! Both&amp;nbsp;&lt;SPAN style="font-size: 13.0080003738403px; line-height: 19.5120010375977px;"&gt;ACCESS='STREAM'&amp;nbsp;&lt;/SPAN&gt;and&amp;nbsp;&lt;SPAN style="font-size: 13.0080003738403px; line-height: 19.5120010375977px;"&gt;&amp;nbsp;FORM='BINARY'&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;work. Thank you very much!&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 03:28:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053411#M115761</guid>
      <dc:creator>zhaopeng</dc:creator>
      <dc:date>2015-05-06T03:28:51Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt; what I want is to write a</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053412#M115762</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt; what I want is to write a binary file using Fortran and read it using C++.&lt;/P&gt;

&lt;P&gt;Mentioning this in the first post would have resulted in a faster an appropriate answer. It is important that&amp;nbsp;the initial post&amp;nbsp;describes the framework to the question at hand.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 12:19:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/The-file-size-is-twice-bigger-when-writing-real8-into-binary/m-p/1053412#M115762</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2015-05-06T12:19:27Z</dc:date>
    </item>
  </channel>
</rss>

