<?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: !$OMP not recognized? Problem getting started with openmp in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OMP-not-recognized-Problem-getting-started-with-openmp/m-p/851747#M1899</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/421468"&gt;moortgatgmail.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;Hi all,
&lt;DIV&gt;For some reason I can't get even the simplest openmp test program to work. I use the MKL pardiso solver in a big code, which runs fine in parallel using openmp; also all the omp_lib functions work fine, so I think all the linking is done right. However, when I want to parallelize any additional loops, the !$OMP lines simply don't seem to be recognize. Let me give the simplest example I've tried:&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;program hello90&lt;/DIV&gt;
&lt;DIV&gt;use omp_lib&lt;/DIV&gt;
&lt;DIV&gt;integer:: id, nthreads,k&lt;/DIV&gt;
&lt;DIV&gt; !$omp parallel private(id,k)&lt;/DIV&gt;
&lt;DIV&gt; !$omp do&lt;/DIV&gt;
&lt;DIV&gt;   do k=1,1000000&lt;/DIV&gt;
&lt;DIV&gt; id = omp_get_thread_num()&lt;/DIV&gt;
&lt;DIV&gt; write (*,*) K, 'Hello World from thread', id, omp_in_parallel()&lt;/DIV&gt;
&lt;DIV&gt; if ( id == 0 ) then&lt;/DIV&gt;
&lt;DIV&gt;  nthreads = omp_get_num_threads()&lt;/DIV&gt;
&lt;DIV&gt;  write (*,*) 'There are', nthreads, 'threads'&lt;/DIV&gt;
&lt;DIV&gt; end if&lt;/DIV&gt;
&lt;DIV&gt;   enddo&lt;/DIV&gt;
&lt;DIV&gt;!$omp end do&lt;/DIV&gt;
&lt;DIV&gt; !$omp end parallel&lt;/DIV&gt;
&lt;DIV&gt;end program&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;I compile withifort -openmp -o test.e openmptest.f90 ; also OMP_NUM_THREADS is set to 2 (and verified that). The output on running it is:&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;./test.e&lt;/DIV&gt;
&lt;DIV&gt;     1 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     2 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     3 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     4 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     5 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     6 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;etc&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;I've tried different things as well. But in particular, I never getomp_in_parallel(). I don't know of any other ways to check whether the loop is indeed parallelized or not. [Oh, it should be: when compiling the output is:&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;openmptest.f90(5): (col. 10) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.&lt;/DIV&gt;
&lt;DIV&gt;openmptest.f90(4): (col. 10) remark: OpenMP DEFINED REGION WAS PARALLELIZED.&lt;/DIV&gt;
&lt;DIV&gt;]&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;What am i doing wrong??&lt;/DIV&gt;
&lt;DIV&gt;Thanks!&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;I ran this with ifort 11.0.074 and it worked. Did you export OMP_NUM_THREADS? On my system this defaults to 8 (the number of cores), but your system may be set to default to 1. If you just set OMP_NUM_THREADS in a shell, thenon execution it will default to the system default.&lt;BR /&gt;&lt;BR /&gt;I used bash and did the following&lt;BR /&gt;&lt;BR /&gt;export OMP_NUM_THREADS=2&lt;BR /&gt;./ompTest&lt;BR /&gt;&lt;BR /&gt;This produced the desired output.&lt;BR /&gt;&lt;BR /&gt;I believe the csh is "setenv OMP_NUM_THREADS 2".&lt;BR /&gt;&lt;BR /&gt;If I did &lt;BR /&gt;&lt;BR /&gt;OMP_NUM_THREADS=2&lt;BR /&gt;./ompTest&lt;BR /&gt;&lt;BR /&gt;The result defaults to the number of cores.</description>
    <pubDate>Fri, 24 Apr 2009 17:26:34 GMT</pubDate>
    <dc:creator>draceswbell_net</dc:creator>
    <dc:date>2009-04-24T17:26:34Z</dc:date>
    <item>
      <title>!$OMP not recognized? Problem getting started with openmp</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OMP-not-recognized-Problem-getting-started-with-openmp/m-p/851746#M1898</link>
      <description>Hi all,
&lt;DIV&gt;For some reason I can't get even the simplest openmp test program to work. I use the MKL pardiso solver in a big code, which runs fine in parallel using openmp; also all the omp_lib functions work fine, so I think all the linking is done right. However, when I want to parallelize any additional loops, the !$OMP lines simply don't seem to be recognize. Let me give the simplest example I've tried:&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;program hello90&lt;/DIV&gt;
&lt;DIV&gt;use omp_lib&lt;/DIV&gt;
&lt;DIV&gt;integer:: id, nthreads,k&lt;/DIV&gt;
&lt;DIV&gt; !$omp parallel private(id,k)&lt;/DIV&gt;
&lt;DIV&gt; !$omp do&lt;/DIV&gt;
&lt;DIV&gt;   do k=1,1000000&lt;/DIV&gt;
&lt;DIV&gt; id = omp_get_thread_num()&lt;/DIV&gt;
&lt;DIV&gt; write (*,*) K, 'Hello World from thread', id, omp_in_parallel()&lt;/DIV&gt;
&lt;DIV&gt; if ( id == 0 ) then&lt;/DIV&gt;
&lt;DIV&gt;  nthreads = omp_get_num_threads()&lt;/DIV&gt;
&lt;DIV&gt;  write (*,*) 'There are', nthreads, 'threads'&lt;/DIV&gt;
&lt;DIV&gt; end if&lt;/DIV&gt;
&lt;DIV&gt;   enddo&lt;/DIV&gt;
&lt;DIV&gt;!$omp end do&lt;/DIV&gt;
&lt;DIV&gt; !$omp end parallel&lt;/DIV&gt;
&lt;DIV&gt;end program&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;I compile withifort -openmp -o test.e openmptest.f90 ; also OMP_NUM_THREADS is set to 2 (and verified that). The output on running it is:&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;./test.e&lt;/DIV&gt;
&lt;DIV&gt;     1 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     2 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     3 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     4 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     5 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     6 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;etc&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;I've tried different things as well. But in particular, I never getomp_in_parallel(). I don't know of any other ways to check whether the loop is indeed parallelized or not. [Oh, it should be: when compiling the output is:&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;openmptest.f90(5): (col. 10) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.&lt;/DIV&gt;
&lt;DIV&gt;openmptest.f90(4): (col. 10) remark: OpenMP DEFINED REGION WAS PARALLELIZED.&lt;/DIV&gt;
&lt;DIV&gt;]&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;What am i doing wrong??&lt;/DIV&gt;
&lt;DIV&gt;Thanks!&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Apr 2009 18:56:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OMP-not-recognized-Problem-getting-started-with-openmp/m-p/851746#M1898</guid>
      <dc:creator>moortgatgmail_com</dc:creator>
      <dc:date>2009-04-23T18:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: !$OMP not recognized? Problem getting started with openmp</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OMP-not-recognized-Problem-getting-started-with-openmp/m-p/851747#M1899</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/421468"&gt;moortgatgmail.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;Hi all,
&lt;DIV&gt;For some reason I can't get even the simplest openmp test program to work. I use the MKL pardiso solver in a big code, which runs fine in parallel using openmp; also all the omp_lib functions work fine, so I think all the linking is done right. However, when I want to parallelize any additional loops, the !$OMP lines simply don't seem to be recognize. Let me give the simplest example I've tried:&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;program hello90&lt;/DIV&gt;
&lt;DIV&gt;use omp_lib&lt;/DIV&gt;
&lt;DIV&gt;integer:: id, nthreads,k&lt;/DIV&gt;
&lt;DIV&gt; !$omp parallel private(id,k)&lt;/DIV&gt;
&lt;DIV&gt; !$omp do&lt;/DIV&gt;
&lt;DIV&gt;   do k=1,1000000&lt;/DIV&gt;
&lt;DIV&gt; id = omp_get_thread_num()&lt;/DIV&gt;
&lt;DIV&gt; write (*,*) K, 'Hello World from thread', id, omp_in_parallel()&lt;/DIV&gt;
&lt;DIV&gt; if ( id == 0 ) then&lt;/DIV&gt;
&lt;DIV&gt;  nthreads = omp_get_num_threads()&lt;/DIV&gt;
&lt;DIV&gt;  write (*,*) 'There are', nthreads, 'threads'&lt;/DIV&gt;
&lt;DIV&gt; end if&lt;/DIV&gt;
&lt;DIV&gt;   enddo&lt;/DIV&gt;
&lt;DIV&gt;!$omp end do&lt;/DIV&gt;
&lt;DIV&gt; !$omp end parallel&lt;/DIV&gt;
&lt;DIV&gt;end program&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;I compile withifort -openmp -o test.e openmptest.f90 ; also OMP_NUM_THREADS is set to 2 (and verified that). The output on running it is:&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;./test.e&lt;/DIV&gt;
&lt;DIV&gt;     1 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     2 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     3 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     4 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     5 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;There are      1 threads&lt;/DIV&gt;
&lt;DIV&gt;     6 Hello World from thread      0 F&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;etc&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;I've tried different things as well. But in particular, I never getomp_in_parallel(). I don't know of any other ways to check whether the loop is indeed parallelized or not. [Oh, it should be: when compiling the output is:&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;openmptest.f90(5): (col. 10) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.&lt;/DIV&gt;
&lt;DIV&gt;openmptest.f90(4): (col. 10) remark: OpenMP DEFINED REGION WAS PARALLELIZED.&lt;/DIV&gt;
&lt;DIV&gt;]&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;What am i doing wrong??&lt;/DIV&gt;
&lt;DIV&gt;Thanks!&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;I ran this with ifort 11.0.074 and it worked. Did you export OMP_NUM_THREADS? On my system this defaults to 8 (the number of cores), but your system may be set to default to 1. If you just set OMP_NUM_THREADS in a shell, thenon execution it will default to the system default.&lt;BR /&gt;&lt;BR /&gt;I used bash and did the following&lt;BR /&gt;&lt;BR /&gt;export OMP_NUM_THREADS=2&lt;BR /&gt;./ompTest&lt;BR /&gt;&lt;BR /&gt;This produced the desired output.&lt;BR /&gt;&lt;BR /&gt;I believe the csh is "setenv OMP_NUM_THREADS 2".&lt;BR /&gt;&lt;BR /&gt;If I did &lt;BR /&gt;&lt;BR /&gt;OMP_NUM_THREADS=2&lt;BR /&gt;./ompTest&lt;BR /&gt;&lt;BR /&gt;The result defaults to the number of cores.</description>
      <pubDate>Fri, 24 Apr 2009 17:26:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/OMP-not-recognized-Problem-getting-started-with-openmp/m-p/851747#M1899</guid>
      <dc:creator>draceswbell_net</dc:creator>
      <dc:date>2009-04-24T17:26:34Z</dc:date>
    </item>
  </channel>
</rss>

