<?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 specify thread number in openMP in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/specify-thread-number-in-openMP/m-p/764684#M19375</link>
    <description>You can also link with the OpenMP "stubs" library, which links in NO-OP functions.&lt;BR /&gt;Or you can write your own no-op stub functions.&lt;BR /&gt;Comment what may happen in your code when a requrest is made for more than one thread while linked with stubs. Or possibly write out a diagnostic message&lt;BR /&gt;&lt;BR /&gt; write (*,*) "Attempting to specify ", nThreads, "threads when OpenMP not available, using 1 thread instead"&lt;BR /&gt; nThreads = 1&lt;BR /&gt;&lt;BR /&gt;Jim&lt;BR /&gt;</description>
    <pubDate>Thu, 12 Aug 2010 11:57:04 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2010-08-12T11:57:04Z</dc:date>
    <item>
      <title>specify thread number in openMP</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/specify-thread-number-in-openMP/m-p/764682#M19373</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have recenly implemented openMP in our software. I want the same source code that can &lt;BR /&gt;be complied parallelly or sequentially. The question is that howto do thatif I want to specify the number of threads as input?&lt;BR /&gt;&lt;BR /&gt;My code is like the following:&lt;BR /&gt;&lt;BR /&gt;....&lt;BR /&gt;call omp_set_num_threads(thread_num)&lt;BR /&gt;!$OMP parallel do private(num_thread)&lt;BR /&gt;DO I = 1, NP&lt;BR /&gt;  num_thread=1&lt;BR /&gt;!$ num_thread = omp_get_thread_num()+1&lt;BR /&gt;.....&lt;BR /&gt;ENDDO&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The number of threads thread_num is read from input. Inside the paralle region, the thread number num_thread from each thread&lt;BR /&gt;is used.For a non-openMP platform,thread_num is set to be1 from input. &lt;BR /&gt;!$ is treated as comment by a non-OpenMP compiler. So the do loop is run serially. But 'call omp_set_num_threads()' library can not be compiled in a non-openMP compiler. &lt;BR /&gt;&lt;BR /&gt;Do you have any suggestions about setting the number of threads in openMP while the code can be compiled in non-opnMP platform? Thanks.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Aug 2010 06:10:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/specify-thread-number-in-openMP/m-p/764682#M19373</guid>
      <dc:creator>maria</dc:creator>
      <dc:date>2010-08-12T06:10:10Z</dc:date>
    </item>
    <item>
      <title>specify thread number in openMP</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/specify-thread-number-in-openMP/m-p/764683#M19374</link>
      <description>Could you just "omp comment" out the call in the same way?&lt;BR /&gt;&lt;BR /&gt;!$ use omp_lib&lt;BR /&gt;...&lt;BR /&gt;!$ call omp_set_num_threads(thread_num)&lt;BR /&gt;&lt;BR /&gt;You could use "normal" compiler directives too:&lt;BR /&gt;&lt;BR /&gt;!DEC$ IF DEFINED(_OPENMP)&lt;BR /&gt; call omp_set_num_threads(thread_num)&lt;BR /&gt;!DEC$ ELSE&lt;BR /&gt; write (*,"(A)") "I can only deal with one thing at a time"&lt;BR /&gt;!DEC$ ENDIF&lt;BR /&gt;&lt;BR /&gt;Or you could use the C-like preprocessor (/fpp command line option):&lt;BR /&gt;&lt;BR /&gt;#ifdef _OPENMP&lt;BR /&gt; call omp_set_num_threads(thread_num)&lt;BR /&gt;#else&lt;BR /&gt; write (*,"(A)") "I'm feeling very serial today"&lt;BR /&gt;#endif</description>
      <pubDate>Thu, 12 Aug 2010 06:42:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/specify-thread-number-in-openMP/m-p/764683#M19374</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2010-08-12T06:42:52Z</dc:date>
    </item>
    <item>
      <title>specify thread number in openMP</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/specify-thread-number-in-openMP/m-p/764684#M19375</link>
      <description>You can also link with the OpenMP "stubs" library, which links in NO-OP functions.&lt;BR /&gt;Or you can write your own no-op stub functions.&lt;BR /&gt;Comment what may happen in your code when a requrest is made for more than one thread while linked with stubs. Or possibly write out a diagnostic message&lt;BR /&gt;&lt;BR /&gt; write (*,*) "Attempting to specify ", nThreads, "threads when OpenMP not available, using 1 thread instead"&lt;BR /&gt; nThreads = 1&lt;BR /&gt;&lt;BR /&gt;Jim&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Aug 2010 11:57:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/specify-thread-number-in-openMP/m-p/764684#M19375</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2010-08-12T11:57:04Z</dc:date>
    </item>
    <item>
      <title>specify thread number in openMP</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/specify-thread-number-in-openMP/m-p/764685#M19376</link>
      <description>I use the following seemingly obvious method:&lt;BR /&gt;#ifdef _OPENMP&lt;BR /&gt;&lt;SET num_thread="" based="" on="" omp_="" calls=""&gt;&lt;BR /&gt;#else&lt;BR /&gt;num_thread=1&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;given that it is standard practice to guard all omp_ calls by #ifdef _OPENMP so as to permit compilation without OpenMP compiler.&lt;/SET&gt;</description>
      <pubDate>Thu, 12 Aug 2010 15:11:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/specify-thread-number-in-openMP/m-p/764685#M19376</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2010-08-12T15:11:13Z</dc:date>
    </item>
    <item>
      <title>specify thread number in openMP</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/specify-thread-number-in-openMP/m-p/764686#M19377</link>
      <description>#if... requires a preprocessor&lt;BR /&gt;&lt;BR /&gt;I prefer to use #if myself since I use IVF which has a preprocessor (also has OpenMP).&lt;BR /&gt;&lt;BR /&gt;OP requested technique for system with compiler without OpenMP support. It is unknown as to if this compiler (or system) has a preprocessor for use with Fortran.&lt;BR /&gt;&lt;BR /&gt;Jim&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Aug 2010 19:46:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/specify-thread-number-in-openMP/m-p/764686#M19377</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2010-08-12T19:46:58Z</dc:date>
    </item>
  </channel>
</rss>

