<?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 Should VSL Leap Frog work with Wichmann Hill? in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Should-VSL-Leap-Frog-work-with-Wichmann-Hill/m-p/1116410#M24681</link>
    <description>&lt;P&gt;I tried vslLeapfrogStream and compared the numbers produced with a simple block of randoms.&lt;/P&gt;

&lt;P&gt;This worked for the congruential generators MCG31 and 59, but it did not put the numbers in the right places with WH.&lt;/P&gt;

&lt;P&gt;If it is not supported, I expected a non-zero status from calling the&amp;nbsp;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;vslLeapfrogStream&amp;nbsp;&lt;/SPAN&gt;method, but it was zero.&lt;/P&gt;

&lt;P&gt;My guess is that WH shouldn't be supported and the status is wrong.&lt;/P&gt;

&lt;P&gt;This is what I did...&lt;/P&gt;

&lt;P&gt;the&amp;nbsp;assert(fabs(a - b) &amp;lt; 1e-12); fails, suggesting inconsistent values.&lt;/P&gt;

&lt;P&gt;It works if I change the gen to an MCG near the top.&lt;/P&gt;

&lt;P&gt;This is with compiler version 16.0 x64 in VS2015 / Windows 10.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;int main()
{
	constexpr int nFrogs = 7;
	constexpr int nSims = 101;
	VSLStreamStatePtr streams[nFrogs];

	int gen = VSL_BRNG_WH;
	int seed = 1234567890;

	// Creating first stream
	int status = vslNewStream(&amp;amp;streams[0], gen, seed);
	assert(status == 0);

	// Copy first stream to others
	for (int i = 1; i &amp;lt; nFrogs; ++i)
	{
		status = vslCopyStream(&amp;amp;streams&lt;I&gt;, streams[0]);
		assert(status == 0);
	}

	// Leapfrogging the streams
	for (int i = 0; i &amp;lt; nFrogs; ++i)
	{
		status = vslLeapfrogStream(streams&lt;I&gt;, i, nFrogs);
		assert(status == 0); // Unacceptable generator gives status -1002
	}

	// Generating base case random numbers without leap frog for comparison
	// Same generator and seed
	VSLStreamStatePtr baseStream;
	status = vslNewStream(&amp;amp;baseStream, gen, seed);
	assert(status == 0);
	double y[nSims*nFrogs];
	status = vdRngUniform(VSL_RNG_METHOD_UNIFORM_STD, baseStream, nSims*nFrogs, y, 0.0, 1.0);
	assert(status == 0);

	// Generate randoms for each of the leapfrog streams and compare output
	double x[nSims];
	for (int i = 1; i &amp;lt; nFrogs; ++i)
	{
		status = vdRngUniform(VSL_RNG_METHOD_UNIFORM_STD, streams&lt;I&gt;, nSims, x, 0.0, 1.0);
		assert(status == 0);
		for (int j = 0; j &amp;lt; nSims; ++j)
		{
			double a = x&lt;J&gt;;
			double b = y[j*nFrogs + i];
			assert(fabs(a - b) &amp;lt; 1e-12);
		}

	}

	// Deleting the streams
	for (int i = 1; i &amp;lt; nFrogs; ++i)
	{
		status = vslDeleteStream(&amp;amp;streams&lt;I&gt;);
		assert(status == 0);
	}

	vslDeleteStream(&amp;amp;baseStream);
}
&lt;/I&gt;&lt;/J&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 03 Jul 2016 14:30:51 GMT</pubDate>
    <dc:creator>roger567</dc:creator>
    <dc:date>2016-07-03T14:30:51Z</dc:date>
    <item>
      <title>Should VSL Leap Frog work with Wichmann Hill?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Should-VSL-Leap-Frog-work-with-Wichmann-Hill/m-p/1116410#M24681</link>
      <description>&lt;P&gt;I tried vslLeapfrogStream and compared the numbers produced with a simple block of randoms.&lt;/P&gt;

&lt;P&gt;This worked for the congruential generators MCG31 and 59, but it did not put the numbers in the right places with WH.&lt;/P&gt;

&lt;P&gt;If it is not supported, I expected a non-zero status from calling the&amp;nbsp;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;vslLeapfrogStream&amp;nbsp;&lt;/SPAN&gt;method, but it was zero.&lt;/P&gt;

&lt;P&gt;My guess is that WH shouldn't be supported and the status is wrong.&lt;/P&gt;

&lt;P&gt;This is what I did...&lt;/P&gt;

&lt;P&gt;the&amp;nbsp;assert(fabs(a - b) &amp;lt; 1e-12); fails, suggesting inconsistent values.&lt;/P&gt;

&lt;P&gt;It works if I change the gen to an MCG near the top.&lt;/P&gt;

&lt;P&gt;This is with compiler version 16.0 x64 in VS2015 / Windows 10.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;int main()
{
	constexpr int nFrogs = 7;
	constexpr int nSims = 101;
	VSLStreamStatePtr streams[nFrogs];

	int gen = VSL_BRNG_WH;
	int seed = 1234567890;

	// Creating first stream
	int status = vslNewStream(&amp;amp;streams[0], gen, seed);
	assert(status == 0);

	// Copy first stream to others
	for (int i = 1; i &amp;lt; nFrogs; ++i)
	{
		status = vslCopyStream(&amp;amp;streams&lt;I&gt;, streams[0]);
		assert(status == 0);
	}

	// Leapfrogging the streams
	for (int i = 0; i &amp;lt; nFrogs; ++i)
	{
		status = vslLeapfrogStream(streams&lt;I&gt;, i, nFrogs);
		assert(status == 0); // Unacceptable generator gives status -1002
	}

	// Generating base case random numbers without leap frog for comparison
	// Same generator and seed
	VSLStreamStatePtr baseStream;
	status = vslNewStream(&amp;amp;baseStream, gen, seed);
	assert(status == 0);
	double y[nSims*nFrogs];
	status = vdRngUniform(VSL_RNG_METHOD_UNIFORM_STD, baseStream, nSims*nFrogs, y, 0.0, 1.0);
	assert(status == 0);

	// Generate randoms for each of the leapfrog streams and compare output
	double x[nSims];
	for (int i = 1; i &amp;lt; nFrogs; ++i)
	{
		status = vdRngUniform(VSL_RNG_METHOD_UNIFORM_STD, streams&lt;I&gt;, nSims, x, 0.0, 1.0);
		assert(status == 0);
		for (int j = 0; j &amp;lt; nSims; ++j)
		{
			double a = x&lt;J&gt;;
			double b = y[j*nFrogs + i];
			assert(fabs(a - b) &amp;lt; 1e-12);
		}

	}

	// Deleting the streams
	for (int i = 1; i &amp;lt; nFrogs; ++i)
	{
		status = vslDeleteStream(&amp;amp;streams&lt;I&gt;);
		assert(status == 0);
	}

	vslDeleteStream(&amp;amp;baseStream);
}
&lt;/I&gt;&lt;/J&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jul 2016 14:30:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Should-VSL-Leap-Frog-work-with-Wichmann-Hill/m-p/1116410#M24681</guid>
      <dc:creator>roger567</dc:creator>
      <dc:date>2016-07-03T14:30:51Z</dc:date>
    </item>
    <item>
      <title>Hi Roger, </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Should-VSL-Leap-Frog-work-with-Wichmann-Hill/m-p/1116411#M24682</link>
      <description>&lt;P&gt;Hi Roger,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;From our documentation, it should support WH. I can reproduce your result. &amp;nbsp;It seems something is wrong. &amp;nbsp;I &amp;nbsp;will ask our developer to investigate it and get back to you later.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Ying&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2016 05:55:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Should-VSL-Leap-Frog-work-with-Wichmann-Hill/m-p/1116411#M24682</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2016-07-05T05:55:50Z</dc:date>
    </item>
  </channel>
</rss>

