topic cblas_cgemm problems when m < k in IntelĀ® oneAPI Math Kernel Library
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-cgemm-problems-when-m-lt-k/m-p/789841#M2151
Hi everybody,<BR />I'm trying to use cblas_cgemm in order to perform the operation C = scale*A*conj(A'). <BR /><BR />Here is the relavent section of code:<BR />assume that m, n, and k are defined with specific values<BR />m = n (because I am doing A*conj(A'))<BR />k is independent of m or n<BR /><BR />vector<MKL_COMPLEX8> A;<BR />A.resize(m,k);<BR />initialize(A); // populate A w/ some values<BR />int scale = some initial value;<BR />MKL_Complex8 mkl_c8_zero; mkl_c8_zero.real = 0; mkl_c8_zero.imag = 0;<BR /><BR />cblas_cgemm(CblasRowMajor, CblasNoTrans, CblasConjTrans, m, n, k, &scale, &A[0], m, &A[0], n, &mkl_c8_zero, &R[0], m);<BR /><BR />I run cblas_cgemm in a loop, with k changing but m & n remaining constant. When m < k, cblas gives an error: "Parameter 9 upon entry to cblas_cgemm incorrect."<BR /><BR />Here is a sample output of the loop, showing the values of m, n, k, lda, and ldb and the errors. If no error is shown, it means that the cblas_cgemm executed properly.<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 7: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 8: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 9: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 10: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 11: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 11: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 10: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 9: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 8: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 7: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR /><BR />I have tried changing the ldb parameter to k, but I get the same errors at the same times...<BR /><BR />Any assistance would be appreciated.<BR /><BR />Thanks,<BR />Kiran</MKL_COMPLEX8>Thu, 03 Mar 2011 16:50:27 GMTkkarra2011-03-03T16:50:27Zcblas_cgemm problems when m < k
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-cgemm-problems-when-m-lt-k/m-p/789841#M2151
Hi everybody,<BR />I'm trying to use cblas_cgemm in order to perform the operation C = scale*A*conj(A'). <BR /><BR />Here is the relavent section of code:<BR />assume that m, n, and k are defined with specific values<BR />m = n (because I am doing A*conj(A'))<BR />k is independent of m or n<BR /><BR />vector<MKL_COMPLEX8> A;<BR />A.resize(m,k);<BR />initialize(A); // populate A w/ some values<BR />int scale = some initial value;<BR />MKL_Complex8 mkl_c8_zero; mkl_c8_zero.real = 0; mkl_c8_zero.imag = 0;<BR /><BR />cblas_cgemm(CblasRowMajor, CblasNoTrans, CblasConjTrans, m, n, k, &scale, &A[0], m, &A[0], n, &mkl_c8_zero, &R[0], m);<BR /><BR />I run cblas_cgemm in a loop, with k changing but m & n remaining constant. When m < k, cblas gives an error: "Parameter 9 upon entry to cblas_cgemm incorrect."<BR /><BR />Here is a sample output of the loop, showing the values of m, n, k, lda, and ldb and the errors. If no error is shown, it means that the cblas_cgemm executed properly.<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 7: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 8: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 9: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 10: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 11: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 12: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 11: lda = 10: ldb = 10<BR /><BR />MKL ERROR: Parameter 9 was incorrect on entry to cblas_cgemm<BR />m = 10: n = 10: k = 10: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 9: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 8: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 7: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR />m = 10: n = 10: k = 6: lda = 10: ldb = 10<BR /><BR />I have tried changing the ldb parameter to k, but I get the same errors at the same times...<BR /><BR />Any assistance would be appreciated.<BR /><BR />Thanks,<BR />Kiran</MKL_COMPLEX8>Thu, 03 Mar 2011 16:50:27 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-cgemm-problems-when-m-lt-k/m-p/789841#M2151kkarra2011-03-03T16:50:27Zcblas_cgemm problems when m < k
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-cgemm-problems-when-m-lt-k/m-p/789842#M2152
See the example cblas_cgemmx.c in the MKL examples\cblas\source directory. In particular, see these lines (around line-100):<BR /><BR /><PRE>[cpp] if( order == CblasRowMajor ) {<BR /> lda=cmaxa;<BR /> ldb=cmaxb;<BR /> ldc=cmaxc;<BR /> } else {<BR /> lda=rmaxa;<BR /> ldb=rmaxb;<BR /> ldc=rmaxc;<BR /> }<BR />[/cpp]</PRE> <BR /><BR />When you use CblasRowMajor order for storing matrices, the arguments ldA, ldB, ldC should be the <SPAN style="text-decoration: underline;">maximum row-lengths</SPAN> of A, B and C, in contrast to the values that would be given if CblasColMajor were used, when they would be the <SPAN style="text-decoration: underline;">maximum column-lengths</SPAN>.<BR /><BR />I think that the MKL documentation should make this requirement clearer, since C/C++ programmers should not be expected to know about the Fortran conventions for storing matrices<BR /><BR />When you post code related to a difficulty that you are trying to overcome, please post complete code that is ready to be fed to the compiler, since it is only then that someone here can reproduce the problem; doing so is often the initial step towards finding a solution.<BR />Fri, 04 Mar 2011 01:45:09 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-cgemm-problems-when-m-lt-k/m-p/789842#M2152mecej42011-03-04T01:45:09Z