<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Hi Stefano,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
No I used pip to install petsc4py after I installed PETSc.  I did not see the binding folder under /src.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Best regards,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Peng Sun<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Stefano Zampini <stefano.zampini@gmail.com><br>
<b>Sent:</b> Friday, October 14, 2022 4:36 AM<br>
<b>To:</b> Peng Sun <psun@outlook.com><br>
<b>Cc:</b> Zhang, Hong <hongzhang@anl.gov>; petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Subject:</b> Re: [petsc-users] Issue with single precision complex numbers in petsc4py</font>
<div> </div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space"><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Oct 14, 2022, at 3:53 AM, Peng Sun <<a href="mailto:psun@outlook.com" class="">psun@outlook.com</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<div class="">
<div class="x_elementToProof" 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 class="x_elementToProof" 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 class="">
</div>
<div class="x_elementToProof" 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 class="">
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div><br class="">
</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 class="">
<blockquote type="cite" class="">
<div class="">
<div class="x_elementToProof" 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 class="">
</div>
<div class="x_elementToProof" 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 class="x_elementToProof" 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 class="">
</div>
<div id="x_appendonsend" class="" 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 tabindex="-1" class="" 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 class="" 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="x_divRplyFwdMsg" dir="ltr" class="" 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" class="" style="font-size:11pt"><b class="">From:</b><span class="x_Apple-converted-space"> </span>Zhang, Hong <<a href="mailto:hongzhang@anl.gov" class="">hongzhang@anl.gov</a>><br class="">
<b class="">Sent:</b><span class="x_Apple-converted-space"> </span>Thursday, October 13, 2022 4:30 PM<br class="">
<b class="">To:</b><span class="x_Apple-converted-space"> </span>Peng Sun <<a href="mailto:psun@outlook.com" class="">psun@outlook.com</a>><br class="">
<b class="">Cc:</b><span class="x_Apple-converted-space"> </span><a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>><br class="">
<b class="">Subject:</b><span class="x_Apple-converted-space"> </span>Re: [petsc-users] Issue with single precision complex numbers in petsc4py</font>
<div class=""> </div>
</div>
<div class="x_BodyFragment" 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" class=""><span class="" style="font-size:11pt">
<div class="x_PlainText">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 class="">
<br class="">
Hong (Mr.)<br class="">
<br class="">
> On Oct 13, 2022, at 10:42 AM, Peng Sun <<a href="mailto:psun@outlook.com" class="">psun@outlook.com</a>> wrote:<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> Hi Matt,<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> Sure, please see the attached configure.log file.  Thanks!<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> Best regards,<br class="">
> Peng Sun<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> From: Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>><br class="">
> Sent: Thursday, October 13, 2022 6:34 AM<br class="">
> To: Peng Sun <<a href="mailto:psun@outlook.com" class="">psun@outlook.com</a>><br class="">
> Cc: <a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>><br class="">
> Subject: Re: [petsc-users] Issue with single precision complex numbers in petsc4py<br class="">
> <span class="x_Apple-converted-space"> </span><br class="">
> First send configure.log so we can see the setup.<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
>   Thanks,<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
>       Matt<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> On Thu, Oct 13, 2022 at 12:53 AM Peng Sun <<a href="mailto:psun@outlook.com" class="">psun@outlook.com</a>> wrote:<br class="">
> Dear PETSc community,<span class="x_Apple-converted-space"> </span><br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> 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 class="x_Apple-converted-space"> </span><br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> 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 class="">
><span class="x_Apple-converted-space"> </span><br class="">
> import<br class="">
>  petsc4py<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> import<br class="">
>  sys<br class="">
> petsc4py.init(sys.argv)<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> from petsc4py import<br class="">
>  PETSc<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> da=PETSc.DA().create(sizes=[<br class="">
> 2,2,2],dof=1,stencil_type=0,stencil_width=1,boundary_type=1<br class="">
> )<br class="">
> da_1 = da.createGlobalVec()<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> print<br class="">
> (petsc4py.PETSc.ComplexType)<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> print(da_1.getArray().dtype)<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
><span class="x_Apple-converted-space"> </span><br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> Best regards,<br class="">
> Peng Sun<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
><span class="x_Apple-converted-space"> </span><br class="">
> --<span class="x_Apple-converted-space"> </span><br class="">
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
> -- Norbert Wiener<br class="">
><span class="x_Apple-converted-space"> </span><br class="">
><span class="x_Apple-converted-space"> </span><a href="https://www.cse.buffalo.edu/~knepley/" class="">https://www.cse.buffalo.edu/~knepley/</a><br class="">
> <configure.log></div>
</span></font></div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>