<?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 OpenMP IO problem in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OpenMP-IO-problem/m-p/906602#M4445</link>
    <description>&lt;P&gt;Dear All,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am trying to compare the time needed for writing a file between "-serial" version and "-openmp" with onethread doing the IO operation.&lt;BR /&gt;The result showed that;&lt;BR /&gt;Serial: 10.2 s&lt;BR /&gt;OpenMP: 19.2s&lt;BR /&gt;I'd like to know to some guidance to improve this.&lt;BR /&gt;Thanks in advance;&lt;BR /&gt;&lt;BR /&gt;Chris &lt;BR /&gt;&lt;BR /&gt;--Code&lt;BR /&gt;program Console1&lt;BR /&gt;!$ use omp_lib&lt;BR /&gt;implicit none&lt;BR /&gt;integer,parameter::nx=100,ny=100,nz=100&lt;BR /&gt;integer i,j,k&lt;BR /&gt;real start_time,finish_time&lt;BR /&gt;real A(nx,ny,nz)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;A=1.0&lt;BR /&gt;&lt;BR /&gt;start_time=secnds(0.0)&lt;BR /&gt;!$omp parallel&lt;BR /&gt;!$omp master&lt;BR /&gt;open(101,file='test1')&lt;BR /&gt;do k=1,nz&lt;BR /&gt;do j=1,ny&lt;BR /&gt;do i=1,nx&lt;BR /&gt;write(101,*) A(i,j,k)&lt;BR /&gt;end do&lt;BR /&gt;end do&lt;BR /&gt;end do&lt;BR /&gt;close(101)&lt;BR /&gt;!$omp end master&lt;BR /&gt;!$omp end parallel&lt;BR /&gt;&lt;BR /&gt;finish_time=secnds(start_time)&lt;BR /&gt;print*,'time =', finish_time&lt;BR /&gt;end program Console1&lt;/P&gt;</description>
    <pubDate>Mon, 11 May 2009 03:11:43 GMT</pubDate>
    <dc:creator>weilo</dc:creator>
    <dc:date>2009-05-11T03:11:43Z</dc:date>
    <item>
      <title>OpenMP IO problem</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OpenMP-IO-problem/m-p/906602#M4445</link>
      <description>&lt;P&gt;Dear All,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am trying to compare the time needed for writing a file between "-serial" version and "-openmp" with onethread doing the IO operation.&lt;BR /&gt;The result showed that;&lt;BR /&gt;Serial: 10.2 s&lt;BR /&gt;OpenMP: 19.2s&lt;BR /&gt;I'd like to know to some guidance to improve this.&lt;BR /&gt;Thanks in advance;&lt;BR /&gt;&lt;BR /&gt;Chris &lt;BR /&gt;&lt;BR /&gt;--Code&lt;BR /&gt;program Console1&lt;BR /&gt;!$ use omp_lib&lt;BR /&gt;implicit none&lt;BR /&gt;integer,parameter::nx=100,ny=100,nz=100&lt;BR /&gt;integer i,j,k&lt;BR /&gt;real start_time,finish_time&lt;BR /&gt;real A(nx,ny,nz)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;A=1.0&lt;BR /&gt;&lt;BR /&gt;start_time=secnds(0.0)&lt;BR /&gt;!$omp parallel&lt;BR /&gt;!$omp master&lt;BR /&gt;open(101,file='test1')&lt;BR /&gt;do k=1,nz&lt;BR /&gt;do j=1,ny&lt;BR /&gt;do i=1,nx&lt;BR /&gt;write(101,*) A(i,j,k)&lt;BR /&gt;end do&lt;BR /&gt;end do&lt;BR /&gt;end do&lt;BR /&gt;close(101)&lt;BR /&gt;!$omp end master&lt;BR /&gt;!$omp end parallel&lt;BR /&gt;&lt;BR /&gt;finish_time=secnds(start_time)&lt;BR /&gt;print*,'time =', finish_time&lt;BR /&gt;end program Console1&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2009 03:11:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OpenMP-IO-problem/m-p/906602#M4445</guid>
      <dc:creator>weilo</dc:creator>
      <dc:date>2009-05-11T03:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: OpenMP IO problem</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OpenMP-IO-problem/m-p/906603#M4446</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Did you actually set it to 1 thread, e.g. by setting OMP_NUM_THREADS=1 ? If not, I suppose you are totalling up the time spent in all threads. If the other threads aren't doing anything useful, you may be able to affect the time they spend by fiddling with options such as (for Intel OpenMP) KMP_BLOCKTIME. &lt;BR /&gt;I don't see the motivation for writing single datum formatted fields to a file, or for putting it in a parallel section. &lt;BR /&gt;When parallel sections are used for practical purposes, of course, it is at least as interesting to know the elapsed time as the total CPU time of all threads. I suppose it is possible that a parallel region, presumably with a critical region in the I/O run-time library, will take longer than a serial region, in case that is what you are trying to find out.&lt;BR /&gt;</description>
      <pubDate>Mon, 11 May 2009 04:47:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OpenMP-IO-problem/m-p/906603#M4446</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2009-05-11T04:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: OpenMP IO problem</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OpenMP-IO-problem/m-p/906604#M4447</link>
      <description>&lt;DIV style="margin:0px;"&gt;Hi weilo,&lt;BR /&gt;&lt;BR /&gt;I'll go ahead and move this thread to the "Threading on Intel Parallel Architectures" forum, which would be a more natural fit. You might get more guidance there.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;~Gergana&lt;/DIV&gt;</description>
      <pubDate>Tue, 12 May 2009 14:28:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OpenMP-IO-problem/m-p/906604#M4447</guid>
      <dc:creator>Gergana_S_Intel</dc:creator>
      <dc:date>2009-05-12T14:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: OpenMP IO problem</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OpenMP-IO-problem/m-p/906605#M4448</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/427671"&gt;weilo&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;P&gt;Dear All,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am trying to compare the time needed for writing a file between "-serial" version and "-openmp" with onethread doing the IO operation.&lt;BR /&gt;The result showed that;&lt;BR /&gt;Serial: 10.2 s&lt;BR /&gt;OpenMP: 19.2s&lt;BR /&gt;I'd like to know to some guidance to improve this.&lt;BR /&gt;Thanks in advance;&lt;BR /&gt;&lt;BR /&gt;Chris &lt;BR /&gt;&lt;BR /&gt;--Code&lt;BR /&gt;program Console1&lt;BR /&gt;!$ use omp_lib&lt;BR /&gt;implicit none&lt;BR /&gt;integer,parameter::nx=100,ny=100,nz=100&lt;BR /&gt;integer i,j,k&lt;BR /&gt;real start_time,finish_time&lt;BR /&gt;real A(nx,ny,nz)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;A=1.0&lt;BR /&gt;&lt;BR /&gt;start_time=secnds(0.0)&lt;BR /&gt;!$omp parallel&lt;BR /&gt;!$omp master&lt;BR /&gt;open(101,file='test1')&lt;BR /&gt;do k=1,nz&lt;BR /&gt;do j=1,ny&lt;BR /&gt;do i=1,nx&lt;BR /&gt;write(101,*) A(i,j,k)&lt;BR /&gt;end do&lt;BR /&gt;end do&lt;BR /&gt;end do&lt;BR /&gt;close(101)&lt;BR /&gt;!$omp end master&lt;BR /&gt;!$omp end parallel&lt;BR /&gt;&lt;BR /&gt;finish_time=secnds(start_time)&lt;BR /&gt;print*,'time =', finish_time&lt;BR /&gt;end program Console1&lt;/P&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;The parallel version of the library function for "write" must take into consideration the possibility of multiple threads performing a write to the same unit at the same time. Therefor the mt version of the runtime library for write function must contain a critical section (hopefully on per unit). This will slow down the writes. Try reducing the number of calls to write&lt;BR /&gt;&lt;BR /&gt;do k=1,nz&lt;BR /&gt;do j=1,ny&lt;BR /&gt;write(101,'(F10.3,/)') (A(i,j,k), i=1,nx)&lt;BR /&gt;end do&lt;BR /&gt;end do&lt;BR /&gt;&lt;BR /&gt;You may have to experiment with the / and $ edit descriptors to get what you want.&lt;BR /&gt;&lt;BR /&gt;Jim Dempsey&lt;BR /&gt;</description>
      <pubDate>Tue, 12 May 2009 17:30:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OpenMP-IO-problem/m-p/906605#M4448</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2009-05-12T17:30:49Z</dc:date>
    </item>
  </channel>
</rss>

