<?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 Re: FORTRAN equivalent to a C fwrite? in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870368#M71913</link>
    <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/405909"&gt;david.sallngc.com&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;How about if my vector is complex? Is there a way to write all REAL's and IMAG's separately usig some type of indexing?&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;&lt;BR /&gt;David,&lt;BR /&gt;write(1) (real(a(i)),i=1,10), (aimag(a(j)),j=1,10)&lt;BR /&gt;&lt;BR /&gt;should work&lt;BR /&gt;Les&lt;BR /&gt;</description>
    <pubDate>Fri, 04 Dec 2009 11:25:00 GMT</pubDate>
    <dc:creator>Les_Neilson</dc:creator>
    <dc:date>2009-12-04T11:25:00Z</dc:date>
    <item>
      <title>FORTRAN equivalent to a C fwrite?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870363#M71908</link>
      <description>Hi Everyone!&lt;BR /&gt;&lt;BR /&gt;I am trying to read/write binary data to files in FORTRAN using the Intel compiler that will be read/write with Matlab. I have successfully done this however the runtime for large files is slow. A small example of my code for writting a binary file is,&lt;BR /&gt;&lt;BR /&gt;real*8 a(10)&lt;BR /&gt;open(unit = 1, file = 'foo.dat', form = 'unformatted', recordtype = 'stream')&lt;BR /&gt;do i = 1,10&lt;BR /&gt; write(1) a(10)&lt;BR /&gt;end do&lt;BR /&gt;&lt;BR /&gt;I believe that I am being slowed down by constantly fetching the A data in memory? Is there a way I can write the vector A as is done in C using FWRITE where one specifies the number of bytes and the loop is eliminated?&lt;BR /&gt;&lt;BR /&gt;I also need to write COMPLEX data into the output. I am currently doing the following (Matlab stores real() and imag() data in separate vectors),&lt;BR /&gt;&lt;BR /&gt;complex*16 b(10)&lt;BR /&gt;&lt;BR /&gt;do i = 1,10&lt;BR /&gt; write(1) real(b(i))&lt;BR /&gt;end do&lt;BR /&gt;do i = 1,20&lt;BR /&gt; write(1) imag(b(i))&lt;BR /&gt;end do&lt;BR /&gt;&lt;BR /&gt;Is there a way this can be done using a type of STRIDE variable as opposed to storing the real and imaginary parts in separate vectors? Since in FORTRAN, the real/imaginary parts are interlaced, is there a way of writing every other value? For example, if we were to write out B,&lt;BR /&gt;&lt;BR /&gt; real(b(1))    imag(b(1))   real(b(2)) imag(b(2)) ...&lt;BR /&gt; &lt;BR /&gt; byte chunk 1   byte chunk 2 byte chunk 3 byte chunk 4 ..... &lt;BR /&gt;&lt;BR /&gt;I would want to write byte chunk 1,3,5, ... for the reals and chunk 2,4,6,... for the imaginary data.&lt;BR /&gt;&lt;BR /&gt;Thank you very much for your time. Any help would be greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;Sincerely,&lt;BR /&gt;&lt;BR /&gt;David</description>
      <pubDate>Fri, 04 Dec 2009 03:58:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870363#M71908</guid>
      <dc:creator>david_sallngc_com</dc:creator>
      <dc:date>2009-12-04T03:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: FORTRAN equivalent to a C fwrite?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870364#M71909</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;write(1) A(1:10)</description>
      <pubDate>Fri, 04 Dec 2009 04:31:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870364#M71909</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2009-12-04T04:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: FORTRAN equivalent to a C fwrite?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870365#M71910</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/405909"&gt;david.sallngc.com&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;...&lt;BR /&gt;real*8 a(10)&lt;BR /&gt;open(unit = 1, file = 'foo.dat', form = 'unformatted', recordtype = 'stream')&lt;BR /&gt;do i = 1,10&lt;BR /&gt; write(1) a(10)&lt;BR /&gt;end do&lt;BR /&gt;&lt;BR /&gt;I believe that I am being slowed down by constantly fetching the A data in memory? Is there a way I can write the vector A as is done in C using FWRITE where one specifies the number of bytes and the loop is eliminated?&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Instead of Fortran WRITE, use the Win32 API function &lt;STRONG&gt;WriteFile&lt;/STRONG&gt;:&lt;BR /&gt;&lt;BR /&gt;lret = WriteFile(handl, LOC(A), 10*SIZEOF(A(1)), NULL, os)&lt;BR /&gt;&lt;BR /&gt;This does exactly what you want.&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Dec 2009 06:32:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870365#M71910</guid>
      <dc:creator>Paul_Curtis</dc:creator>
      <dc:date>2009-12-04T06:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: FORTRAN equivalent to a C fwrite?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870366#M71911</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/99850"&gt;jimdempseyatthecove&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt; &lt;BR /&gt;write(1) A(1:10)&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
Hi Jim!&lt;BR /&gt;&lt;BR /&gt;Thanks Jim. I can not believe that is all that is necessary!&lt;BR /&gt;&lt;BR /&gt;How about if my vector is complex? Is there a way to write all REAL's and IMAG's separately usig some type of indexing?&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;&lt;BR /&gt;Sincerely,&lt;BR /&gt;&lt;BR /&gt;David&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Dec 2009 10:35:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870366#M71911</guid>
      <dc:creator>david_sallngc_com</dc:creator>
      <dc:date>2009-12-04T10:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: FORTRAN equivalent to a C fwrite?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870367#M71912</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/77713"&gt;Paul Curtis&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Instead of Fortran WRITE, use the Win32 API function &lt;STRONG&gt;WriteFile&lt;/STRONG&gt;:&lt;BR /&gt;&lt;BR /&gt;lret = WriteFile(handl, LOC(A), 10*SIZEOF(A(1)), NULL, os)&lt;BR /&gt;&lt;BR /&gt;This does exactly what you want.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
Hi Paul!&lt;BR /&gt;&lt;BR /&gt;Thanks for the reply. I need code that will run on both Windows 32-bit and 64-bit as well as a 64-bit Linux. Even though WriteFile looks just like fwrite, I need something more portable.&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;&lt;BR /&gt;Sincerely,&lt;BR /&gt;&lt;BR /&gt;David&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Dec 2009 10:38:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870367#M71912</guid>
      <dc:creator>david_sallngc_com</dc:creator>
      <dc:date>2009-12-04T10:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: FORTRAN equivalent to a C fwrite?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870368#M71913</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/405909"&gt;david.sallngc.com&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;How about if my vector is complex? Is there a way to write all REAL's and IMAG's separately usig some type of indexing?&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;&lt;BR /&gt;David,&lt;BR /&gt;write(1) (real(a(i)),i=1,10), (aimag(a(j)),j=1,10)&lt;BR /&gt;&lt;BR /&gt;should work&lt;BR /&gt;Les&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Dec 2009 11:25:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870368#M71913</guid>
      <dc:creator>Les_Neilson</dc:creator>
      <dc:date>2009-12-04T11:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: FORTRAN equivalent to a C fwrite?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870369#M71914</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
You can open the file ACCESS='STREAM' and just write a stream of bytes. This is standard F2003.&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Dec 2009 14:18:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/FORTRAN-equivalent-to-a-C-fwrite/m-p/870369#M71914</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-12-04T14:18:17Z</dc:date>
    </item>
  </channel>
</rss>

