- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mecej,
Answering for Matthijs S, the platform is Windows 7 using MSVC 2015 (19.00.23918) in x64 release mode. Statically linked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, not sure I follow:
- "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?
- "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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Gennady, that works!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page