<head><!-- BaNnErBlUrFlE-HeAdEr-start -->
<style>
#pfptBanner5sjp52v { all: revert !important; display: block !important;
visibility: visible !important; opacity: 1 !important;
background-color: #D0D8DC !important;
max-width: none !important; max-height: none !important }
.pfptPrimaryButton5sjp52v:hover, .pfptPrimaryButton5sjp52v:focus {
background-color: #b4c1c7 !important; }
.pfptPrimaryButton5sjp52v:active {
background-color: #90a4ae !important; }
</style>
<!-- BaNnErBlUrFlE-HeAdEr-end -->
</head><!-- BaNnErBlUrFlE-BoDy-start -->
<!-- Preheader Text : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">
No, you don't. It is strange. Perhaps you can you run a petsc example first and see if MKL is really used $ cd src/mat/tests $ make ex1 $ MKL_VERBOSE=1 ./ex1 --Junchao Zhang On Fri, Jun 21, 2024 at 4: 03 PM Yongzhong Li <yongzhong. li@ mail. utoronto. ca>
</div>
<!-- Preheader Text : END -->
<!-- Email Banner : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerStart</div>
<!--[if ((ie)|(mso))]>
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="padding: 16px 0px 16px 0px; direction: ltr" ><tr><td>
<table border="0" cellspacing="0" cellpadding="0" style="padding: 0px 10px 5px 6px; width: 100%; border-radius:4px; border-top:4px solid #90a4ae;background-color:#D0D8DC;"><tr><td valign="top">
<table align="left" border="0" cellspacing="0" cellpadding="0" style="padding: 4px 8px 4px 8px">
<tr><td style="color:#000000; font-family: 'Arial', sans-serif; font-weight:bold; font-size:14px; direction: ltr">
This Message Is From an External Sender
</td></tr>
<tr><td style="color:#000000; font-weight:normal; font-family: 'Arial', sans-serif; font-size:12px; direction: ltr">
This message came from outside your organization.
</td></tr>
</table>
</td></tr></table>
</td></tr></table>
<![endif]-->
<![if !((ie)|(mso))]>
<div dir="ltr" id="pfptBanner5sjp52v" style="all: revert !important; display:block !important; text-align: left !important; margin:16px 0px 16px 0px !important; padding:8px 16px 8px 16px !important; border-radius: 4px !important; min-width: 200px !important; background-color: #D0D8DC !important; background-color: #D0D8DC; border-top: 4px solid #90a4ae !important; border-top: 4px solid #90a4ae;">
<div id="pfptBanner5sjp52v" style="all: unset !important; float:left !important; display:block !important; margin: 0px 0px 1px 0px !important; max-width: 600px !important;">
<div id="pfptBanner5sjp52v" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-weight:bold !important; font-weight:bold; font-size:14px !important; line-height:18px !important; line-height:18px">
This Message Is From an External Sender
</div>
<div id="pfptBanner5sjp52v" style="all: unset !important; display:block !important; visibility: visible !important; background-color: #D0D8DC !important; color:#000000 !important; color:#000000; font-weight:normal; font-family: 'Arial', sans-serif !important; font-family: 'Arial', sans-serif; font-size:12px !important; line-height:18px !important; line-height:18px; margin-top:2px !important;">
This message came from outside your organization.
</div>
</div>
<div style="clear: both !important; display: block !important; visibility: hidden !important; line-height: 0 !important; font-size: 0.01px !important; height: 0px"> </div>
</div>
<![endif]>
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;height:0px;max-height:0px;opacity:0;overflow:hidden;">ZjQcmQRYFpfptBannerEnd</div>
<!-- Email Banner : END -->
<!-- BaNnErBlUrFlE-BoDy-end -->
<div dir="ltr">No, you don't. It is strange. Perhaps you can you run a petsc example first and see if MKL is really used<div><font face="monospace">$ cd src/mat/tests</font></div><div><font face="monospace">$ make ex1</font></div><div><div><font face="monospace">$ MKL_VERBOSE=1 ./ex1</font><br></div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--Junchao Zhang</div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 21, 2024 at 4:03 PM Yongzhong Li <<a href="mailto:yongzhong.li@mail.utoronto.ca">yongzhong.li@mail.utoronto.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-6075196701903926580">
<div lang="en-CN" style="overflow-wrap: break-word;">
<div class="m_-6075196701903926580WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt">I am using <br>
<br>
export MKL_VERBOSE=1<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt">./xx<br>
<br>
in the bash file, do I have to use -</span><span lang="EN-US"> </span>ksp_converged_reason<span lang="EN-US">?<br>
<br>
Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Yongzhong<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<div id="m_-6075196701903926580mail-editor-reference-message-container">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="color:black">From:
</span></b><span style="color:black">Pierre Jolivet <<a href="mailto:pierre@joliv.et" target="_blank">pierre@joliv.et</a>><br>
<b>Date: </b>Friday, June 21, 2024 at 1:47</span><span style="font-family:Arial,sans-serif;color:black"> </span><span style="color:black">PM<br>
<b>To: </b>Yongzhong Li <<a href="mailto:yongzhong.li@mail.utoronto.ca" target="_blank">yongzhong.li@mail.utoronto.ca</a>><br>
<b>Cc: </b>Junchao Zhang <<a href="mailto:junchao.zhang@gmail.com" target="_blank">junchao.zhang@gmail.com</a>>, <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject: </b>Re: [petsc-users] [petsc-maint] Assistance Needed with PETSc KSPSolve Performance Issue<u></u><u></u></span></p>
</div>
<table border="0" cellspacing="0" cellpadding="0" align="left" width="100%" style="width:100%;display:table;float:none">
<tbody>
<tr>
<td style="background:rgb(166,166,166);padding:5.25pt 1.5pt"></td>
<td width="100%" style="width:100%;background:rgb(234,234,234);padding:5.25pt 3.75pt 5.25pt 11.25pt">
<div>
<p class="MsoNormal">
<span lang="ZH-CN" style="font-size:9pt;font-family:DengXian;color:rgb(33,33,33)">你通常不会收到来自</span><span style="font-size:9pt;font-family:"Segoe UI",sans-serif;color:rgb(33,33,33)"> <a href="mailto:pierre@joliv.et" target="_blank">pierre@joliv.et</a>
</span><span lang="ZH-CN" style="font-size:9pt;font-family:DengXian;color:rgb(33,33,33)">的电子邮件。</span><span style="font-size:9pt;font-family:"Segoe UI",sans-serif;color:rgb(33,33,33)"><a href="https://urldefense.us/v3/__https://aka.ms/LearnAboutSenderIdentification__;!!G_uCfscf7eWS!YIK0ThSYBvsQIwQn1nK19oKLIjhdsMJjFBn4TKBPWX9MdHPawEkV_Ol4-JrQi4VGPFKXs18XY44nNUBQDDP5XKUuInIR$" target="_blank"><span lang="ZH-CN" style="font-family:DengXian">了解这一点为什么很重要</span></a><u></u><u></u></span></p>
</div>
</td>
<td width="75" style="width:56.25pt;background:rgb(234,234,234);padding:5.25pt 3.75pt">
</td>
</tr>
</tbody>
</table>
<div>
<p class="MsoNormal">How do you set the variable? <u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">$ MKL_VERBOSE=1 ./ex1 -ksp_converged_reason<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">MKL_VERBOSE oneMKL 2024.0 Update 1 Product build 20240215 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2) enabled processors, Lnx 2.80GHz lp64 intel_thread<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">MKL_VERBOSE DDOT(10,0x22127c0,1,0x22127c0,1) 2.02ms CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:1<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">MKL_VERBOSE DSCAL(10,0x7ffc9fb4ff08,0x22127c0,1) 12.67us CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:1<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">MKL_VERBOSE DDOT(10,0x22127c0,1,0x2212840,1) 1.52us CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:1<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">MKL_VERBOSE DDOT(10,0x2212840,1,0x2212840,1) 167ns CNR:OFF Dyn:1 FastMM:1 TID:0 NThr:1<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">[...]<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><br>
<br>
<u></u><u></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<p class="MsoNormal">On 21 Jun 2024, at 7:37<span style="font-family:Arial,sans-serif"> </span>PM, Yongzhong Li <<a href="mailto:yongzhong.li@mail.utoronto.ca" target="_blank">yongzhong.li@mail.utoronto.ca</a>> wrote:<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div id="m_-6075196701903926580pfptBannermu5fqka">
<div id="m_-6075196701903926580pfptBannermu5fqka">
<div id="m_-6075196701903926580pfptBannermu5fqka">
<p class="MsoNormal"><span style="font-family:Arial,sans-serif">This Message Is From an External Sender<span class="m_-6075196701903926580apple-converted-space"> </span><u></u><u></u></span></p>
</div>
<div id="m_-6075196701903926580pfptBannermu5fqka">
<p class="MsoNormal"><span style="font-family:Arial,sans-serif">This message came from outside your organization.<u></u><u></u></span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt">Hello all,<br>
<br>
I set MKL_VERBOSE = 1, but observed no print output specific to the use of MKL. Does PETSc enable this verbose output?<br>
<br>
Best,</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span lang="EN-US" style="font-size:11pt">Yongzhong<br>
<br>
</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
</div>
<div id="m_-6075196701903926580mail-editor-reference-message-container">
<div>
<div style="border-right:none currentcolor;border-bottom:none currentcolor;border-left:none currentcolor;border-top:1pt solid currentcolor;padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b>From:<span class="m_-6075196701903926580apple-converted-space"> </span></b>Pierre Jolivet <<a href="mailto:pierre@joliv.et" target="_blank">pierre@joliv.et</a>><br>
<b>Date:<span class="m_-6075196701903926580apple-converted-space"> </span></b>Friday, June 21, 2024 at 1:36<span style="font-family:Arial,sans-serif"> </span>AM<br>
<b>To:<span class="m_-6075196701903926580apple-converted-space"> </span></b>Junchao Zhang <<a href="mailto:junchao.zhang@gmail.com" target="_blank">junchao.zhang@gmail.com</a>><br>
<b>Cc:<span class="m_-6075196701903926580apple-converted-space"> </span></b>Yongzhong Li <<a href="mailto:yongzhong.li@mail.utoronto.ca" target="_blank">yongzhong.li@mail.utoronto.ca</a>>,<span class="m_-6075196701903926580apple-converted-space"> </span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><span class="m_-6075196701903926580apple-converted-space"> </span><<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:<span class="m_-6075196701903926580apple-converted-space"> </span></b>Re: [petsc-users] [petsc-maint] Assistance Needed with PETSc KSPSolve Performance Issue<u></u><u></u></p>
</div>
<table border="0" cellspacing="0" cellpadding="0" align="left" width="100%" style="width:100%;display:table;float:none">
<tbody>
<tr>
<td style="background:rgb(166,166,166);padding:5.25pt 1.5pt"></td>
<td width="100%" style="width:100%;background:rgb(234,234,234);padding:5.25pt 3.75pt 5.25pt 11.25pt">
<div>
<div>
<p class="MsoNormal">
<span lang="ZH-CN" style="font-size:9pt;font-family:DengXian;color:rgb(33,33,33)">你通常不会收到来自</span><span class="m_-6075196701903926580apple-converted-space"><span style="font-size:9pt;font-family:"Segoe UI",sans-serif;color:rgb(33,33,33)"> </span></span><span style="font-size:9pt;font-family:"Segoe UI",sans-serif;color:rgb(33,33,33)"><a href="mailto:pierre@joliv.et" target="_blank">pierre@joliv.et</a><span class="m_-6075196701903926580apple-converted-space"> </span></span><span lang="ZH-CN" style="font-size:9pt;font-family:DengXian;color:rgb(33,33,33)">的电子邮件。</span><span style="color:black"><a href="https://urldefense.us/v3/__https://aka.ms/LearnAboutSenderIdentification__;!!G_uCfscf7eWS!eXBeeIXo9Yqgp2nypqwKYimLnGBZXnF4dXxgLM1UoOIO6n8nt3XlfgjVWLPWJh4UOa5NNpx-nrJb_H828XRQKUREfR2m69oCbxI$" target="_blank"><span lang="ZH-CN" style="font-size:9pt;font-family:DengXian">了解这一点为什么很重要</span></a></span><u></u><u></u></p>
</div>
</div>
</td>
<td width="75" style="width:56.25pt;background:rgb(234,234,234);padding:5.25pt 3.75pt">
</td>
</tr>
</tbody>
</table>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<p class="MsoNormal">On 21 Jun 2024, at 6:42<span style="font-family:Arial,sans-serif"> </span>AM, Junchao Zhang <<a href="mailto:junchao.zhang@gmail.com" target="_blank">junchao.zhang@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div id="m_-6075196701903926580pfptBanners71iuax">
<div id="m_-6075196701903926580pfptBanners71iuax">
<div id="m_-6075196701903926580pfptBanners71iuax">
<div>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif">This Message Is From an External Sender</span><u></u><u></u></p>
</div>
</div>
<div id="m_-6075196701903926580pfptBanners71iuax">
<div>
<p class="MsoNormal"><span style="font-family:Arial,sans-serif">This message came from outside your organization.</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">I remember there are some MKL env vars to print MKL routines called. </span><u></u><u></u></p>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">The environment variable is MKL_VERBOSE<u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">Pierre<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">Maybe we can try it to see what MKL routines are really used and then we can understand why some petsc functions did not speed up </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"><br clear="all">
</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">--Junchao Zhang</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">On Thu, Jun 20, 2024 at 10:39 PM Yongzhong Li <</span><a href="mailto:yongzhong.li@mail.utoronto.ca" target="_blank"><span style="font-size:9pt;font-family:Helvetica">yongzhong.li@mail.utoronto.ca</span></a><span style="font-size:9pt;font-family:Helvetica">>
wrote:</span><u></u><u></u></p>
</div>
</div>
<blockquote style="border-top:none currentcolor;border-right:none currentcolor;border-bottom:none currentcolor;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<div>
<div style="border-right:none currentcolor;border-bottom:none currentcolor;border-left:none currentcolor;border-top:3pt solid currentcolor;padding:6pt 0cm 0cm;margin-top:12pt;margin-bottom:12pt;border-radius:4px;min-width:200px" id="m_-6075196701903926580m_-4861803116733450987pfptBannerqdehbik">
<div style="margin-bottom:0.75pt;float:left" id="m_-6075196701903926580m_-4861803116733450987pfptBannerqdehbik">
<div id="m_-6075196701903926580m_-4861803116733450987pfptBannerqdehbik">
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:rgb(208,216,220)"><b><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black">This Message Is From an External Sender</span></b><u></u><u></u></p>
</div>
</div>
<div style="margin-top:1.5pt" id="m_-6075196701903926580m_-4861803116733450987pfptBannerqdehbik">
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:rgb(208,216,220)"><span style="font-size:9pt;font-family:Arial,sans-serif;color:black">This message came from outside your organization.</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:rgb(208,216,220)"><span style="font-size:1pt;font-family:Helvetica;color:black"> </span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica">Hi Barry, sorry for my last results. I didn’t fully understand the stage profiling and logging in PETSc, now I only record KSPSolve() stage of my program. Some sample codes
are as follow,<br>
<br>
<span class="m_-6075196701903926580apple-converted-space"> </span>// Static variable to keep track of the stage counter</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>static int stageCounter = 1;</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>// Generate a unique stage name</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>std::ostringstream oss;</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>oss << "Stage " << stageCounter << " of Code";</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>std::string stageName = oss.str();</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>// Register the stage</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>PetscLogStage stagenum;</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>PetscLogStageRegister(stageName.c_str(), &stagenum);</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>PetscLogStagePush(stagenum);</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span><b>KSPSolve(*ksp_ptr, b, x);</b></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>PetscLogStagePop();</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>stageCounter++;<br>
<br>
I have attached my new logging results, there are 1 main stage and 4 other stages where each one is KSPSolve() call.<br>
<br>
To provide some additional backgrounds, if you recall, I have been trying to get efficient iterative solution using multithreading. I found out by compiling PETSc with Intel MKL library instead of OpenBLAS, I am able to perform sparse matrix-vector multiplication
faster, I am using MATSEQAIJMKL. This makes the shell matrix vector product in each iteration scale well with the #of threads. However, I found out the total GMERS solve time (~KSPSolve() time) is not scaling well the #of threads.<br>
<br>
>From the logging results I learned that when performing KSPSolve(), there are some CPU overheads in PCApply() and KSPGMERSOrthog(). I ran my programs using different number of threads and plotted the time consumption for PCApply() and KSPGMERSOrthog() against
#of thread. I found out these two operations are not scaling with the threads at all! My results are attached as the pdf to give you a clear view.<br>
<br>
My questions is,<br>
<br>
>From my understanding, in PCApply, MatSolve() is involved, KSPGMERSOrthog() will have many vector operations, so why these two parts can’t scale well with the # of threads when the intel MKL library is linked?<br>
<br>
Thank you,<br>
Yongzhong</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
<div id="m_-6075196701903926580m_-4861803116733450987mail-editor-reference-message-container">
<div>
<div style="border-right:none currentcolor;border-bottom:none currentcolor;border-left:none currentcolor;border-top:1pt solid currentcolor;padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:9pt;font-family:Helvetica">From:<span class="m_-6075196701903926580apple-converted-space"> </span></span></b><span style="font-size:9pt;font-family:Helvetica">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:9pt;font-family:Helvetica">bsmith@petsc.dev</span></a><span style="font-size:9pt;font-family:Helvetica">><br>
<b>Date:<span class="m_-6075196701903926580apple-converted-space"> </span></b>Friday, June 14, 2024 at 11:36</span><span style="font-size:9pt;font-family:Arial,sans-serif"> </span><span style="font-size:9pt;font-family:Helvetica">AM<br>
<b>To:<span class="m_-6075196701903926580apple-converted-space"> </span></b>Yongzhong Li <</span><a href="mailto:yongzhong.li@mail.utoronto.ca" target="_blank"><span style="font-size:9pt;font-family:Helvetica">yongzhong.li@mail.utoronto.ca</span></a><span style="font-size:9pt;font-family:Helvetica">><br>
<b>Cc:<span class="m_-6075196701903926580apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-users@mcs.anl.gov</span></a><span class="m_-6075196701903926580apple-converted-space"><span style="font-size:9pt;font-family:Helvetica"> </span></span><span style="font-size:9pt;font-family:Helvetica"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-users@mcs.anl.gov</span></a><span style="font-size:9pt;font-family:Helvetica">>,<span class="m_-6075196701903926580apple-converted-space"> </span></span><a href="mailto:petsc-maint@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-maint@mcs.anl.gov</span></a><span class="m_-6075196701903926580apple-converted-space"><span style="font-size:9pt;font-family:Helvetica"> </span></span><span style="font-size:9pt;font-family:Helvetica"><</span><a href="mailto:petsc-maint@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-maint@mcs.anl.gov</span></a><span style="font-size:9pt;font-family:Helvetica">>,
Piero Triverio <</span><a href="mailto:piero.triverio@utoronto.ca" target="_blank"><span style="font-size:9pt;font-family:Helvetica">piero.triverio@utoronto.ca</span></a><span style="font-size:9pt;font-family:Helvetica">><br>
<b>Subject:<span class="m_-6075196701903926580apple-converted-space"> </span></b>Re: [petsc-maint] Assistance Needed with PETSc KSPSolve Performance Issue</span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> I am a bit confused. Without the initial guess computation, there are still a bunch of events I don't understand </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">MatTranspose 79 1.0 4.0598e+01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">MatMatMultSym 110 1.0 1.7419e+02 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 1 0 0 0 0 1 0 0 0 0 0</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">MatMatMultNum 90 1.0 1.2640e+02 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 1 0 0 0 0 1 0 0 0 0 0</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">MatMatMatMultSym 20 1.0 1.3049e+02 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 1 0 0 0 0 1 0 0 0 0 0</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">MatRARtSym 25 1.0 1.2492e+02 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 1 0 0 0 0 1 0 0 0 0 0</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">MatMatTrnMultSym 25 1.0 8.8265e+01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">MatMatTrnMultNum 25 1.0 2.4820e+02 1.0 6.83e+10 1.0 0.0e+00 0.0e+00 0.0e+00 1 0 0 0 0 1 0 0 0 0 275</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">MatTrnMatMultSym 10 1.0 7.2984e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">MatTrnMatMultNum 10 1.0 9.3128e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">in addition there are many more VecMAXPY then VecMDot (in GMRES they are each done the same number of times)</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">VecMDot 5588 1.0 1.7183e+03 1.0 2.06e+13 1.0 0.0e+00 0.0e+00 0.0e+00 8 10 0 0 0 8 10 0 0 0 12016</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">VecMAXPY 22412 1.0 8.4898e+03 1.0 4.17e+13 1.0 0.0e+00 0.0e+00 0.0e+00 39 20 0 0 0 39 20 0 0 0 4913</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">Finally there are a huge number of </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">MatMultAdd 258048 1.0 1.4178e+03 1.0 6.10e+13 1.0 0.0e+00 0.0e+00 0.0e+00 7 29 0 0 0 7 29 0 0 0 43025</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">Are you making calls to all these routines? Are you doing this inside your MatMult() or before you call KSPSolve?</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">The reason I wanted you to make a simpler run without the initial guess code is that your events are far more complicated than would be produced by GMRES alone so it is not possible to
understand the behavior you are seeing without fully understanding all the events happening in the code.</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>Barry</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">On Jun 14, 2024, at 1:19</span><span style="font-size:9pt;font-family:Arial,sans-serif"> </span><span style="font-size:9pt;font-family:Helvetica">AM, Yongzhong Li <</span><a href="mailto:yongzhong.li@mail.utoronto.ca" target="_blank"><span style="font-size:9pt;font-family:Helvetica">yongzhong.li@mail.utoronto.ca</span></a><span style="font-size:9pt;font-family:Helvetica">>
wrote:</span><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica">Thanks, I have attached the results without using any KSPGuess. At low frequency, the iteration steps are quite close to the one with KSPGuess, specifically<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span><br>
<br>
KSPGuess Object: 1 MPI process</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>type: fischer</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>Model 1, size 200<br>
<br>
However, I found at higher frequency, the # of iteration steps are significant higher than the one with KSPGuess, I have attahced both of the results for your reference.<br>
<br>
Moreover, could I ask why the one without the KSPGuess options can be used for a baseline comparsion? What are we comparing here? How does it relate to the performance issue/bottleneck I found? “</span><b><span style="font-size:9pt;font-family:Helvetica">I
have noticed that the time taken by </span></b><b><span style="font-size:9pt;font-family:"Courier New"">KSPSolve</span></b><b><span style="font-size:9pt;font-family:Helvetica"> is<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span></b><b><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">almost
two times<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span></b><b><span style="font-size:9pt;font-family:Helvetica">greater than the CPU time for matrix-vector product multiplied by the number of iteration</span></b><span lang="EN-US" style="font-size:11pt;font-family:Helvetica">”<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span><br>
<br>
Thank you!<br>
Yongzhong</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
<div id="m_-6075196701903926580m_-4861803116733450987mail-editor-reference-message-container">
<div>
<div style="border-right:none currentcolor;border-bottom:none currentcolor;border-left:none currentcolor;border-top:1pt solid currentcolor;padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:9pt;font-family:Helvetica">From:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span></b><span style="font-size:9pt;font-family:Helvetica">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:9pt;font-family:Helvetica">bsmith@petsc.dev</span></a><span style="font-size:9pt;font-family:Helvetica">><br>
<b>Date:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></b>Thursday, June 13, 2024 at 2:14</span><span style="font-size:9pt;font-family:Arial,sans-serif"> </span><span style="font-size:9pt;font-family:Helvetica">PM<br>
<b>To:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></b>Yongzhong Li <</span><a href="mailto:yongzhong.li@mail.utoronto.ca" target="_blank"><span style="font-size:9pt;font-family:Helvetica">yongzhong.li@mail.utoronto.ca</span></a><span style="font-size:9pt;font-family:Helvetica">><br>
<b>Cc:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-users@mcs.anl.gov</span></a><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span style="font-size:9pt;font-family:Helvetica"> </span></span><span style="font-size:9pt;font-family:Helvetica"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-users@mcs.anl.gov</span></a><span style="font-size:9pt;font-family:Helvetica">>,<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><a href="mailto:petsc-maint@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-maint@mcs.anl.gov</span></a><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span style="font-size:9pt;font-family:Helvetica"> </span></span><span style="font-size:9pt;font-family:Helvetica"><</span><a href="mailto:petsc-maint@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-maint@mcs.anl.gov</span></a><span style="font-size:9pt;font-family:Helvetica">>,
Piero Triverio <</span><a href="mailto:piero.triverio@utoronto.ca" target="_blank"><span style="font-size:9pt;font-family:Helvetica">piero.triverio@utoronto.ca</span></a><span style="font-size:9pt;font-family:Helvetica">><br>
<b>Subject:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></b>Re: [petsc-maint] Assistance Needed with PETSc KSPSolve Performance Issue</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>Can you please run the same thing without the KSPGuess option(s) for a baseline comparison?</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> Thanks</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> Barry</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">On Jun 13, 2024, at 1:27</span><span style="font-size:9pt;font-family:Arial,sans-serif"> </span><span style="font-size:9pt;font-family:Helvetica">PM, Yongzhong Li <</span><a href="mailto:yongzhong.li@mail.utoronto.ca" target="_blank"><span style="font-size:9pt;font-family:Helvetica">yongzhong.li@mail.utoronto.ca</span></a><span style="font-size:9pt;font-family:Helvetica">>
wrote:</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div id="m_-6075196701903926580m_-4861803116733450987pfptBannerxs2204y">
<div id="m_-6075196701903926580m_-4861803116733450987pfptBannerxs2204y">
<div id="m_-6075196701903926580m_-4861803116733450987pfptBannerxs2204y">
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Arial,sans-serif">This Message Is From an External Sender</span><u></u><u></u></p>
</div>
</div>
</div>
<div id="m_-6075196701903926580m_-4861803116733450987pfptBannerxs2204y">
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Arial,sans-serif">This message came from outside your organization.</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Helvetica">Hi Matt,<br>
<br>
I have rerun the program with the keys you provided. The system output when performing ksp solve and the final petsc log output were stored in a .txt file attached for your reference.<br>
<br>
Thanks!<br>
Yongzhong</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div id="m_-6075196701903926580m_-4861803116733450987mail-editor-reference-message-container">
<div>
<div style="border-right:none currentcolor;border-bottom:none currentcolor;border-left:none currentcolor;border-top:1pt solid currentcolor;padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:9pt;font-family:Helvetica">From:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span></b><span style="font-size:9pt;font-family:Helvetica">Matthew Knepley <</span><a href="mailto:knepley@gmail.com" target="_blank"><span style="font-size:9pt;font-family:Helvetica">knepley@gmail.com</span></a><span style="font-size:9pt;font-family:Helvetica">><br>
<b>Date:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></b>Wednesday, June 12, 2024 at 6:46</span><span style="font-size:9pt;font-family:Arial,sans-serif"> </span><span style="font-size:9pt;font-family:Helvetica">PM<br>
<b>To:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></b>Yongzhong Li <</span><a href="mailto:yongzhong.li@mail.utoronto.ca" target="_blank"><span style="font-size:9pt;font-family:Helvetica">yongzhong.li@mail.utoronto.ca</span></a><span style="font-size:9pt;font-family:Helvetica">><br>
<b>Cc:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-users@mcs.anl.gov</span></a><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span style="font-size:9pt;font-family:Helvetica"> </span></span><span style="font-size:9pt;font-family:Helvetica"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-users@mcs.anl.gov</span></a><span style="font-size:9pt;font-family:Helvetica">>,<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><a href="mailto:petsc-maint@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-maint@mcs.anl.gov</span></a><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span style="font-size:9pt;font-family:Helvetica"> </span></span><span style="font-size:9pt;font-family:Helvetica"><</span><a href="mailto:petsc-maint@mcs.anl.gov" target="_blank"><span style="font-size:9pt;font-family:Helvetica">petsc-maint@mcs.anl.gov</span></a><span style="font-size:9pt;font-family:Helvetica">>,
Piero Triverio <</span><a href="mailto:piero.triverio@utoronto.ca" target="_blank"><span style="font-size:9pt;font-family:Helvetica">piero.triverio@utoronto.ca</span></a><span style="font-size:9pt;font-family:Helvetica">><br>
<b>Subject:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></b>Re: [petsc-maint] Assistance Needed with PETSc KSPSolve Performance Issue</span><u></u><u></u></p>
</div>
<table border="0" cellspacing="0" cellpadding="0" align="left" width="100%" style="width:100%;display:table;float:none">
<tbody>
<tr>
<td style="background:rgb(166,166,166);padding:5.25pt 1.5pt"></td>
<td width="100%" style="width:100%;background:rgb(234,234,234);padding:5.25pt 3.75pt 5.25pt 11.25pt">
<div>
<div>
<div>
<div>
<p class="MsoNormal">
<span lang="ZH-CN" style="font-size:9pt;font-family:DengXian;color:rgb(33,33,33)">你通常不会收到来自</span><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span style="font-size:9pt;font-family:"Segoe UI",sans-serif;color:rgb(33,33,33)"> </span></span><span style="color:black"><a href="mailto:knepley@gmail.com" target="_blank"><span style="font-size:9pt;font-family:"Segoe UI",sans-serif">knepley@gmail.com</span></a></span><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span style="font-size:9pt;font-family:"Segoe UI",sans-serif;color:rgb(33,33,33)"> </span></span><span lang="ZH-CN" style="font-size:9pt;font-family:DengXian;color:rgb(33,33,33)">的电子邮件。</span><span style="color:black"><a href="https://urldefense.us/v3/__https://aka.ms/LearnAboutSenderIdentification__;!!G_uCfscf7eWS!djGfJnEhNJROfsMsBJy5u_KoRKbug55xZ64oHKUFnH2cWku_Th1hwt4TDdoMd8pWYVDzJeqJslMNZwpO3y0Et94d31qk-oCEwo4$" target="_blank"><span lang="ZH-CN" style="font-size:9pt;font-family:DengXian">了解这一点为什么很重要</span></a></span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</td>
<td width="75" style="width:56.25pt;background:rgb(234,234,234);padding:5.25pt 3.75pt">
</td>
</tr>
</tbody>
</table>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">On Wed, Jun 12, 2024 at 6:36</span><span style="font-size:9pt;font-family:Arial,sans-serif"> </span><span style="font-size:9pt;font-family:Helvetica">PM Yongzhong Li <</span><a href="mailto:yongzhong.li@mail.utoronto.ca" target="_blank"><span style="font-size:9pt;font-family:Helvetica">yongzhong.li@mail.utoronto.ca</span></a><span style="font-size:9pt;font-family:Helvetica">>
wrote:</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<blockquote style="border-top:none currentcolor;border-right:none currentcolor;border-bottom:none currentcolor;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:1pt;font-family:Helvetica;color:white">Dear PETSc’s developers, I hope this email finds you well. I am currently working on a project using PETSc and have encountered a performance issue with the KSPSolve function.
Specifically, I have noticed that the time taken by KSPSolve is<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:1pt;font-family:Helvetica;color:white">ZjQcmQRYFpfptBannerStart</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div style="border-right:none currentcolor;border-bottom:none currentcolor;border-left:none currentcolor;border-top:3pt solid currentcolor;padding:6pt 0cm 0cm;margin-top:12pt;margin-bottom:12pt;border-radius:4px;min-width:200px" id="m_-6075196701903926580m_-4861803116733450987m_5223539340070699115pfptBannerpeukvww">
<div style="margin-bottom:0.75pt;float:left" id="m_-6075196701903926580m_-4861803116733450987m_5223539340070699115pfptBannerpeukvww">
<div id="m_-6075196701903926580m_-4861803116733450987m_5223539340070699115pfptBannerpeukvww">
<div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:rgb(208,216,220)"><b><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black">This Message Is From an External Sender</span></b><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div style="margin-top:1.5pt" id="m_-6075196701903926580m_-4861803116733450987m_5223539340070699115pfptBannerpeukvww">
<div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:rgb(208,216,220)"><span style="font-size:9pt;font-family:Arial,sans-serif;color:black">This message came from outside your organization.</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:rgb(208,216,220)"><span style="font-size:1pt;font-family:Helvetica;color:black"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:1pt;font-family:Helvetica;color:white">ZjQcmQRYFpfptBannerEnd</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">Dear<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">PETSc’s developers</span><span style="font-size:9pt;font-family:Helvetica">,</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">I hope this email finds you well.</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">I am currently working on a project using PETSc and have encountered a performance issue with the </span><span style="font-size:9pt;font-family:"Courier New"">KSPSolve</span><span style="font-size:9pt;font-family:Helvetica"> function.
Specifically,<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span><b>I have noticed that the time taken by </b></span><b><span style="font-size:9pt;font-family:"Courier New"">KSPSolve</span></b><b><span style="font-size:9pt;font-family:Helvetica"> is<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span></b><b><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">almost
two times<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span></b><b><span style="font-size:9pt;font-family:Helvetica">greater than the CPU time for matrix-vector product multiplied by the number of iteration steps</span></b><span style="font-size:9pt;font-family:Helvetica">.<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">I
use C++ chrono to record CPU time.</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">For context, I am using a shell system matrix</span><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span lang="EN-US" style="font-size:9pt;font-family:Helvetica"> </span></span><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">A</span><span style="font-size:9pt;font-family:Helvetica">.
Despite my efforts to<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">parallelize</span><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span style="font-size:9pt;font-family:Helvetica"> </span></span><span style="font-size:9pt;font-family:Helvetica">the
matrix-vector product</span><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span lang="EN-US" style="font-size:9pt;font-family:Helvetica"> </span></span><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">(Ax)</span><span style="font-size:9pt;font-family:Helvetica">,
the overall solve time remains higher</span><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span lang="EN-US" style="font-size:9pt;font-family:Helvetica"> </span></span><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">than the matrix
vector product per iteration indicates when multiple threads were used</span><span style="font-size:9pt;font-family:Helvetica">. Here are a few details of my setup:</span><u></u><u></u></p>
</div>
</div>
</div>
<ul style="margin-top:0cm" type="disc">
<li class="MsoNormal"><b><span style="font-size:9pt;font-family:Helvetica">Matrix Type</span></b><span style="font-size:9pt;font-family:Helvetica">: Shell system matrix</span><u></u><u></u></li><li class="MsoNormal"><b><span style="font-size:9pt;font-family:Helvetica">Preconditioner</span></b><span style="font-size:9pt;font-family:Helvetica">:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">Shell
PC</span><u></u><u></u></li><li class="MsoNormal"><b><span style="font-size:9pt;font-family:Helvetica">Parallel Environment</span></b><span style="font-size:9pt;font-family:Helvetica">:<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">Using
Intel MKL as PETSc’s BLAS/LAPACK library, multithreading is enabled</span><u></u><u></u></li></ul>
<div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">I have considered several potential reasons, such as preconditioner setup, additional solver operations, and the inherent overhead of using a shell system matrix.<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span><b>However,
since KSPSolve is a high-level API, I have been unable to pinpoint the exact cause of the increased solve time.</b></span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">Have you observed the same issue?<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><span style="font-size:9pt;font-family:Helvetica">Could you</span><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span lang="EN-US" style="font-size:9pt;font-family:Helvetica"> </span></span><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">please<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><span style="font-size:9pt;font-family:Helvetica">provide
some<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">experience<span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"> </span></span><span style="font-size:9pt;font-family:Helvetica">on
how to diagnose and address this performance discrepancy? Any insights or recommendations you could offer would be greatly appreciated.</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">For any performance question like this, we need to see the output of your code run with</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>-ksp_view -ksp_monitor_true_residual -ksp_converged_reason -log_view</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> <span class="m_-6075196701903926580apple-converted-space"> </span>Thanks,</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> Matt</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<blockquote style="border-top:none currentcolor;border-right:none currentcolor;border-bottom:none currentcolor;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">Thank you for your time and assistance.</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">Best</span><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span lang="EN-US" style="font-size:9pt;font-family:Helvetica"> </span></span><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">regards,</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9pt;font-family:Helvetica">Yongzhong</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">-----------------------------------------------------------</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">Yongzhong Li</span></b><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">PhD student | Electromagnetics Group</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">Department of Electrical & Computer Engineering</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">University of Toronto</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><a href="https://urldefense.us/v3/__http://www.modelics.org__;!!G_uCfscf7eWS!cuLttMJEcegaqu461Bt4QLsO4fASfLM5vjRbtyNhWJQiInbjgNwkGNdkFE1ebSbFjOUatYB0-jd2yQWMWzqkDFFjwMvNl3ZKAr8$" target="_blank"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(5,99,193)">http://www.modelics.org</span></a><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"><br clear="all">
</span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span class="m_-6075196701903926580m-4861803116733450987gmailsignatureprefix"><span style="font-size:9pt;font-family:Helvetica">--</span></span><span class="m_-6075196701903926580m-4861803116733450987apple-converted-space"><span style="font-size:9pt;font-family:Helvetica"> </span></span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!djGfJnEhNJROfsMsBJy5u_KoRKbug55xZ64oHKUFnH2cWku_Th1hwt4TDdoMd8pWYVDzJeqJslMNZwpO3y0Et94d31qkNOuenGA$" target="_blank"><span style="font-size:9pt;font-family:Helvetica">https://www.cse.buffalo.edu/~knepley/</span></a><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"><ksp_petsc_log.txt></span><u></u><u></u></p>
</div>
</div>
</div>
</blockquote>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9pt;font-family:Helvetica"><ksp_petsc_log.txt><ksp_petsc_log_noguess.txt></span><u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div></blockquote></div>