<?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 Libraries containing &amp;quot;ILP64&amp;quot; in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100607#M23864</link>
    <description>&lt;P&gt;Libraries containing "ILP64" are for using with programs that call MKL routines with 64-bit integer arguments; for the more common 32-bit integer arguments, use libraries whose names contain "LP64", not "ILP64". It is definitely unusual (most probably, an error) to use both ILP64 and LP64 libraries in the same link step.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jan 2016 19:10:00 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2016-01-25T19:10:00Z</dc:date>
    <item>
      <title>Parameter 5 was incorrect on entry to cblas_dgemm when running Intel example</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100604#M23861</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have attempted compiling and running the example&amp;nbsp;"Multiplying Matrices Using dgemm" in the online MKL tutorial; the URL is&amp;nbsp;https://software.intel.com/en-us/node/529735. &amp;nbsp;I am using Visual C++ in Visual Studio 2013.&lt;/P&gt;

&lt;P&gt;The code will compile successfully in debug mode, but at runtime, the&amp;nbsp;cblas_dgemm(.) function call fails with the following message output to the screen:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;"Intel MKL ERROR: Parameter 5 was incorrect on entry to cblas_dgemm."&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Parameter 5 is the integer input k, representing the number of columns in the A matrix, and the number of rows in the B matrix.&lt;/P&gt;

&lt;P&gt;I also attempted a simpler example, with a 2 x 3 matrix for A, and a 3 x 2 matrix for B, but the same error occurs (k = 3 here). &amp;nbsp;&lt;/P&gt;

&lt;P&gt;The code is as follows:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;/*	C source code is a simplified case based on Intel's dgemm_example.c:
	"Multiplying Matrices Using dgemm"
	See &lt;A href="https://software.intel.com/en-us/node/529735" target="_blank"&gt;https://software.intel.com/en-us/node/529735&lt;/A&gt;
	In this simplified case, we attempt multiplication of a 2 x 3 matrix by
	a 3 x 2 matrix.  (m = 2, k = 3, n = 2; A(m x k) * B(k x n) = C(m x n))
*/

#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include "mkl.h"

int main()
{
	double *A, *B, *C;
	int i, j;
	int m = 2, k = 3, n = 2;
	double alpha = 1.0;
	double beta = 0.0;

	printf(" Allocating memory for matrices aligned on 64-byte boundary for better \n"
		" performance \n\n");
	A = (double *)mkl_malloc(m*k*sizeof(double), 64);
	B = (double *)mkl_malloc(k*n*sizeof(double), 64);
	C = (double *)mkl_malloc(m*n*sizeof(double), 64);
	if (A == NULL || B == NULL || C == NULL) {
		printf("\n ERROR: Can't allocate memory for matrices. Aborting... \n\n");
		mkl_free(A);
		mkl_free(B);
		mkl_free(C);
		return 1;
	}

	printf(" Intializing matrix data \n\n");
	A[0] = 11;
	A[1] = 12;
	A[2] = 13;
	A[3] = 21;
	A[4] = 22;
	A[5] = 23;

	B[0] = 1011;
	B[1] = 1012;
	B[2] = 1021;
	B[3] = 1022;
	B[4] = 1031;
	B[5] = 1032;

	C[0] = 0.0;
	C[1] = 0.0;
	C[2] = 0.0;
	C[3] = 0.0;

	printf(" Top left corner of matrix A before cblas_dgemm call: \n");
	for (i = 0; i&amp;lt; m; i++) {
		for (j = 0; j &amp;lt; k; j++) {
			printf("%12.0f", A[j + i*k]);
		}
		printf("\n");
	}

	printf("\n Top left corner of matrix B before cblas_dgemm call: \n");
	for (i = 0; i&amp;lt; k; i++) {
		for (j = 0; j &amp;lt; n; j++) {
			printf("%12.0f", B[j + i*n]);
		}
		printf("\n");
	}

	printf("\n Top left corner of matrix C before cblas_dgemm call: \n");
	for (i = 0; i&amp;lt; m; i++) {
		for (j = 0; j &amp;lt; n; j++) {
			printf("%12.5G", C[j + i*n]);
		}
		printf("\n");
	}

	printf(" Computing matrix product using Intel(R) MKL dgemm function via CBLAS interface \n\n");
	cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
		m, n, k, alpha, A, k, B, n, beta, C, n);		
        // Error output to console here: 
        // "Intel MKL ERROR: Parameter 5 was incorrect on entry to cblas_dgemm."

	printf("\n Deallocating memory \n\n");
	mkl_free(A);
	mkl_free(B);
	mkl_free(C);

	printf(" Example completed, with runtime error. \n\n");	

	return 0;
}&lt;/PRE&gt;

&lt;P&gt;This error seems very curious since a) it occurs with actual sample code in the tutorial, and b) is simply an integer matrix dimension.&lt;/P&gt;

&lt;P&gt;In addition, I also discovered that if I chose the following for elements of the matrix A:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;A[0] = 0.11;
A[1] = 0.12;
A[2] = 0.13;
A[3] = 0.21;
A[4] = 0.22;
A[5] = 0.23;&lt;/PRE&gt;

&lt;P&gt;The values all get truncated to zero, despite the A array being defined as containing double types.&lt;/P&gt;

&lt;P&gt;If anyone could help me figure out what is wrong above, particularly why the "Parameter 5" error is occurring, I would greatly appreciate it.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 22:32:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100604#M23861</guid>
      <dc:creator>Daniel_H_4</dc:creator>
      <dc:date>2016-01-22T22:32:18Z</dc:date>
    </item>
    <item>
      <title>Hi Daniel,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100605#M23862</link>
      <description>&lt;P&gt;Hi Daniel,&lt;/P&gt;

&lt;P&gt;We do not see this error on our side. Could you please provide the following information:&lt;/P&gt;

&lt;P&gt;* Compiler used for building the sample&lt;/P&gt;

&lt;P&gt;* Your MKL link line&lt;/P&gt;

&lt;P&gt;* IA32 or Intel64&lt;/P&gt;

&lt;P&gt;Regarding to 0&amp;nbsp;truncation of the A matrix, please try the following change at line #56:&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Courier New"&gt;printf&lt;CODE class="cpp plain"&gt;(&lt;/CODE&gt;&lt;CODE class="cpp string"&gt;"%12.3f"&lt;/CODE&gt;&lt;CODE class="cpp plain"&gt;, A[j + i*k]);&lt;/CODE&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;Efe&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2016 01:57:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100605#M23862</guid>
      <dc:creator>Murat_G_Intel</dc:creator>
      <dc:date>2016-01-23T01:57:40Z</dc:date>
    </item>
    <item>
      <title>Thanks Efe,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100606#M23863</link>
      <description>&lt;P&gt;Thanks Efe,&lt;/P&gt;

&lt;P&gt;Here is the info I can provide:&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;* Compiler used for building the sample: &amp;nbsp;Visual C++ 2013&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;* IA32 or Intel64: Intel64&lt;/SPAN&gt;&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;* Your MKL link line: &amp;nbsp;Not sure what to provide here, except that in the VC++ properties, I have&amp;nbsp;&lt;SPAN style="line-height: 1.5;"&gt;C:\Intel\MKL\include set in "Include Directories",&amp;nbsp;&lt;/SPAN&gt;C:\Intel\MKL\em64t\lib&amp;nbsp;set in "Library Directories", and the following libraries set explicitly under "Library Dependencies" in the Linker settings:&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;libiomp5md.lib&lt;BR /&gt;
	mkl_core.lib&lt;BR /&gt;
	mkl_intel_ilp64.lib&lt;BR /&gt;
	mkl_intel_lp64.lib&lt;BR /&gt;
	mkl_intel_thread.lib&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;In order to get my code to compile, I found that I needed to physically place&amp;nbsp;libiomp5md.dll in the .../x64/debug directory (also did this for the release directory, but in the case where I compile in Release mode, the error is not noted in the output, even though the results are still wrong).&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;Hope this helps solve the problem. &amp;nbsp;I have had runtime errors with other sample code as well, but I'm hoping that by working through this one, it may be a configuration issue or something that fixes the other errors too.&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;As for the screen output, yes, if I put in "f", that should help. &amp;nbsp;I typically work in C++ and just use cout without formatting, so I missed that -- thanks.&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;Thanks again,&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;Dan&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 08:41:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100606#M23863</guid>
      <dc:creator>Daniel_H_4</dc:creator>
      <dc:date>2016-01-25T08:41:13Z</dc:date>
    </item>
    <item>
      <title>Libraries containing "ILP64"</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100607#M23864</link>
      <description>&lt;P&gt;Libraries containing "ILP64" are for using with programs that call MKL routines with 64-bit integer arguments; for the more common 32-bit integer arguments, use libraries whose names contain "LP64", not "ILP64". It is definitely unusual (most probably, an error) to use both ILP64 and LP64 libraries in the same link step.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 19:10:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100607#M23864</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2016-01-25T19:10:00Z</dc:date>
    </item>
    <item>
      <title>Thanks -- will give this a</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100608#M23865</link>
      <description>&lt;P&gt;Thanks -- will give this a try.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 19:24:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100608#M23865</guid>
      <dc:creator>Daniel_H_4</dc:creator>
      <dc:date>2016-01-25T19:24:33Z</dc:date>
    </item>
    <item>
      <title>By excluding the ILP64</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100609#M23866</link>
      <description>&lt;P&gt;By excluding the ILP64 library from the project settings, it seems to work now -- thanks very much!! &amp;nbsp;Will also give the other code examples another try now too. &amp;nbsp;I suspect the problems encountered in those cases should now be solved as well.&lt;/P&gt;

&lt;P&gt;-Dan&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2016 17:58:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100609#M23866</guid>
      <dc:creator>Daniel_H_4</dc:creator>
      <dc:date>2016-01-26T17:58:29Z</dc:date>
    </item>
    <item>
      <title>Hi Dan, </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100610#M23867</link>
      <description>&lt;P&gt;Hi Dan,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks for letting us know. Just add some notes for your reference.&lt;/P&gt;

&lt;P&gt;1) &lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;online MKL tutorial :&amp;nbsp;&lt;/SPAN&gt; &amp;nbsp;https://software.intel.com/en-us/mkl-tutorial-for-c&lt;/P&gt;

&lt;P&gt;if intel compiler, it may simple compile as below&amp;nbsp;&lt;/P&gt;

&lt;UL id="GUID-FBE2C433-E6DD-4A04-A9F4-E81895B3E4AA"&gt;
	&lt;LI id="LI_A345509FD8A34056AB23F59381598935"&gt;&lt;A name="LI_A345509FD8A34056AB23F59381598935"&gt;&lt;!-- --&gt;&lt;/A&gt;Windows* OS: &lt;SAMP class="codeph"&gt;icl /Qmkl dgemm_example.c&lt;/SAMP&gt;&lt;/LI&gt;
	&lt;LI id="LI_32E80C2D03B546578B5FDAA9E49683EE"&gt;&lt;A name="LI_32E80C2D03B546578B5FDAA9E49683EE"&gt;&lt;!-- --&gt;&lt;/A&gt;Linux* OS, OS X*: &lt;SAMP class="codeph"&gt;icc -mkl dgemm_example.c&lt;/SAMP&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;if with other compiler including Microsoft Visual studio, &amp;nbsp;please use the Intel MKL Link Line Advisor to generate a command line to compile and link the exercises in this tutorial: &lt;A href="http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/" target="_blank"&gt;http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;In general, it is&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;mkl_intel_lp64.lib&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;mkl_intel_thread.lib&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;mkl_core.lib&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;libiomp5md.lib&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;2) ILP64 vs LP64.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;In general, we use LP64.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;UL id="GUID-446BAB7B-D10C-4D7D-BD9D-8DC6AD97FE83"&gt;
	&lt;LI&gt;
		&lt;P&gt;The ILP64 interface&lt;/P&gt;

		&lt;P&gt;It was used when in increased memory and also some legacy code requires 64-bit integers. Read more about the ILP64 interface and the libraries and functions supporting it in the &lt;EM&gt;Intel MKL User's Guide&lt;/EM&gt;&lt;/P&gt;
	&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;3) about the libiomp5md.dll , it is Intel OpenMP multithread Run time library, was required when using threaded mkl library. &amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;Right, you can&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;physically place&amp;nbsp;libiomp5md.dll in the .../x64/debug directory.&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;But generally&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;&amp;nbsp;when install mkl, all of the environment variable should be added in system environment, we don't need to do this.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;To make all of required DLL ‘visible’ for the Microsoft .NET CLR and exe. There are some ways to do these,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;we usually add &amp;lt;paths_to_libs&amp;gt; to the system (or may be user) environment variable ‘path’&lt;/P&gt;

&lt;P&gt;&amp;gt;&amp;gt;computer, right click&amp;gt;&amp;gt; open computer's properties page (Control Panel\System and Security\System) &amp;nbsp;=&amp;gt;Advanced System Setting =&amp;gt; Advanced =&amp;gt;Environment Variables =&amp;gt; path&lt;/P&gt;

&lt;P&gt;add&amp;nbsp;&lt;/P&gt;

&lt;P&gt;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\intel64_win\mkl;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\intel64_win\compiler:.........&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;/P&gt;

&lt;P&gt;Ying&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 01:27:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Parameter-5-was-incorrect-on-entry-to-cblas-dgemm-when-running/m-p/1100610#M23867</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2016-01-27T01:27:41Z</dc:date>
    </item>
  </channel>
</rss>

