Community
cancel
Showing results for 
Search instead for 
Did you mean: 
270 Views

Parameter 7 incorrect for cblas_dgemv

Jump to solution

I have the following code:

	CBLAS_LAYOUT layout = CblasRowMajor;
	CBLAS_TRANSPOSE trans = CblasNoTrans;

	int m = 2;
	int n = 4;
	double a[8] = { 1,2,3,4,5,6,7,8 }; // m * n matrix
	double x[4] = { 1,2,3,4 }; // vector of size n
	double y[2] = { 0,0 }; // vector of size m
	
	double *a_ptr = &a[0];
	double *x_ptr = &x[0];
	double *y_ptr = &y[0];

	cblas_dgemv(layout,	// matrix has row-major layout
		trans,			// should not be transposed
		m,				// has m number of rows
		n,				// n number of columns
		1,				// alpha = 1
		a_ptr,			// pointer to matrix A
		n,				// dimensionality of leading dimension of A (#columns, in this case)
		x_ptr,			// pointer to vector x
		1,				// stride of x
		0,				// beta = 0
		y_ptr,			// pointer to vector y (output will also be placed in y)
		1);				// stride of y

This compiles fine. When running, I get 

Intel MKL ERROR: Parameter 7 was incorrect on entry to cblas_dgemv

Parameter 7 is the lda, which I set to be n, the nr of columns since I use row-major layout. According to the documentation and this post: https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/501513 this should be correct.

So, why is it giving me this error?

Thanks in advance!

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
270 Views

if you want to link with ILP64 interfaces, then please don't forget to add /DMKL_ILP64 compiler option. Pls refer to the User's Guide for more details.

View solution in original post

8 Replies
mecej4
Black Belt
270 Views

Please provide details of how you compiled and linked the program -- OS, target 32 or 64 bit, compiler options, how MKL was linked into, etc.

Dennis_F_2
Beginner
270 Views

Hi Mecej,

Answering for Matthijs S, the platform is Windows 7 using MSVC 2015 (19.00.23918) in x64 release mode. Statically linked.

TimP
Black Belt
270 Views

One of the questions implied by Sham is whether you might have linked the ilp64 MKL libraries (which require int64_t), seeing that your code uses 32-bit integer arguments.  The question would be answered by showing your build log.

270 Views

Thanks. We're indeed linking to ilp64. Here are relevant CMake lines:

find_library(mkl_intel_ilp64 "mkl_intel_ilp64.lib" PATHS "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64")
find_library(mkl_core "mkl_core.lib" PATHS "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64")
find_library(mkl_sequential "mkl_sequential.lib" PATHS "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64")

target_link_libraries(our_lib ${mkl_intel_ilp64})
target_link_libraries(our_lib ${mkl_core})
target_link_libraries(our_lib ${mkl_sequential})

Based on your comment, I changed line 4 and 5 in the code from the first post to int64_t. Still the same error.

EDIT: we're currently building in Debug mode. Not sure whether that's relevant.

TimP
Black Belt
270 Views

Sorry, I meant to point out that for plain int arguments you would link the lp64 libraries, which are the ones you get with the -Qmkl options.

270 Views

Sorry, not sure I follow:

  1. "you would link the lp64 libraries." Do you agree that we're linking to these libraries with the above CMake lines, or is that not sufficient?
  2. "For plain int arguments". I used plain int arguments in my original code, with the same CMake setup -- i.e. linking to ilp64, unless point 1 is incorrect. This didn't work. Then I switched to int64_t, which also did not work.

So -- if the CMake setup should indeed be sufficient for linking to the ilp64 libraries -- I'm not sure what to do differently.

Gennady_F_Intel
Moderator
271 Views

if you want to link with ILP64 interfaces, then please don't forget to add /DMKL_ILP64 compiler option. Pls refer to the User's Guide for more details.

View solution in original post

270 Views

Thanks Gennady, that works!

Reply