<?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-thread random_number in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/multi-thread-random-number/m-p/757448#M12935</link>
    <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
You should call random_seed only once at the beginning of the program, or not at all. I don't see results like yours - which compiler version are you using?&lt;BR /&gt;</description>
    <pubDate>Thu, 23 Jul 2009 17:44:11 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2009-07-23T17:44:11Z</dc:date>
    <item>
      <title>multi-thread random_number</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/multi-thread-random-number/m-p/757447#M12934</link>
      <description>hi all,&lt;BR /&gt;I'm a rookie and I'm experiencing some problems to get random_number() work with OpenMP, random numbers generated by different processors are usually the same. Here is a sample code demostrated the way I'm using it,&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV style="text-align: left;"&gt;program rand&lt;BR /&gt;implicit none&lt;BR /&gt; integer	::	i,j&lt;BR /&gt; real	::	rnd(1:24)&lt;BR /&gt; integer	::	th(1:24)&lt;BR /&gt; integer	::	omp_get_thread_num&lt;BR /&gt;!$omp paralleldo default(none)&lt;BR /&gt; do i=1,8	   	!the mechine I'm using has 8 processors, this is to initialize the RNG&lt;BR /&gt;print *,omp_get_thread_num() !to confirm every processor is initialized&lt;BR /&gt; call random_seed()&lt;BR /&gt; end do&lt;BR /&gt;!$OMP PARALLELDO DEFAULT(NONE) PRIVATE(I) SHARED(RND, th)&lt;BR /&gt; do i=1,24&lt;BR /&gt; call random_number(rnd(i))&lt;BR /&gt; end do&lt;BR /&gt; do j=1,8&lt;BR /&gt; write(*,'(3(f11.9,2x))')rnd((j-1)*3+1:j*3)&lt;BR /&gt; end do&lt;BR /&gt;end program&lt;BR /&gt;&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
This is the result I'm getting:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV style="text-align: left;"&gt;0&lt;BR /&gt; 1&lt;BR /&gt; 2&lt;BR /&gt; 4&lt;BR /&gt; 6&lt;BR /&gt; 3&lt;BR /&gt; 7&lt;BR /&gt; 5&lt;BR /&gt;0.972639918  0.881229877  0.594391227&lt;BR /&gt;0.972639918  0.881229877  0.594391227&lt;BR /&gt;0.972639918  0.881229877  0.594391227&lt;BR /&gt;0.972639918  0.881229877  0.594391227&lt;BR /&gt;0.972639918  0.881229877  0.594391227&lt;BR /&gt;0.402969360  0.031995680  0.221246824&lt;BR /&gt;0.972639918  0.881229877  0.594391227&lt;BR /&gt;0.972639918  0.881229877  0.594391227&lt;BR /&gt;&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
I also tried to call random_seed() once or not to call random_seed(), the results were worse..&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Jul 2009 17:18:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/multi-thread-random-number/m-p/757447#M12934</guid>
      <dc:creator>hougj</dc:creator>
      <dc:date>2009-07-23T17:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: multi-thread random_number</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/multi-thread-random-number/m-p/757448#M12935</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
You should call random_seed only once at the beginning of the program, or not at all. I don't see results like yours - which compiler version are you using?&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Jul 2009 17:44:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/multi-thread-random-number/m-p/757448#M12935</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-07-23T17:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: multi-thread random_number</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/multi-thread-random-number/m-p/757449#M12936</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;Steve,&lt;BR /&gt;I'm using ifort for Linux 10.1 20070913&lt;BR /&gt;If I call random_seed() for once, here is one result:&lt;BR /&gt;&lt;BR /&gt;0.615034342 0.626231551 0.531687737&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;&lt;BR /&gt;If I don't call random_seed(), the result will be like this:&lt;BR /&gt;&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;&lt;BR /&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/336209"&gt;Steve Lionel (Intel)&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; You should call random_seed only once at the beginning of the program, or not at all. I don't see results like yours - which compiler version are you using?&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Jul 2009 18:57:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/multi-thread-random-number/m-p/757449#M12936</guid>
      <dc:creator>hougj</dc:creator>
      <dc:date>2009-07-23T18:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: multi-thread random_number</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/multi-thread-random-number/m-p/757450#M12937</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Here's what I get using 11.1 with the call to random_seed:&lt;BR /&gt;&lt;BR /&gt; 0&lt;BR /&gt; 0&lt;BR /&gt; 1&lt;BR /&gt; 1&lt;BR /&gt; 2&lt;BR /&gt; 2&lt;BR /&gt; 3&lt;BR /&gt; 3&lt;BR /&gt;0.817219734 0.104807064 0.379983515&lt;BR /&gt;0.583199739 0.792860270 0.173353985&lt;BR /&gt;0.208930358 0.373894215 0.305989832&lt;BR /&gt;0.362445623 0.486917466 0.139199391&lt;BR /&gt;0.188994333 0.676810563 0.982293963&lt;BR /&gt;0.886496782 0.382345438 0.172872305&lt;BR /&gt;0.295758396 0.474151313 0.157240897&lt;BR /&gt;0.645729303 0.361581087 0.968771875&lt;BR /&gt;&lt;BR /&gt;and without:&lt;BR /&gt;&lt;BR /&gt; 0&lt;BR /&gt; 0&lt;BR /&gt; 1&lt;BR /&gt; 1&lt;BR /&gt; 3&lt;BR /&gt; 3&lt;BR /&gt; 2&lt;BR /&gt; 2&lt;BR /&gt;0.963055491 0.382701963 0.775439918&lt;BR /&gt;0.777333379 0.946657956 0.711797237&lt;BR /&gt;0.686883211 0.710611343 0.315871298&lt;BR /&gt;0.089636147 0.204167530 0.367890567&lt;BR /&gt;0.000000392 0.025480442 0.352516145&lt;BR /&gt;0.666914463 0.313309848 0.915075898&lt;BR /&gt;0.919936955 0.455012798 0.597476482&lt;BR /&gt;0.179469123 0.906562090 0.750906527&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Jul 2009 19:58:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/multi-thread-random-number/m-p/757450#M12937</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-07-23T19:58:37Z</dc:date>
    </item>
  </channel>
</rss>

