<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><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="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><div class="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; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">Hi Hong,</div><div class="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; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;"><br class=""></div><div class="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; -webkit-text-stroke-width: 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="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; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;"><br class=""></div><div class="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; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">Best regards,</div><div class="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; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">Peng Sun<br class=""></div><div id="appendonsend" style="caret-color: rgb(0, 0, 0); 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; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div><hr tabindex="-1" style="caret-color: rgb(0, 0, 0); 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; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline-block; width: 977.046875px;" class=""><span style="caret-color: rgb(0, 0, 0); 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; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""></span><div id="divRplyFwdMsg" dir="ltr" style="caret-color: rgb(0, 0, 0); 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; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><b class="">From:</b><span class="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="Apple-converted-space"> </span>Thursday, October 13, 2022 4:30 PM<br class=""><b class="">To:</b><span class="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="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="Apple-converted-space"> </span>Re: [petsc-users] Issue with single precision complex numbers in petsc4py</font><div class=""> </div></div><div class="BodyFragment" style="caret-color: rgb(0, 0, 0); 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; -webkit-text-stroke-width: 0px; text-decoration: none;"><font size="2" class=""><span style="font-size: 11pt;" class=""><div class="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="Apple-converted-space"> </span><br class="">> Hi Matt,<br class="">><span class="Apple-converted-space"> </span><br class="">> Sure, please see the attached configure.log file. Thanks!<br class="">><span class="Apple-converted-space"> </span><br class="">> Best regards,<br class="">> Peng Sun<br class="">><span class="Apple-converted-space"> </span><br class="">><span class="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="Apple-converted-space"> </span><br class="">> First send configure.log so we can see the setup.<br class="">><span class="Apple-converted-space"> </span><br class="">> Thanks,<br class="">><span class="Apple-converted-space"> </span><br class="">> Matt<br class="">><span class="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="Apple-converted-space"> </span><br class="">><span class="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="Apple-converted-space"> </span><br class="">><span class="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="Apple-converted-space"> </span><br class="">> import<br class="">> petsc4py<br class="">><span class="Apple-converted-space"> </span><br class="">> import<br class="">> sys<br class="">> petsc4py.init(sys.argv)<br class="">><span class="Apple-converted-space"> </span><br class="">> from petsc4py import<br class="">> PETSc<br class="">><span class="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="Apple-converted-space"> </span><br class="">> print<br class="">> (petsc4py.PETSc.ComplexType)<br class="">><span class="Apple-converted-space"> </span><br class="">> print(da_1.getArray().dtype)<br class="">><span class="Apple-converted-space"> </span><br class="">><span class="Apple-converted-space"> </span><br class="">><span class="Apple-converted-space"> </span><br class="">> Best regards,<br class="">> Peng Sun<br class="">><span class="Apple-converted-space"> </span><br class="">><span class="Apple-converted-space"> </span><br class="">> --<span class="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="Apple-converted-space"> </span><br class="">><span class="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=""></body></html>