<?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: Multi-Threaded Fortran code only runs one 1 CPU in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Multi-Threaded-Fortran-code-only-runs-one-1-CPU/m-p/875538#M3151</link>
    <description>&lt;P&gt;Don't trust your first glance. Insert diagnostic code to verify what you see is what you have. More often than not, diagnostic code exposes false assumptions.&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jun 2008 18:13:20 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2008-06-17T18:13:20Z</dc:date>
    <item>
      <title>Multi-Threaded Fortran code only runs one 1 CPU</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Multi-Threaded-Fortran-code-only-runs-one-1-CPU/m-p/875535#M3148</link>
      <description>Hi All&lt;BR /&gt;&lt;BR /&gt;Following the Intel seminar at Imperial college, I have decided to multi-thread a large Fortran code to run on my Core 2 Duo running Ubuntu 8.04 LTS. After a bit of messing about i now have a source that compiles and runs. I have parallelised over a do loop that calls a series of recursive subroutines:&lt;BR /&gt;&lt;BR /&gt;!$OMP PARALLEL&lt;BR /&gt;!$OMP&amp;amp; DEFAULT(private)&lt;BR /&gt;!$OMP&amp;amp; FIRSTPRIVATE(ii)&lt;BR /&gt;!$OMP&amp;amp; COPYIN(...*module variables*...)&lt;BR /&gt;!$OMP&amp;amp; REDUCTION(+:num1,num2,num3)&lt;BR /&gt;!$OMP&amp;amp; REDUCTION(+:protot,frastg)&lt;BR /&gt;!$OMP&amp;amp; REDUCTION(+:res1,res2)&lt;BR /&gt;!&lt;BR /&gt;!$OMP DO&lt;BR /&gt; do i=0,(nkj(ipar)+1),1&lt;BR /&gt; !&lt;BR /&gt; ii(ipar)=i&lt;BR /&gt; !&lt;BR /&gt; call recursivesub(ii,ival,num1,num2,num3,protot,recursivesub,res1,res2,frastg,pvfn)&lt;BR /&gt; !&lt;BR /&gt; enddo&lt;BR /&gt;!$OMP END DO NOWAIT&lt;BR /&gt;!&lt;BR /&gt;!$OMP END PARALLEL&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;(note the rest of the code is written in F77 so i have to pass the subroutine to itself as a dummy). The reduction variables are the results of the whole group of recursive subroutines; the variables defined by the COPYIN are not modified by the threaded region, and the array ii does not need to know about the other threads. The problem i have is that if i compile this with&lt;BR /&gt;&lt;BR /&gt;ifort blah -autodouble -fast -openmp&lt;BR /&gt;&lt;BR /&gt;the compiler reports that it has parallelized the region and loop, but when i run it the process never goes above 50% of my processing power (i.e, only one core??). The final result is the same as the serial code. If i use OMP_GET_NUM_THREADS() it returns 2. Is this a bug with ifort and ubuntu or a problem with my code? It seems like a pretty simple modification.&lt;BR /&gt;&lt;BR /&gt;Thanks for your help!&lt;BR /&gt;&lt;BR /&gt;Jim&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Jun 2008 08:42:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Multi-Threaded-Fortran-code-only-runs-one-1-CPU/m-p/875535#M3148</guid>
      <dc:creator>j_gaffney07</dc:creator>
      <dc:date>2008-06-11T08:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Threaded Fortran code only runs one 1 CPU</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Multi-Threaded-Fortran-code-only-runs-one-1-CPU/m-p/875536#M3149</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;
&lt;P&gt;Let me first say that I am a Windoz programmer but I think I can give you some suggestions none-the-less.&lt;/P&gt;
&lt;P&gt;1) Is nkj(ipar) == 0?&lt;BR /&gt;(i.e. is your do loop only 1 iteration)&lt;BR /&gt;2) In the do loop insert diagnostic code to display the omp thread (team member) number and value of i.&lt;BR /&gt;(i.e. assure each thread is performing ~1/2 the work)&lt;BR /&gt;3) Assuming multiple iterations and multiple threads are working, next see if the F77 code is calling runtime library functions that are OpenMP safe through serialization locks.&lt;/P&gt;
&lt;P&gt;I do not know if the documentation list the serialized OpenMP safe functions/subroutines but a short list includes&lt;/P&gt;
&lt;P&gt;READ, WRITE, RAND, DRAND&lt;/P&gt;
&lt;P&gt;4) If both threads are running then check to see if they are being forced to run on the same core. (Check on options relating to thread affinity).&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2008 15:04:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Multi-Threaded-Fortran-code-only-runs-one-1-CPU/m-p/875536#M3149</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2008-06-13T15:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Threaded Fortran code only runs one 1 CPU</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Multi-Threaded-Fortran-code-only-runs-one-1-CPU/m-p/875537#M3150</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Thanks alot for your reply Jim. At first glance i dont think that i have any of the problems you suggested, but there is something funny going on...&lt;BR /&gt;&lt;BR /&gt;Thanks again!&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Jun 2008 11:13:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Multi-Threaded-Fortran-code-only-runs-one-1-CPU/m-p/875537#M3150</guid>
      <dc:creator>j_gaffney07</dc:creator>
      <dc:date>2008-06-16T11:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-Threaded Fortran code only runs one 1 CPU</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Multi-Threaded-Fortran-code-only-runs-one-1-CPU/m-p/875538#M3151</link>
      <description>&lt;P&gt;Don't trust your first glance. Insert diagnostic code to verify what you see is what you have. More often than not, diagnostic code exposes false assumptions.&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2008 18:13:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Multi-Threaded-Fortran-code-only-runs-one-1-CPU/m-p/875538#M3151</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2008-06-17T18:13:20Z</dc:date>
    </item>
  </channel>
</rss>

