<?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 Getting the &amp;quot;status&amp;quot; of a random number stream in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796315#M2697</link>
    <description>Hi cppcoder,&lt;BR /&gt;&lt;BR /&gt;That's great that you find save/restore stream feature meeting your needs. Do you still feel that documentation for that feature needs to be improved?&lt;BR /&gt;&lt;BR /&gt;Sergey</description>
    <pubDate>Thu, 24 Feb 2011 06:25:58 GMT</pubDate>
    <dc:creator>Sergey_M_Intel2</dc:creator>
    <dc:date>2011-02-24T06:25:58Z</dc:date>
    <item>
      <title>Getting the "status" of a random number stream</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796311#M2693</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a program that is called several times as part of a simulation. When the simulation begins, the program is called from a script with parameterINITIAL_SEED (and other parameters). My program initializes a stream with that seed:&lt;/P&gt;&lt;BLOCKQUOTE&gt;vslNewStream( &amp;amp;my_vsl_stream,VSL_BRNG_MT19937, INITIAL_SEED);&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thenproduces some results involving random numbers, writes results to disk, and ends.&lt;/P&gt;&lt;P&gt;The next time is called, I want it to start generating numbers from the point the stream was left during the previous execution, let's call it NEXT_SEED:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;vslNewStream( &amp;amp;my_vsl_stream,VSL_BRNG_MT19937, NEXT_SEED);&lt;/BLOCKQUOTE&gt;

&lt;P&gt;How can I get that number before finishing execution so that it can be written to a file, and then passed by the script the next time and be used as the seed of the generator?&lt;/P&gt;&lt;P&gt;I found a functionGetStreamStateBrng but it doesn't seem to do what I want, or maybe it does. Any clue about it?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2011 01:05:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796311#M2693</guid>
      <dc:creator>cppcoder</dc:creator>
      <dc:date>2011-02-23T01:05:19Z</dc:date>
    </item>
    <item>
      <title>Getting the "status" of a random number stream</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796312#M2694</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;You might want tocheckservice RNG functionalityfor saving/restoring random stream descriptive data to/from file &lt;BR /&gt;&lt;BR /&gt;vslSaveStreamF( stream, fname );&lt;BR /&gt;vslLoadStreamF( &amp;amp;stream, fname );&lt;BR /&gt;&lt;BR /&gt;Its description is available inRandom Number Generators\Service Routines Section, which isinStatistical Functions Chapter of MKL Manual.&lt;BR /&gt;&lt;BR /&gt;Please, let me know if this answers your question.&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Andrey&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2011 07:37:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796312#M2694</guid>
      <dc:creator>Andrey_N_Intel</dc:creator>
      <dc:date>2011-02-23T07:37:09Z</dc:date>
    </item>
    <item>
      <title>Getting the "status" of a random number stream</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796313#M2695</link>
      <description>Hello,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks for your answer.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The documentation only says that those functions "save /read stream descriptivedata". It doesn't say what descriptive data is that or if it saves the current state of the stream. Where can I find that info?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;If the descriptive data saves also the initial SEED I passed and use it to initialize the stream, then those functions won't help me.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Feb 2011 19:33:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796313#M2695</guid>
      <dc:creator>cppcoder</dc:creator>
      <dc:date>2011-02-23T19:33:12Z</dc:date>
    </item>
    <item>
      <title>Getting the "status" of a random number stream</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796314#M2696</link>
      <description>&lt;P&gt;OK, it seems to be working. 

&lt;/P&gt;&lt;P&gt;I'm included a sample program to test this. It first initializes a stream with SEED = 10, and produces 5 numbers and saves the info of the stream. Then initializes a second stream with that info. Then it generates another 5 numbers which are different from the initial 5. Finally, it initializes a third stream with the same SEED=10 but generates 10 numbers. The first 5 are the same as the 5 generated with the first stream, while the remaining 5 are the same as the ones generated with the second stream. 

&lt;/P&gt;&lt;P&gt;Thus, it's working as expected&lt;/P&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks a lot for your answer&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;


&lt;BLOCKQUOTE&gt;&lt;PRE&gt;#include &lt;IOSTREAM&gt;
#include &lt;ALGORITHM&gt;

#include "mkl_vsl.h"
#include "errcheck.inc" // this is included somewhere in the MKL's examples directory 

#define SEED    10
#define BRNG    VSL_BRNG_MT19937
#define METHOD  0
#define N       5*2

double r&lt;N&gt;;

int main()
{
    VSLStreamStatePtr stream1, stream2, stream3;
    int i, errcode;

	////////////////////////////////////
    errcode = vslNewStream( &amp;amp;stream1, BRNG,  SEED );
    CheckVslError( errcode );

	errcode = vdRngUniform( METHOD, stream1, (N / 2), r, 0.0, 1.0 );
    CheckVslError( errcode );

	std::copy (r, r + (N / 2), std::ostream_iterator&lt;DOUBLE&gt; (std::cout, "\t"));
	std::cout &amp;lt;&amp;lt; std::endl;

	errcode = vslSaveStreamF( stream1, "C:\\temp\\somefile.bin" );
    CheckVslError( errcode );

    errcode = vslDeleteStream( &amp;amp;stream1 );
    CheckVslError( errcode );

	////////////////////////////////////
	errcode = vslLoadStreamF( &amp;amp;stream2, "C:\\temp\\somefile.bin" );
	CheckVslError( errcode );

	errcode = vdRngUniform( METHOD, stream2, (N / 2), r, 0.0, 1.0 );
    CheckVslError( errcode );

	std::copy (r, r + (N / 2), std::ostream_iterator&lt;DOUBLE&gt; (std::cout, "\t"));
	std::cout &amp;lt;&amp;lt; std::endl;

    errcode = vslDeleteStream( &amp;amp;stream2 );
    CheckVslError( errcode );

	////////////////////////////////////
    errcode = vslNewStream( &amp;amp;stream3, BRNG,  SEED );
    CheckVslError( errcode );

	errcode = vdRngUniform( METHOD, stream3, N, r, 0.0, 1.0 );
    CheckVslError( errcode );

	std::copy (r, r + N, std::ostream_iterator&lt;DOUBLE&gt; (std::cout, "\t"));
	std::cout &amp;lt;&amp;lt; std::endl;

    errcode = vslDeleteStream( &amp;amp;stream3 );
    CheckVslError( errcode );
	////////////////////////////////////

    return 0;
}&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/DOUBLE&gt;&lt;/N&gt;&lt;/ALGORITHM&gt;&lt;/IOSTREAM&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Feb 2011 20:56:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796314#M2696</guid>
      <dc:creator>cppcoder</dc:creator>
      <dc:date>2011-02-23T20:56:14Z</dc:date>
    </item>
    <item>
      <title>Getting the "status" of a random number stream</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796315#M2697</link>
      <description>Hi cppcoder,&lt;BR /&gt;&lt;BR /&gt;That's great that you find save/restore stream feature meeting your needs. Do you still feel that documentation for that feature needs to be improved?&lt;BR /&gt;&lt;BR /&gt;Sergey</description>
      <pubDate>Thu, 24 Feb 2011 06:25:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796315#M2697</guid>
      <dc:creator>Sergey_M_Intel2</dc:creator>
      <dc:date>2011-02-24T06:25:58Z</dc:date>
    </item>
    <item>
      <title>Getting the "status" of a random number stream</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796316#M2698</link>
      <description>Hi Sergey,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Yes, I still do. It was not very clear from reading the documentation if it achieved what I needed. I had to try it myself to see if it did. I don't think I would have found the functions I used useful unless I have got the reply on this forum.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;</description>
      <pubDate>Thu, 24 Feb 2011 16:35:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796316#M2698</guid>
      <dc:creator>cppcoder</dc:creator>
      <dc:date>2011-02-24T16:35:50Z</dc:date>
    </item>
    <item>
      <title>Getting the "status" of a random number stream</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796317#M2699</link>
      <description>Hi cppcoder,&lt;BR /&gt;&lt;BR /&gt;We'll take care of it and improve this part of documentation in coming releases of the MKL product.&lt;BR /&gt;&lt;BR /&gt;Thank you for the feedback,&lt;BR /&gt;Sergey</description>
      <pubDate>Fri, 25 Feb 2011 05:34:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Getting-the-quot-status-quot-of-a-random-number-stream/m-p/796317#M2699</guid>
      <dc:creator>Sergey_M_Intel2</dc:creator>
      <dc:date>2011-02-25T05:34:24Z</dc:date>
    </item>
  </channel>
</rss>

