<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 14, 2022, 19:46 Peng Sun <<a href="mailto:psun@outlook.com">psun@outlook.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Stefano,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
No I used pip to install petsc4py after I installed PETSc.  I did not see the binding folder under /src</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Not sure which was the first version petsc4py was shipped with PETSc , for sure 3.18 has it.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Best regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Peng Sun<br>
</div>
<div id="m_4256868489505288206appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_4256868489505288206divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com" target="_blank" rel="noreferrer">stefano.zampini@gmail.com</a>><br>
<b>Sent:</b> Friday, October 14, 2022 4:36 AM<br>
<b>To:</b> Peng Sun <<a href="mailto:psun@outlook.com" target="_blank" rel="noreferrer">psun@outlook.com</a>><br>
<b>Cc:</b> Zhang, Hong <<a href="mailto:hongzhang@anl.gov" target="_blank" rel="noreferrer">hongzhang@anl.gov</a>>; <a href="mailto:petsc-users@mcs.anl.gov" target="_blank" rel="noreferrer">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank" rel="noreferrer">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> Re: [petsc-users] Issue with single precision complex numbers in petsc4py</font>
<div> </div>
</div>
<div style="word-wrap:break-word;line-break:after-white-space"><br>
<div><br>
<blockquote type="cite">
<div>On Oct 14, 2022, at 3:53 AM, Peng Sun <<a href="mailto:psun@outlook.com" target="_blank" rel="noreferrer">psun@outlook.com</a>> wrote:</div>
<br>
<div>
<div style="font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-family:Calibri,Helvetica,sans-serif;font-size:12pt">
Hi Hong,</div>
<div style="font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-family:Calibri,Helvetica,sans-serif;font-size:12pt">
<br>
</div>
<div style="font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-family:Calibri,Helvetica,sans-serif;font-size:12pt">
Thanks for the advice.  I could not install petsc4py with the --with-petsc4py=1 option, which gave me an "No rule to make target 'petsc4py-install'" error when I ran "make install".   That was why I needed to install petsc4py separately after the PETSc was
 installed.<br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div><br>
</div>
After you installed PETSc, go to src/binding/petsc4py and run make install there. It will install in .local and it will be visible to python.</div>
<div>Is this how you installed it? <br>
<blockquote type="cite">
<div>
<div style="font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-family:Calibri,Helvetica,sans-serif;font-size:12pt">
<br>
</div>
<div style="font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-family:Calibri,Helvetica,sans-serif;font-size:12pt">
Best regards,</div>
<div style="font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-family:Calibri,Helvetica,sans-serif;font-size:12pt">
Peng Sun<br>
</div>
<div id="m_4256868489505288206x_appendonsend" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
</div>
<hr style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;display:inline-block;width:977.046875px">
<span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!important"></span>
<div id="m_4256868489505288206x_divRplyFwdMsg" dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
<font face="Calibri, sans-serif" style="font-size:11pt"><b>From:</b><span> </span>Zhang, Hong <<a href="mailto:hongzhang@anl.gov" target="_blank" rel="noreferrer">hongzhang@anl.gov</a>><br>
<b>Sent:</b><span> </span>Thursday, October 13, 2022 4:30 PM<br>
<b>To:</b><span> </span>Peng Sun <<a href="mailto:psun@outlook.com" target="_blank" rel="noreferrer">psun@outlook.com</a>><br>
<b>Cc:</b><span> </span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank" rel="noreferrer">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank" rel="noreferrer">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b><span> </span>Re: [petsc-users] Issue with single precision complex numbers in petsc4py</font>
<div> </div>
</div>
<div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
<font size="2"><span style="font-size:11pt">
<div>It seems that you installed petsc4py separately. I would suggest to add the configure option --with-petsc4py=1 and follow the instructions to set PYTHONPATH before using petsc4py.<br>
<br>
Hong (Mr.)<br>
<br>
> On Oct 13, 2022, at 10:42 AM, Peng Sun <<a href="mailto:psun@outlook.com" target="_blank" rel="noreferrer">psun@outlook.com</a>> wrote:<br>
><span> </span><br>
> Hi Matt,<br>
><span> </span><br>
> Sure, please see the attached configure.log file.  Thanks!<br>
><span> </span><br>
> Best regards,<br>
> Peng Sun<br>
><span> </span><br>
><span> </span><br>
> From: Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" rel="noreferrer">knepley@gmail.com</a>><br>
> Sent: Thursday, October 13, 2022 6:34 AM<br>
> To: Peng Sun <<a href="mailto:psun@outlook.com" target="_blank" rel="noreferrer">psun@outlook.com</a>><br>
> Cc: <a href="mailto:petsc-users@mcs.anl.gov" target="_blank" rel="noreferrer">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank" rel="noreferrer">petsc-users@mcs.anl.gov</a>><br>
> Subject: Re: [petsc-users] Issue with single precision complex numbers in petsc4py<br>
> <span> </span><br>
> First send configure.log so we can see the setup.<br>
><span> </span><br>
>   Thanks,<br>
><span> </span><br>
>       Matt<br>
><span> </span><br>
> On Thu, Oct 13, 2022 at 12:53 AM Peng Sun <<a href="mailto:psun@outlook.com" target="_blank" rel="noreferrer">psun@outlook.com</a>> wrote:<br>
> Dear PETSc community,<span> </span><br>
><span> </span><br>
> I have a question regarding the single precision complex numbers of petsc4py.  I configured PETSc with the “--with-scalar-type=complex --with-precision=single" option before compiling, but all the DA structures I created with petsc4py had double precision. <span> </span><br>
><span> </span><br>
> Here is a minimum test code on Python 3.8/PETSc 3.12/petsc4py 3.12: both print commands show data type of complex128.  Could anybody please help me?  Thanks!<br>
><span> </span><br>
> import<br>
>  petsc4py<br>
><span> </span><br>
> import<br>
>  sys<br>
> petsc4py.init(sys.argv)<br>
><span> </span><br>
> from petsc4py import<br>
>  PETSc<br>
><span> </span><br>
> da=PETSc.DA().create(sizes=[<br>
> 2,2,2],dof=1,stencil_type=0,stencil_width=1,boundary_type=1<br>
> )<br>
> da_1 = da.createGlobalVec()<br>
><span> </span><br>
> print<br>
> (petsc4py.PETSc.ComplexType)<br>
><span> </span><br>
> print(da_1.getArray().dtype)<br>
><span> </span><br>
><span> </span><br>
><span> </span><br>
> Best regards,<br>
> Peng Sun<br>
><span> </span><br>
><span> </span><br>
> --<span> </span><br>
> 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<br>
><span> </span><br>
><span> </span><a href="https://www.cse.buffalo.edu/~knepley/" target="_blank" rel="noreferrer">https://www.cse.buffalo.edu/~knepley/</a><br>
> <configure.log></div>
</span></font></div>
</div>
</blockquote>
</div>
<br>
</div>
</div>

</blockquote></div></div></div>