<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Dylan, I guess, the cause of in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issues-compiling-MATLAB-mex-with-Intel-MKL-PARDISO/m-p/1163744#M28073</link>
    <description>&lt;P&gt;Dylan, I guess, the cause of the problem with regard to how do you link this case.I would recommend you to look at this article (https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-for-windows-using-intel-mkl-in-matlab-executable-mex-files) .This is pretty obsolete (we should&amp;nbsp;update the article. tbd)&amp;nbsp;but you may catch some info how to link and call..&lt;/P&gt;</description>
    <pubDate>Fri, 08 Mar 2019 05:43:51 GMT</pubDate>
    <dc:creator>Gennady_F_Intel</dc:creator>
    <dc:date>2019-03-08T05:43:51Z</dc:date>
    <item>
      <title>Issues compiling MATLAB mex with Intel MKL PARDISO</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issues-compiling-MATLAB-mex-with-Intel-MKL-PARDISO/m-p/1163743#M28072</link>
      <description>&lt;P&gt;I am quite new to writing mex files, and to the MKL. I need to interface the PARDISO solver with a MATLAB code of mine, for solving of large finite element matrices. When compiling my mex code, I am having some issues. MATLAB gives me the error message:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error using mex&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Creating library fem_mex_pardiso.lib and object fem_mex_pardiso.exp&lt;BR /&gt;fem_mex_pardiso.obj : error LNK2019: unresolved external symbol pardiso referenced in function mexFunction&lt;BR /&gt;fem_mex_pardiso.mexw64 : fatal error LNK1120: 1 unresolved externals&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This occurs when I submit the command&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;mex -R2018a fem_mex_pardiso.c -I'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.2.190\windows\mkl\include\'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I am sure that it is that I am not linking something properly, but I honestly am quite new to interfacing MATLAB with external libraries.&lt;/P&gt;&lt;P&gt;Here is the c - code that gives the errors:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*==========================================================&lt;BR /&gt;&amp;nbsp;* fem_mex_pardiso.ca&lt;BR /&gt;&amp;nbsp;*==========================================================*/&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;// Include headers&lt;BR /&gt;&amp;nbsp;#include "mex.h"&lt;BR /&gt;&amp;nbsp;#include "mkl.h"&lt;BR /&gt;&amp;nbsp;#include "mkl_pardiso.h"&lt;BR /&gt;&amp;nbsp;#include "mkl_types.h"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Define variables&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;double *a, *rf_glob, *u_qct, ddum;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int num_rows, i;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void *pt[64];&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MKL_INT *ia, *ja, n, iparm[64], maxfct, mnum, phase, error, msglvl, mtype, idum;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Argument checks&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (nlhs &amp;gt; 1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;mexErrMsgTxt("Too many outputs!");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (nrhs != 4) // Should be 3 matrices for the CSR3 format of k_glob, and one column vector for rf_glob&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;mexErrMsgTxt("Need four inputs! (3 vectors for the sparse stiffness matrix, and one for the load vector)");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the sparse matrix inputs&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ia = mxGetInt32s(prhs[0]); // Contains the indices of the first non-zero element in each row of a. Note, the last index of ia is the number of non-zero elements in a, plus one&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ja = mxGetInt32s(prhs[1]); // Contains the global column indices of every element in a&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;a = mxGetDoubles(prhs[2]); // Non-zero elements of stiffness matrix&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Number of equations is equal to length of the reaction force vector&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;rf_glob = mxGetDoubles(prhs[3]);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;num_rows = mxGetM(prhs[3]);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;n = num_rows;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Configure out-of-core settings&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//setenv('MKL_PARDISO_OOC_PATH', 'C:\Users\dylan\Documents\School\Masters\01_Main_MSc\02_Codes\13_INTEL_MKL_Matlab\OutOfCore_Memory\ooc_file');&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//setenv('MKL_PARDISO_OOC_MAX_CORE_SIZE', '12288');&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//setenv('MKL_PARDISO_OOC_MAX_SWAP_SIZE', '8192');&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//setenv('MKL_PARDISO_OOC_KEEP_FILE', '0');&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Setup solver&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Iniitialize values for solver parameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;maxfct = 1; // Maximal number of factors in memory&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;mnum = 1; // Number of matrices to solve&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;mtype = -2; // Matrix type (Here, real and symmetric positive indefinite. For real and symmetric positive definite, use 2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Initialize the parameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (i = 0; i &amp;lt; 64; i++)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm&lt;I&gt; = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iparm[0] = 1; // Not using default solver parameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[1] = 3; // Fill-in reducing ordering from METIS, parallelized with OpenMP&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[3] = 0; // Not using an iterative algorithm&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[4] = 0; // Not using a user-specified fill-in reducing permutation&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[5] = 0; // Write solution into u_qct&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[7] = 2; // Maximum number of iterative refinement steps&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[9] = 13; // Perturb pivot elements by 1E-13 to deal with near-zero or zero pivots&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[10] = 0; // No scaling (because we will be reording to a symmetric matrix)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[12] = 0; // No symmetric weighted matching&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[13] = 0; // Zero perturbed pivots&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[17] = -1; // Number of non-zeros in the factor LU&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[18] = -1; // Mfloprs for LU factorization&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[19] = 0; // Number of CG iterations&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iparm[34] = 1; // Use C-style indexing for ia and ja arrays&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iparm[60] = 1; // Use out-of-core memory if out of RAM&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;msglvl = 0; // Do not print statistical information file&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;error = 0; // Initialize error flag&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Initialize the solver pointer&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (i = 0; i &amp;lt; 64; i++)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;pt&lt;I&gt; = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Begin solving&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Step 1 - Reordering and symbolic factorization&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;phase = 11;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;PARDISO (pt, &amp;amp;maxfct, &amp;amp;mnum, &amp;amp;mtype, &amp;amp;phase, &amp;amp;n, a, ia, ja, &amp;amp;idum, &amp;amp;nrhs, iparm, &amp;amp;msglvl, &amp;amp;ddum, &amp;amp;ddum, &amp;amp;error);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (error != 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("\n ERROR during symbolic factorization: %d", error);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;exit(1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("\nReordering completed ... ");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("\nNumber of nonzeros in factors = %d", iparm[17]);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printf("\nNumber of factorization MFLOPS = %d", iparm[18]);&lt;BR /&gt;&amp;nbsp;}&lt;/I&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is greatly appreciated. Thankyou!&lt;/P&gt;</description>
      <pubDate>Sun, 03 Mar 2019 09:30:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issues-compiling-MATLAB-mex-with-Intel-MKL-PARDISO/m-p/1163743#M28072</guid>
      <dc:creator>Zaluski__Dylan</dc:creator>
      <dc:date>2019-03-03T09:30:22Z</dc:date>
    </item>
    <item>
      <title>Dylan, I guess, the cause of</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issues-compiling-MATLAB-mex-with-Intel-MKL-PARDISO/m-p/1163744#M28073</link>
      <description>&lt;P&gt;Dylan, I guess, the cause of the problem with regard to how do you link this case.I would recommend you to look at this article (https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-for-windows-using-intel-mkl-in-matlab-executable-mex-files) .This is pretty obsolete (we should&amp;nbsp;update the article. tbd)&amp;nbsp;but you may catch some info how to link and call..&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 05:43:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Issues-compiling-MATLAB-mex-with-Intel-MKL-PARDISO/m-p/1163744#M28073</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2019-03-08T05:43:51Z</dc:date>
    </item>
  </channel>
</rss>

