<?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 Hi Henrik, in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dcsrmm-is-throwing-integer-division-by-zero-after-upgrading-to/m-p/1048622#M21047</link>
    <description>&lt;P&gt;Hi Henrik,&lt;/P&gt;

&lt;P&gt;&amp;nbsp; This is to inform you that the fix for this issue is available in our recently release 11.3 beta update 1 and 11.2.3 MKL releases.&lt;/P&gt;

&lt;P&gt;Vipin&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jun 2015 08:27:10 GMT</pubDate>
    <dc:creator>VipinKumar_E_Intel</dc:creator>
    <dc:date>2015-06-23T08:27:10Z</dc:date>
    <item>
      <title>dcsrmm is throwing 'integer division by zero' after upgrading to 11.0 update 5</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dcsrmm-is-throwing-integer-division-by-zero-after-upgrading-to/m-p/1048620#M21045</link>
      <description>&lt;P&gt;After updating the installed MKL version when attempting to avoid another bug we discovered, previously working code has started throwing division by zero errors after sparse matrices exceed a certain nonzero count. (Again using parallel 64bit MKL)&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;Unhandled exception at 0x000007FEDEC0DB3D (mkl_avx.dll) in TestSparseMultiply.exe: 0xC0000094: Integer division by zero.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Callstack:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mkl_avx.dll!000007fedec0db3d()&amp;nbsp;&amp;nbsp; &amp;nbsp;Unknown&lt;BR /&gt;
		&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;mkl_intel_thread.dll!000007fee0549de3()&amp;nbsp;&amp;nbsp; &amp;nbsp;Unknown&lt;/P&gt;

	&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;mkl_intel_thread.dll!000007fee02d5037()&amp;nbsp;&amp;nbsp; &amp;nbsp;Unknown&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Repro case:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;mkl.h&amp;gt;



int _tmain(int argc, _TCHAR* argv[])
{
	const size_t sparseMatrixWidth = 6045696;
	const size_t sparseMatrixHeight = 200;
	const size_t sparseMatrixUsage = 1000000 / 2; // &amp;lt;= this should crash
//	const size_t sparseMatrixUsage = 1000000 / 3; // &amp;lt;= This still works

	double *sparseMatrixData = new double[sparseMatrixUsage * sparseMatrixHeight];
	::memset(sparseMatrixData, 0, sizeof(double) * sparseMatrixUsage * sparseMatrixHeight);

	MKL_INT *colIndices = new MKL_INT[sparseMatrixUsage * sparseMatrixHeight];
	::memset(colIndices, 0, sizeof(MKL_INT) * sparseMatrixUsage * sparseMatrixHeight);

	MKL_INT *rowOffsets = new MKL_INT[sparseMatrixHeight + 1];
	::memset(colIndices, 0, sizeof(MKL_INT) * (sparseMatrixHeight + 1));

	::srand(42);
	rowOffsets[0] = 0 + 1; // 1 based
	for (unsigned long y=0;y&amp;lt;sparseMatrixHeight;++y)
	{
		MKL_INT lastIndex = 0;
		for (unsigned long x=0;x&amp;lt;sparseMatrixUsage;++x)
		{
			//	Jump forward a random amount, ensuring even if we hit the maximum jump everytime we do not exceed the matrix limits
			int jump = rand() % (sparseMatrixWidth / sparseMatrixUsage - 1);

			lastIndex = lastIndex + 1 + jump; // Ensure we jump forward at least 1 column
			sparseMatrixData[x + y*sparseMatrixUsage] = 1.0;
			colIndices[x + y*sparseMatrixUsage] = lastIndex + 1; // 1 based
		}
		rowOffsets[y + 1] = sparseMatrixUsage * (y + 1) + 1; // 1 based
	}


	//	Doublecheck: Verify sparse matrix properties
	for (unsigned long y=0;y&amp;lt;sparseMatrixHeight;++y)
	{
		//	Since we are using one based matrices, nothing is allowed to be zero
		if (rowOffsets&lt;Y&gt; == 0)
			return -1;
		//	Row data must be ordered in memory
		if (rowOffsets[y + 1]&amp;lt; rowOffsets&lt;Y&gt;)
			return -1;
		//	If rows are not empty ...
		if (rowOffsets&lt;Y&gt; != rowOffsets[y + 1])
		{
			// ... make sure column indices are one based and do not exceed the matrix size
			for (unsigned long i = rowOffsets&lt;Y&gt;;i &amp;lt; rowOffsets[y + 1];++i)
			{
				if (colIndices[i - 1] &amp;lt;= 0)
					return -1;
				if (colIndices[i - 1] &amp;gt;= sparseMatrixWidth)
					return -1;
			}

			//	... make sure column indices are in ascending order
			for (unsigned long i = rowOffsets&lt;Y&gt;;i &amp;lt; rowOffsets[y + 1] - 1;++i)
			{
				if (colIndices[i - 1 + 1] &amp;lt;= colIndices[i - 1])
					return -1;
			}
		}
	}

	//	Calculate matrix average by multiplying with a vector containing ones and scaling by the inverse vector length
	const size_t rightVectorLength = sparseMatrixWidth;
	double *vectorData = new double[rightVectorLength];
	for (unsigned long x=0;x&amp;lt;rightVectorLength;++x)
	{
		vectorData&lt;X&gt; = 1.0;
	}

	//	Store the result in this vector
	const size_t resultVectorLength = sparseMatrixHeight;
	double *resultData = new double[resultVectorLength];
	

	char matdescra[6] = {'g', 'l', 'n', 'f', 'x', 'x'};
	/* &lt;A href="https://software.intel.com/sites/products/documentation/doclib/iss/2013/mkl/mklman/GUID-34C8DB79-0139-46E0-8B53-99F3BEE7B2D4.htm#TBL2-6" target="_blank"&gt;https://software.intel.com/sites/products/documentation/doclib/iss/2013/mkl/mklman/GUID-34C8DB79-0139-46E0-8B53-99F3BEE7B2D4.htm#TBL2-6&lt;/A&gt;
	G: General. D: Diagonal
	L/U Lower/Upper triangular (ignored with G)
	N: non-unit diagonal (ignored with G)
	C: zero-based indexing. / F: one-based indexing
	*/

	MKL_INT strideA = static_cast&amp;lt;MKL_INT&amp;gt;(rightVectorLength);

	char transposeAtxt = 'N';
	MKL_INT numRowsA = static_cast&amp;lt;MKL_INT&amp;gt;(sparseMatrixHeight),
			numDestCols = static_cast&amp;lt;MKL_INT&amp;gt;(1),
			numColsA = static_cast&amp;lt;MKL_INT&amp;gt;(sparseMatrixWidth);

	double tempAlpha = 1.0 / sparseMatrixWidth;
	double tempBeta = 0.0;
	MKL_INT resultStride = static_cast&amp;lt;MKL_INT&amp;gt;(resultVectorLength);

	::mkl_dcsrmm(	&amp;amp;transposeAtxt,
					&amp;amp;numRowsA,
					&amp;amp;numDestCols,
					&amp;amp;numColsA,
					&amp;amp;tempAlpha,
					matdescra,
					sparseMatrixData,
					colIndices,
					rowOffsets,
					rowOffsets + 1,
					vectorData, &amp;amp;strideA,
					&amp;amp;tempBeta,
					resultData, &amp;amp;resultStride );


	return 0;
}

&lt;/X&gt;&lt;/Y&gt;&lt;/Y&gt;&lt;/Y&gt;&lt;/Y&gt;&lt;/Y&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2015 14:53:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dcsrmm-is-throwing-integer-division-by-zero-after-upgrading-to/m-p/1048620#M21045</guid>
      <dc:creator>Henrik_A_</dc:creator>
      <dc:date>2015-01-12T14:53:22Z</dc:date>
    </item>
    <item>
      <title>Henrik,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dcsrmm-is-throwing-integer-division-by-zero-after-upgrading-to/m-p/1048621#M21046</link>
      <description>&lt;P&gt;Henrik,&lt;/P&gt;

&lt;P&gt;&amp;nbsp; I can reproduce the crash in MKL 11.2 as well with this testcase. Let's investigate it further.&lt;/P&gt;

&lt;P&gt;--Vipin&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2015 08:57:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dcsrmm-is-throwing-integer-division-by-zero-after-upgrading-to/m-p/1048621#M21046</guid>
      <dc:creator>VipinKumar_E_Intel</dc:creator>
      <dc:date>2015-01-14T08:57:41Z</dc:date>
    </item>
    <item>
      <title>Hi Henrik,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dcsrmm-is-throwing-integer-division-by-zero-after-upgrading-to/m-p/1048622#M21047</link>
      <description>&lt;P&gt;Hi Henrik,&lt;/P&gt;

&lt;P&gt;&amp;nbsp; This is to inform you that the fix for this issue is available in our recently release 11.3 beta update 1 and 11.2.3 MKL releases.&lt;/P&gt;

&lt;P&gt;Vipin&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2015 08:27:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dcsrmm-is-throwing-integer-division-by-zero-after-upgrading-to/m-p/1048622#M21047</guid>
      <dc:creator>VipinKumar_E_Intel</dc:creator>
      <dc:date>2015-06-23T08:27:10Z</dc:date>
    </item>
  </channel>
</rss>

