<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-ligatures:standardcontextual;
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:11.0pt;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-IE" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt">Could you please help me to figure out what’s wrong with the way I’m trying to make mkl pardiso use the number of threads more than one while setting it as a sub PC solver for ASM preconditioner.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt">Here is how I do this<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt">Loop over block PCs {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt">  PCSetType(subPc, PCLU);             set subPC type<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt">  PCFactorSetMatSolverType(subPc, MATSOLVERMKL_PARDISO);       set solver for LU<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt">  SetPardisoParams("pardiso");      set mkl related options including -mat_mkl_pardiso_65 equal to the desired #threads; return code after PetscOptionsSetValue is ok, so I presume the option is
 set correctly. <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt">  PCSetFromOptions(subPc);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt">Then what I see under the debugger<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:13.0pt">PCSetUp after a series of calls gets to MatLUFactorSymbolic_AIJMKL_PARDISO which in turn calls MatSetFromOptions_MKL_PARDISO(F, A) and there
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:13.0pt">in these lines it seems to ignore what I’ve set for
</span><span lang="EN-US" style="font-size:13.0pt">-mat_mkl_pardiso_65 and sets #threads to the default 1</span><span style="font-size:13.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:13.0pt">PetscCall(PetscOptionsInt("-mat_mkl_pardiso_65", "Suggested number of threads to use within PARDISO", "None", threads, &threads, &flg));<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:13.0pt">if (flg) PetscSetMKL_PARDISOThreads((int)threads);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:13.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:13.0pt">This is about petsc-3.20.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:13.0pt">PS when I do this in a standalone code which reads a matrix and solves the linear system and set
</span><span lang="EN-US" style="font-size:13.0pt">-mat_mkl_pardiso_65 in the command line it’s all right but I need the number of threads to be set in other way in my code.</span><span style="font-size:13.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:13.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:13.0pt">Thank you and best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:13.0pt">Boris<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:13.0pt"><o:p> </o:p></span></p>
</div>
<p>-------------------------------------------------------------<br>
Intel Ireland Limited (Branch)<br>
Collinstown Industrial Park, Leixlip, County Kildare, Ireland<br>
Registered Number: E902934</p>

<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></body>
</html>