Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

MKL ERROR

sugarpie
Beginner
1,756 Views
Hello, when I compile and run the following code:

"
#include "stdafx.h"
#include "mkl_blas.h"
#include "mkl_cblas.h"
#include "mkl_types.h"


int _tmain(int argc, char *argv[])
{

MKL_INT m = 2, n = 4, k = 3;
MKL_INT lda = k, ldb = n, ldc = n;
float alpha = 1, beta = 1;
float *a = new float[6], *b = new float[12], *c = new float[8];
CBLAS_ORDER order = CblasRowMajor;
CBLAS_TRANSPOSE transA = CblasNoTrans, transB = CblasNoTrans;

a[0] = 1;
a[1] = 2;
a[2] = 3;
a[3] = 4;
a[4] = 5;
a[5] = 6;


b[0] = 0;
b[1] = 1;
b[2] = 0;
b[3] = 1;
b[4] = 1;
b[5] = 0;
b[6] = 0;
b[7] = 1;
b[8] = 1;
b[9] = 0;
b[10] = 1;
b[11] = 0;

c[0] = 0;
c[1] = 0;
c[2] = 0;
c[3] = 0;
c[4] = 0;
c[5] = 0;
c[6] = 0;
c[7] = 0;

printf("\n C B L A S _ S G E M M EXAMPLE PROGRAM\n");


printf("\n INPUT DATA");
printf("\n M=%d N=%d K=%d", m, n, k);
printf("\n ALPHA=%5.1f BETA=%5.1f", alpha, beta);

/* Call SGEMM subroutine ( C Interface ) */

cblas_sgemm(order, transA, transB, m, n, k, alpha,
a, lda, b, ldb, beta, c, ldc);

/* Print output data */

printf("\n\n OUTPUT DATA");


return 0;
}
"

I receive the following output:

C B L A S _ S G E M M EXAMPLE PROGRAM

INPUT DATA
M=2 N=4 K=3
ALPHA= 1.0 BETA= 1.0MKL ERROR: Parameter 5 was incorrect on entry to c
blas_sgemm


OUTPUT DATA

I've tried to change the parameters value, but as far as I can see,there is no problem with parameter 5 (N), or is there?

Thanks!
0 Kudos
1 Solution
Gennady_F_Intel
Moderator
1,756 Views

Ok, I used the same MKL's version, but MSVC 2005.
Please open the project property pages and modify: LinkerInputAdditional Dependencies: "mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib"
--Gennady

View solution in original post

0 Kudos
8 Replies
Gennady_F_Intel
Moderator
1,756 Views

Hello,

But I was not able to reproduce the problem you reported.

Below the output I ve got:

C B L A S _ S G E M M EXAMPLE PROGRAM

INPUT DATA

M=2 N=4 K=3

ALPHA= 1.0 BETA= 1.0

OUTPUT DATA

Press any key to continue . . .

I used MKL version 10.1

VS2005

Can you provide more details about your environment for reproducing the problem?

-- MKL version

-- linking dependencies

-- MSVC version

Regards,Gennady

0 Kudos
sugarpie
Beginner
1,756 Views

Hello,

But I was not able to reproduce the problem you reported.

Below the output I ve got:

C B L A S _ S G E M M EXAMPLE PROGRAM

INPUT DATA

M=2 N=4 K=3

ALPHA= 1.0 BETA= 1.0

OUTPUT DATA

Press any key to continue . . .

I used MKL version 10.1

VS2005

Can you provide more details about your environment for reproducing the problem?

-- MKL version

-- linking dependencies

-- MSVC version

Regards,Gennady


MKL version: 10.1.0.018

Linking dependencies: libguide.lib libguide40.lib libiomp5md.lib libiomp5mt.lib mkl_blacs_ilp64_dll.lib mkl_blacs_intelmpi_ilp64.lib mkl_blacs_intelmpi_lp64.lib mkl_blacs_lp64_dll.lib mkl_blacs_mpich2_ilp64.lib mkl_blacs_mpich2_lp64.lib mkl_blacs_msmpi_ilp64.lib mkl_blacs_msmpi_lp64.lib mkl_cdft.lib mkl_cdft_core.lib mkl_cdft_core_dll.lib mkl_cdft_dll.lib mkl_core.lib mkl_core_dll.lib mkl_dll.lib mkl_em64t.lib mkl_intel_ilp64.lib mkl_intel_ilp64_dll.lib mkl_intel_lp64.lib mkl_intel_lp64_dll.lib mkl_intel_thread.lib mkl_intel_thread_dll.lib mkl_lapack.lib mkl_pgi_thread.lib mkl_pgi_thread_dll.lib mkl_scalapack.lib mkl_scalapack_dll.lib mkl_scalapack_ilp64.lib mkl_scalapack_ilp64_dll.lib mkl_scalapack_lp64.lib mkl_scalapack_lp64_dll.lib mkl_sequential.lib mkl_sequential_dll.lib mkl_solver.lib mkl_solver_ilp64.lib mkl_solver_ilp64_sequential.lib mkl_solver_lp64.lib mkl_solver_lp64_sequential.lib

(I wasnt sure on which to use so I took em all:s)

MSVC: 2008
0 Kudos
Gennady_F_Intel
Moderator
1,757 Views

Ok, I used the same MKL's version, but MSVC 2005.
Please open the project property pages and modify: LinkerInputAdditional Dependencies: "mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib"
--Gennady

0 Kudos
sugarpie
Beginner
1,756 Views

Ok, I used the same MKL's version, but MSVC 2005.
Please open the project property pages and modify: LinkerInputAdditional Dependencies: "mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib"
--Gennady


I used "mkl_em64t.lib libiomp5mt.lib" instead (compiling for x64) which solved the problem. Thanks allot for the help! Do you know the reason why I got that weird error message?
0 Kudos
Gennady_F_Intel
Moderator
1,756 Views

I believe that the reason is your linking dependencies are not correct.

We recommend the following libraries for linking cblas routines:

mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

[ for more info ( including some examples ) about that, please see userguide manual. ]

Please try to use this linking dependencies and let us know the result.

--Gennady

0 Kudos
Gennady_F_Intel
Moderator
1,756 Views

I believe that the reason is your linking dependencies are not correct.

We recommend the following libraries for linking cblas routines:

mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

[ for more info ( including some examples ) about that, please see userguide manual. ]

Please try to use this linking dependencies and let us know the result.

--Gennady

0 Kudos
joey_hylton
Beginner
1,756 Views

I believe that the reason is your linking dependencies are not correct.

We recommend the following libraries for linking cblas routines:

mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

[ for more info ( including some examples ) about that, please see userguide manual. ]

Please try to use this linking dependencies and let us know the result.

--Gennady

Gennady,

My problem is in Linux cluster by trying to use sequential libraries. However, we always got something un-expected. I sucessfully linked the program by using the following link. But When I tested the code, it is still using multiple threads.

MKLLIBSEM64 = -lmkl_solver_lp64_sequential.a -lmkl_sequential.a -lmkl_intel_thread.a -lmkl_core.a -llibiomp5md -lguide -lmkl_em64t


BTW: we have to use static library for the cluster, and the original thread of my question are here.



0 Kudos
TimP
Honored Contributor III
1,756 Views
Quoting - joey_hylton
MKLLIBSEM64 = -lmkl_solver_lp64_sequential.a -lmkl_sequential.a -lmkl_intel_thread.a -lmkl_core.a -llibiomp5md -lguide -lmkl_em64t

You're asking for trouble when you attempt to link partially the static sequential stubs, the "legacy" OpenMP dynamic, and the "compatibility" OpenMP dynamic all together, and an old dynamic MKL along with partial linking of current static mkl. Our point about dynamic vs static is you won't be able to get the latter right without following the release notes, and any bad stuff you do in the dynamic link will get worse in the static.
0 Kudos
Reply