Recent posts
https://software.intel.com/en-us/recent/404581
enDeal with huge matrix
https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/671380
<p>I have written some codes with MKL library, but recently these codes do not work. They can be complied well and do not report any error when I run it. However, they did not work for some huge matrix operations. They keep running, but no results return. Here is an example code. When the variable nID exceed 31, the program will keep running forever.</p>
<p>#include <stdio.h></p>
<p>#include <mkl.h></p>
<p>int main(){</p>
<p>int nID=31;</p>
<p>int nSNP=33;</p>
<p>double *mMatrix = (double*) calloc(nID*nSNP,sizeof(double));</p>
<p>double *AGmatrix = (double*) calloc(nID*nID,sizeof(double));</p>
<p> const CBLAS_LAYOUT Layout=CblasRowMajor;</p>
<p> double alpha=1;</p>
<p> double beta=0;</p>
<p> cblas_dgemm (Layout, CblasTrans, CblasNoTrans, nID, nID, nSNP, alpha, mMatrix, </p>
<p>nID, mMatrix, nID, beta, AGmatrix, nID);</p>
<p>} </p>
Tue, 26 Jul 16 01:38:15 -0700chao n.671380Eigen+MKL vs. MKL-Only
https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/670435
<p>Currently, I have a code that uses Eigen (a C++ template library for linear algebra) to save a square general dense matrix in the following way</p>
<ul>
<li>ZMatrix = new Eigen::MatrixXcd;</li>
<li>(*ZMatrix).resize(N_line,N_line);</li>
</ul>
<p>And subsequently solve the resulting linear system of equations using Eigen as follow:</p>
<ul>
<li>Eigen::PartialPivLU<Eigen::MatrixXcd> ZMatrixLU(*ZMatrix);</li>
<li>(*Solution) = ZMatrixLU.solve(*RHS);</li>
</ul>
<p>I recently compiled the Eigen library based on MKL by defining EIGEN_USE_MKL_ALL. This works fine but I am wondering what would happen if I completely get rid of Eigen and do the following instead</p>
<ul>
<li>MKL_INT m=N_line;</li>
<li>MKL_Complex16 *ZMatrix;</li>
<li>const int allignment = 64;</li>
<li>ZMatrix = (MKL_Complex16 *)mkl_malloc( m*m*sizeof( MKL_Complex16 ), allignment);</li>
</ul>
<p>And this time use MKL functions to solve the resulting linear system of equations. Now I have the following questions:</p>
<ol>
<li>By saving the dense matrix ZMatrix, in MKL's way (the second technique), is it possible to save memory?</li>
<li>By using MKL's functions instead of Eigen, is it possible to make the operations faster?</li>
<li>If answer to any or both of the above questions are yes, what is the best way of defining a dense matrix and solving the resulting system using MKL? Is there a tutorial code that I can follow to make sure that I am doing everything in its best possible way in terms of both memory and speed.</li>
</ol>
<p>Please note that the size of the dense matrix can range from (1000x1000) to (20,000x20,000).</p>
<p> </p>
Fri, 22 Jul 16 08:43:18 -0700Mohammad S.670435Fortran PDGETRF + PDGETRI for Matrix Inversion - parameter with an illegal value
https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/670383
<p>Hi everyone,</p>
<p>This is the first time that I am using libraries. I need to calculate the inverse matrix of a square matrix. I found the routine PDGETRF + PDGETRI from ScaLAPACK in the MKL documentation that can solve my problem, but I'm in trouble to compile this routines. </p>
<p>Can anyone help me?</p>
<p>The code I am trying to compile is:</p>
<pre class="brush:fortran;"> program Invtest
implicit none
! Variables
integer :: i, j, info, lwork, liwork
integer, parameter :: dlen_ = 9, ia = 1, ja = 1, m=3, n=3
real(kind = 8), dimension(m,n) :: A, Ainv, Mf, LU
integer, dimension(size(A,1)) :: ipiv
integer, dimension(dlen_) :: desca
real(kind = 8), dimension(size(A,1)) :: work, iwork
external PDGETRF, PDGETRI
! Body of Invtest
A = reshape(source = (/1, 1, 1, 0, 3, 2, 0, 1, 0/), shape = (/3, 3/))
do i=1,m
print *, (A(i,j), j=1,n)
end do
info = 0
lwork = size(A,1)
work = 0
liwork = size(A,1)
iwork = 0
! PDGETRF computes an LU factorization of a general M-by-N distributed matrix.
LU = A
call pdgetrf(n, n, LU, ia, ja, desca, ipiv, info)
! PDGETRI computes the inverse of a matrix using the LU factorization computed by PDGETRF.
Ainv = LU
call pdgetri(n, Ainv, ia, ja, desca, ipiv, work, lwork, iwork, liwork, info)
! Computation of A^{-1} * A to check the inverse
Mf = matmul(Ainv,A)
print*,"Mf = "
do i=1,m
print*,Mf(i,:)
end do
pause
end program Invtest</pre><p>When I compile this code I get the following error message:</p>
<pre class="brush:bash;">{ -1, -1}: On entry to
PDGETRF parameter number 602 had an illegal value
{ -1, -1}: On entry to
PDGETRI parameter number 502 had an illegal value</pre><p>The university computer that I am using has installed Microsoft Visual Studio Professional 2013 Update 3, Intel Parallel Studio XE 2016 Update 2 Cluster Edition for Windows with Intel Math Kernel Library 11.3.</p>
<p>Thanks for the attention.</p>
Thu, 21 Jul 16 19:25:16 -0700Jeferson Vanderlinde670383Entry point mkl_serv_check_ptr_and_warn not located in mkl_core.dll
https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/670353
<p> </p>
<p>We have a program that uses 32 bit version of MKL v10.2.6.037. The program had been tested and released for more than one year. Recently one user had this error dialog poping up saying "The procedure entry point mkl_serv_check_ptr_and_warn could not be located in the dynamic link library mkl_core.dll". But when I log on the same computer and run the program and I do not get that error. I've also checked that mkl_core.dll has only "mkl_serv_check_ptr".</p>
<p>Just wondering any one know why mkl_serv_check_ptr_and_warn is called instead of mkl_serv_check_ptr, and which dll has "mkl_serv_check_ptr_and_warn"? </p>
<p> </p>
<p>thanks!</p>
<p> </p>
Thu, 21 Jul 16 12:22:40 -0700jayy78670353How to use MKL Routines for Matrix Inversion
https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/670309
<p>Hi everyone!</p>
<p>I never used libraries in my programs, usually I do all my routines on my own, but now I'm having efficiency problems and I decided to use libraries to improve the efficiency of my program.</p>
<p>I need an efficient routine to invert a sparse matrix. I implemented the Gauss-Jordan elimination algorithm using the "do concurrent" statement to make it parallelizable.</p>
<p>The problem I need to solve has a sparse rectangular matrix with m rows and n columns where n is a large number of columns. I use on each iteration of my program a sparse square matrix with dimension m x m formed by the inverse matrix of m columns of the sparse rectangular matrix mentioned above. In each iteration a new column of the rectangular matrix is selected to be part of the square matrix and my program does all the necessary calculations to enter this new column.</p>
<p>The problem appears after several iterations where appears several numerical errors in the square matrix due to the iterative process. One way to clean these errors is to calculate the inverse matrix of all columns of the rectangular matrix that are being used in the square matrix.</p>
<p>The university computer that I am using has installed Microsoft Visual Studio Professional 2013 Update 3, Intel Parallel Studio XE 2016 Update 2 Cluster Edition for Windows with Intel Math Kernel Library 11.3.</p>
<p>I found the routine <a href="https://software.intel.com/en-us/node/469906">P?GETRI from ScaLAPACK in the MKL documentation</a>* that can solve my problem, but I did not find examples of how to use this routine and I'm in trouble of how to use the routine and declare variables. I found only one example of routine <a href="http://fortranwiki.org/fortran/show/Matrix+inversion" rel="nofollow">DGETRI from LAPACK</a>* that has helped me to understand some of how to use the routine P?GETRI.</p>
<p><strong>Does anyone know another routine that solves my problem or give me an example of how to use the routine P?GETRI?</strong></p>
<p><strong>I activated the MKL library on project properties of my of project in Visual Studio following the steps of this video tutorial <a href="https://www.youtube.com/watch?v=E1n8-azFvmg" rel="nofollow">https://www.youtube.com/watch?v=E1n8-azFvmg</a>. Is the procedure on the video correct or do I need to perform other procedures to use the MKL library on Visual Studio?</strong></p>
<p>*I add the links in the text</p>
Wed, 20 Jul 16 17:07:06 -0700Jeferson Vanderlinde670309sparse matrix multiplication mkl_?csrmultcsr example and limits
https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/670090
<p>Are there any examples of mkl_?csrmultcsr functions? I have MKL 11.3 but have not found examples for these functions. I am also interested in knowing the maximum dimension sizes for rows/cols of the matrices.</p>
<p>Thanks,<br />
Kirk</p>
Mon, 18 Jul 16 15:03:03 -0700Kirk D.670090Looking for MKL FFT complementary functions
https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/670003
<p>Hey </p>
<p>I migrated my DFT code from IPP to FFT code using MKL FFT functions, I'm looking forward for performance improvement.</p>
<p>1st, I want to do phase correlation in spectrum domain. </p>
<p>In my algorithm I have 2 input images and the output is a correlation surface </p>
<p>I do the following: </p>
<p>1. FFT both input images </p>
<p>2. for each element in the spatial domain, I'd like to multiply with complex conjugate, than normalize each element: </p>
<p>2.1 (a1 + ib1) * (a2 - ib2) </p>
<p>2.2 (a + ib) / magnidute(a,b) --> Z </p>
<p>3. inverse FFT Z </p>
<p>I'm looking for complementary functions for FFT library that calculate a multiplication with complex conjugate, and function that calculate each element magnitude. </p>
<p>I thought I'd be great to use: </p>
<p>vcMulByConj </p>
<p>and </p>
<p>VCABS </p>
<p>functions that reside on "mkl_vml_functions.h" </p>
<p>However, here comes a problem of using MKL FFT memory model (DFTI_CONJUGATE_EVEN_STORAGE in packed memory format ), I don't know how to access each element in the spatial domain, how to build the matrix back in packed format, and most important is how to make this thing work extremely fast. </p>
<p>I'm looking for functions that already know how to work with packed format and execute such functionality on packed format matrix, </p>
<p>Are there functions that gives such functionality? </p>
<p>Do I need to write this functionally by myself ? How to access each matrix element ? </p>
<p>2nd, I'm also want to do FFT shift in the spatial domain by doing (-1)^(i+j) for each element. Is there a function that can do such thing (perhaps matrix pixel wise multiplication) ? Working with packed format. </p>
<p> </p>
<p>Thanks </p>
<p> </p>
<p>S </p>
<p> </p>
<p> </p>
<p> </p>
Sun, 17 Jul 16 00:04:30 -0700Shahar S.670003Matrix product with MKL
https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/668323
<p>Hi,</p>
<p>I want to do a complicated matrix product which is defined as</p>
<p>C[i,j] = \sum_{n,m} A[i,n]*A[j,n]* B[n,m] *A[i,m]*A[j,m] </p>
<p> Where A and B are two matrix with size of NxN, (N~1000).</p>
<p>To accomplish this task I just run four loops to creat the matrix C .</p>
<p>for(int i=0;i<ndim;i++)</p>
<p>for(int j=0;j<ndim;j++)</p>
<p>for(int n=0;n<ndim;n++)</p>
<p>for(int m=0;m<ndim;m++)</p>
<p>C[i,j] += A[i,n]*A[j,n]* B[n,m] *A[i,m]*A[j,m]</p>
<p> </p>
<p>Can anyone suggest any better implementation using MKL matrix product function?</p>
<p>Thanks in advance.</p>
<p> </p>
<p> </p>
Fri, 15 Jul 16 11:05:39 -0700Saurabh Pradhan668323Compilation Errors with MKL_DIRECT_CALL_SEQ
https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/667946
<p>Hi,</p>
<p>I'm compiling a cpp file that includes mkl.h and contains a single cblas_dgemm call with the following:</p>
<pre class="brush:bash;">icpc -DMKL_DIRECT_CALL_SEQ -DMKL_ILP64 -I/opt/intel/mkl/include -c -o main.o main.cpp</pre><p>Compilation breaks and I get mutliple times the following message:</p>
<pre class="brush:bash;">error: expression must be an lvalue or a function designator
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, 4, 4, 4, 1, A, 4, B, 4, 1, C, 4);
</pre><p>If a remove -DMKL_DIRECT_CALL_SEQ the compilation works as expected.</p>
<p>Is this a bug or am I doing anything wrong?</p>
<p>Thanks,</p>
<p>Daniele</p>
Fri, 15 Jul 16 10:17:26 -0700Daniele S.667946Unresolved reference to lapack95 subroutine
https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/661056
<p>I am sure I am making a very simple and obvious mistake in using lapack95, but I cannot figure it out at present.</p>
<p>Compiling and linking with MKL of the following sample code:</p>
<pre class="brush:fortran;"> program test_lapack
use lapack95,only:ggev
implicit none
integer,parameter::x_=8
integer,parameter::n =2
complex(kind=x_)::a (0:n-1,0:n-1)=reshape((/11._x_,12._x_,21._x_,22._x_/),(/2,2/))
complex(kind=x_)::b (0:n-1,0:n-1)=reshape((/ 1._x_, 0._x_, 0._x_, 1._x_/),(/2,2/))
complex(kind=x_)::alpha(0:n-1)
complex(kind=x_):: beta(0:n-1)
call ggev(a,b,alpha,beta)
end program test_lapack</pre><p>with:</p>
<pre class="brush:bash;">ifort -mkl=sequential test_lapack.F90</pre><p>yields:</p>
<pre class="brush:bash;">/tmp/ifortzuGiE1.o: In function `MAIN__':
test_lapack.F90:(.text+0x185): undefined reference to `zggev_f95_'</pre><p>which means the program does find lapack95's <strong>ggev </strong>interface, but the <strong>zggev_F95 </strong>is still unresolved. I have checked that both the lapack95.F90 and all lapack95 routine implementations are in place, at <em>/opt/intel/compilers_and_libraries_2016.3.210/linux/mkl/include </em>and <em>/opt/intel/compilers_and_libraries_2016.3.210/linux/mkl/interfaces/lapack95/source </em>respectively. So it appears I am just missing on how to link the lapack95 implementation with its interface, or whatnot.</p>
Mon, 11 Jul 16 08:57:07 -0700Trent Hawkins661056