<?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 Sharing a random stream harvest among threads in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980052#M5702</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;For issues of memory and simplicity, I'd like to share random number stream harvests among threads.&amp;nbsp; I don't care if, occasionally, a thread gets the 'wrong' or same random number as another thread because the index has not been bumped yet.&amp;nbsp; That is, the threads would share the index into the stream and the stream.&amp;nbsp; When any thread noticed the index becoming close to the end of the stream, it would invoke a continuation of the stream.&lt;/P&gt;
&lt;P&gt;My attempts to implement this have the program blowing off w/ no diagnostics or references to irrelevant lines of code.&amp;nbsp; Could it be that the VSL routines save data which becomes corrupted if there are multiple threads accessing the code simultaneously?&amp;nbsp;&amp;nbsp; Wouldn't this also be a problem if I gave up on this approach and set the indicies private?&lt;/P&gt;
&lt;P&gt;thanks,&lt;/P&gt;
&lt;P&gt;Bruce&lt;/P&gt;</description>
    <pubDate>Mon, 25 Mar 2013 20:49:24 GMT</pubDate>
    <dc:creator>Bruce_Weaver</dc:creator>
    <dc:date>2013-03-25T20:49:24Z</dc:date>
    <item>
      <title>Sharing a random stream harvest among threads</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980052#M5702</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;For issues of memory and simplicity, I'd like to share random number stream harvests among threads.&amp;nbsp; I don't care if, occasionally, a thread gets the 'wrong' or same random number as another thread because the index has not been bumped yet.&amp;nbsp; That is, the threads would share the index into the stream and the stream.&amp;nbsp; When any thread noticed the index becoming close to the end of the stream, it would invoke a continuation of the stream.&lt;/P&gt;
&lt;P&gt;My attempts to implement this have the program blowing off w/ no diagnostics or references to irrelevant lines of code.&amp;nbsp; Could it be that the VSL routines save data which becomes corrupted if there are multiple threads accessing the code simultaneously?&amp;nbsp;&amp;nbsp; Wouldn't this also be a problem if I gave up on this approach and set the indicies private?&lt;/P&gt;
&lt;P&gt;thanks,&lt;/P&gt;
&lt;P&gt;Bruce&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 20:49:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980052#M5702</guid>
      <dc:creator>Bruce_Weaver</dc:creator>
      <dc:date>2013-03-25T20:49:24Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt;My attempts to implement</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980053#M5703</link>
      <description>&amp;gt;&amp;gt;My attempts to implement this have the program blowing off w/ no diagnostics or references to irrelevant lines of code.
&amp;gt;&amp;gt;Could it be that the VSL routines save data which becomes corrupted if there are multiple threads accessing the code
&amp;gt;&amp;gt;simultaneously? Wouldn't this also be a problem if I gave up on this approach and set the indicies private?

I have a couple of questions:

- Do you use MKL?
- Did you try your tests in Debug configuration? What compiler, IDE and platform do you use?

Thanks.</description>
      <pubDate>Tue, 26 Mar 2013 13:51:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980053#M5703</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-03-26T13:51:46Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980054#M5704</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Yes, I'm using MKL (parallel).&amp;nbsp; I am doing them in Debug.&amp;nbsp; VS 2010; latest Intel software, Dual E5-2690 with windows 7.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 16:15:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980054#M5704</guid>
      <dc:creator>Bruce_Weaver</dc:creator>
      <dc:date>2013-03-26T16:15:40Z</dc:date>
    </item>
    <item>
      <title>Hi Bruce and Thanks for</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980055#M5705</link>
      <description>Hi Bruce and Thanks for additional information.

&amp;gt;&amp;gt;...That is, &lt;STRONG&gt;the threads would share the index&lt;/STRONG&gt; into the stream and the stream.  When any thread noticed the index becoming
&amp;gt;&amp;gt;close to the end of the stream, &lt;STRONG&gt;it would invoke a continuation of the stream&lt;/STRONG&gt;...

I think as soon &lt;STRONG&gt;continuation of the stream&lt;/STRONG&gt; starts all the threads should &lt;STRONG&gt;pause&lt;/STRONG&gt; until that procedure is completed. Some synchronization object, a mutex, an event or a critical section, needs to be used. If you don't do this ( that is, &lt;STRONG&gt;threads pause&lt;/STRONG&gt; ) then any thread could try to access some position in the stream which is still &lt;STRONG&gt;Not Ready&lt;/STRONG&gt; for processing and has junk / uninitialized data. Does it make sense?</description>
      <pubDate>Wed, 27 Mar 2013 00:13:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980055#M5705</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-03-27T00:13:46Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt;I don't care if,</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980056#M5706</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;I don't care if, occasionally, a thread gets the 'wrong' or same random number as another thread because the index has not been bumped yet.&lt;/P&gt;
&lt;P&gt;I assume you want performance. Asume also it is &lt;EM&gt;&lt;STRONG&gt;not important&lt;/STRONG&gt; &lt;/EM&gt;for the end of life of use of a random number by a specific thread be the same sequence as the beginning of life of use of a random number.&lt;/P&gt;
&lt;P&gt;Then have each thread use their own random number generator who's initial seed is dependent upon thread number or thread ID in a manner such that collisions initially at large intervals (or not at all).&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2013 16:16:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980056#M5706</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2013-03-27T16:16:02Z</dc:date>
    </item>
    <item>
      <title>Thanks for your thoughts.</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980057#M5707</link>
      <description>&lt;P&gt;Thanks for your thoughts.&lt;/P&gt;
&lt;P&gt;Sergey: I use lots of random numbers throughout the code.&amp;nbsp; If I have to stop everyone for each call, it would be hopeless.&amp;nbsp; Note that the Fortran&amp;nbsp; RAN intrinsic works fine, however the low quality of the sequence kills the convergence after a few hours.&lt;/P&gt;
&lt;P&gt;Jim:&amp;nbsp; I'm not sure I exactly understand "&lt;EM&gt;&lt;STRONG&gt;not important&lt;/STRONG&gt; &lt;/EM&gt;for the end of life of use of a random number by a specific thread be the same sequence as the beginning of life of use of a random number."&amp;nbsp; I have thought of using different random number generators (well, same generator, different seeds) and I'm getting close to trying that.&amp;nbsp; There are some reasons to try the shared stream approach and I'm not sure why that doesn't seem to work.&amp;nbsp; It seems that the threads should be able to share the stream...but perhaps not.&amp;nbsp; ANd yes, it is ALL about performance...this code takes days to run and we're about to expand its range significantly.&lt;/P&gt;
&lt;P&gt;thanks again, Bruce&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2013 17:31:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980057#M5707</guid>
      <dc:creator>Bruce_Weaver</dc:creator>
      <dc:date>2013-03-27T17:31:19Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt;...If you don't do this (</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980058#M5708</link>
      <description>&amp;gt;&amp;gt;...If you don't do this ( that is, threads pause ) then any thread could try to access some position in the stream which is
&amp;gt;&amp;gt;still Not Ready for processing...

Bruce, I think it would be nice to log into a txt-file values for indecies, thread numbers ( IDs ) and the size of the stream during processing. If you manage to record these values then you will be able to better anaylize and understand the problem. I could be wrong but I think you're dealing with Out-Of-Bound case.</description>
      <pubDate>Thu, 28 Mar 2013 15:06:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980058#M5708</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-03-28T15:06:04Z</dc:date>
    </item>
    <item>
      <title>Hi Sergey,</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980059#M5709</link>
      <description>&lt;P&gt;Hi Sergey,&lt;/P&gt;
&lt;P&gt;Yes, I did seem to have some out of bounds problems but I think I cleared them up before I started this thread.&amp;nbsp; I'm going ot give it one more try and then fall back to making everything private and see if that works easily.&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2013 20:26:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980059#M5709</guid>
      <dc:creator>Bruce_Weaver</dc:creator>
      <dc:date>2013-03-28T20:26:34Z</dc:date>
    </item>
    <item>
      <title>Hi all,</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980060#M5710</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;OK, I gave up for now and made'm thread private via a module and so far it seems ok...it'll take several hours to see if it converges properly.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2013 21:45:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Sharing-a-random-stream-harvest-among-threads/m-p/980060#M5710</guid>
      <dc:creator>Bruce_Weaver</dc:creator>
      <dc:date>2013-03-28T21:45:13Z</dc:date>
    </item>
  </channel>
</rss>

