<?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: vslCopyStream bug? in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/vslCopyStream-bug/m-p/914708#M12458</link>
    <description>&lt;P&gt;Dear Ilya:&lt;/P&gt;
&lt;P&gt;Thanks for your quick answer. Unfortunately, your workaround is valid only for basic RNG's for which the skip-ahead method is supported, which is not the case in any of the mersenne-twister flavors provided by theMKL (MT19937, MT2203) according to the vslnotes.pdf. I tried and it didn't work (it returned and invalid parameter error). This is very unfortunate, because I bought the MKL almost exclusively for the random number generators. I only hope it's fixed in the next release.&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt; Ed&lt;/P&gt;</description>
    <pubDate>Fri, 03 Aug 2007 11:52:50 GMT</pubDate>
    <dc:creator>eddy_alonso</dc:creator>
    <dc:date>2007-08-03T11:52:50Z</dc:date>
    <item>
      <title>vslCopyStream bug?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/vslCopyStream-bug/m-p/914706#M12456</link>
      <description>&lt;P&gt;Dear all:&lt;/P&gt;
&lt;P&gt;What am I doing wrong? The following very short code crashes&lt;/P&gt;
&lt;P&gt;#define CACHESIZE 100&lt;/P&gt;
&lt;P&gt;int main()&lt;/P&gt;
&lt;P&gt;{&lt;BR /&gt;double r1[CACHESIZE];&lt;/P&gt;
&lt;P&gt;unsigned int seed = 45;&lt;/P&gt;
&lt;P&gt;VSLStreamStatePtr stream1;&lt;BR /&gt;VSLStreamStatePtr stream2;&lt;BR /&gt;VSLStreamStatePtr stream3;&lt;/P&gt;
&lt;P&gt;int errcode = vslNewStream(&amp;amp;stream1, VSL_BRNG_MT19937, seed);&lt;BR /&gt;errcode = vdRngGaussian( VSL_METHOD_DGAUSSIAN_BOXMULLER2, stream1, CACHESIZE, r1, 0.0, 1.0 );&lt;BR /&gt;errcode = vslCopyStream(&amp;amp;stream2,stream1);&lt;BR /&gt;errcode = vslCopyStream(&amp;amp;stream3,stream2);&lt;BR /&gt;errcode = vslDeleteStream(&amp;amp;stream1);&lt;BR /&gt;errcode = vslDeleteStream(&amp;amp;stream2); // crash here&lt;BR /&gt;errcode = vslDeleteStream(&amp;amp;stream3);&lt;/P&gt;
&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;In other words, if I make a copy from a stream copy, it crashes when I delete the second stream. Thiscomes aboutin the context of writing a random number generator class, its copy constructor and the destructor. In the copy constructor, I copy the stream, which is a member variable of the class, and the destructor calls vslDeleteStream. When I call a function, which in turn calls another function, if both functions take the random number generator as argument (passed by value), the copy constructor is called twice in a row, and the destructor as well when I exit the scope -- the same sequence of shown above: two calls to CopyStream and two calls to DeleteStream. Am I doing something wrong? Is it a bug? About the stacked copy of streams, I am very constrained by the program where I am doing the development.&lt;/P&gt;
&lt;P&gt;Thanks a lot in advance&lt;/P&gt;
&lt;P&gt; Eduardo&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2007 12:21:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/vslCopyStream-bug/m-p/914706#M12456</guid>
      <dc:creator>eddy_alonso</dc:creator>
      <dc:date>2007-07-31T12:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: vslCopyStream bug?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/vslCopyStream-bug/m-p/914707#M12457</link>
      <description>&lt;P&gt;Eduardo,&lt;/P&gt;
&lt;P&gt;Thank you for reporting this issue. We have also found this bug and prepared a fix which will be available in the nearest MKL release.&lt;/P&gt;
&lt;P&gt;As for the current workaround, we could recommend the following:&lt;/P&gt;
&lt;P&gt;- save RNG initialization parameters in private members of the class;&lt;BR /&gt;- save information about the number of generated numbers (say, num_generated);&lt;/P&gt;
&lt;P&gt;- use vslNewStream function with the same initialization parameters in copy constructor;&lt;BR /&gt;- use vslSkipAheadStream function with num_generated variable asthe secondparameter to start generating random numbers in the new class from the same point as in the class which is being copied.&lt;/P&gt;
&lt;P&gt;Sorry for inconvenience.&lt;/P&gt;
&lt;P&gt;Software engineer,&lt;BR /&gt;Ilya&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2007 14:33:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/vslCopyStream-bug/m-p/914707#M12457</guid>
      <dc:creator>Ilya_B_Intel</dc:creator>
      <dc:date>2007-07-31T14:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: vslCopyStream bug?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/vslCopyStream-bug/m-p/914708#M12458</link>
      <description>&lt;P&gt;Dear Ilya:&lt;/P&gt;
&lt;P&gt;Thanks for your quick answer. Unfortunately, your workaround is valid only for basic RNG's for which the skip-ahead method is supported, which is not the case in any of the mersenne-twister flavors provided by theMKL (MT19937, MT2203) according to the vslnotes.pdf. I tried and it didn't work (it returned and invalid parameter error). This is very unfortunate, because I bought the MKL almost exclusively for the random number generators. I only hope it's fixed in the next release.&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt; Ed&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2007 11:52:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/vslCopyStream-bug/m-p/914708#M12458</guid>
      <dc:creator>eddy_alonso</dc:creator>
      <dc:date>2007-08-03T11:52:50Z</dc:date>
    </item>
  </channel>
</rss>

