[petsc-users] Issue with single precision complex numbers in petsc4py
Peng Sun
psun at outlook.com
Fri Oct 14 11:42:09 CDT 2022
Hi Barry,
I overwrote the old v3.12.0 with the latest version of 3.18.0, and I could use single-precision complex successfully. Then I switched back to v3.12.0 and I can reproduce the same issue. So it seems like that the single-precision complex issue is specific to v3.12.0. I do not necessarily need to use the old version. Thanks for your help!
Best regards,
Peng Sun
________________________________
From: Barry Smith <bsmith at petsc.dev>
Sent: Thursday, October 13, 2022 7:03 PM
To: Peng Sun <psun at outlook.com>
Cc: Zhang, Hong <hongzhang at anl.gov>; petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] Issue with single precision complex numbers in petsc4py
Is there any reason you can't use the most recent version of PETSc4py? The one you are working with is several years old
On Oct 13, 2022, at 8:53 PM, Peng Sun <psun at outlook.com<mailto:psun at outlook.com>> wrote:
Hi Hong,
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.
Best regards,
Peng Sun
________________________________
From: Zhang, Hong <hongzhang at anl.gov<mailto:hongzhang at anl.gov>>
Sent: Thursday, October 13, 2022 4:30 PM
To: Peng Sun <psun at outlook.com<mailto:psun at outlook.com>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [petsc-users] Issue with single precision complex numbers in petsc4py
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.
Hong (Mr.)
> On Oct 13, 2022, at 10:42 AM, Peng Sun <psun at outlook.com<mailto:psun at outlook.com>> wrote:
>
> Hi Matt,
>
> Sure, please see the attached configure.log file. Thanks!
>
> Best regards,
> Peng Sun
>
>
> From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
> Sent: Thursday, October 13, 2022 6:34 AM
> To: Peng Sun <psun at outlook.com<mailto:psun at outlook.com>>
> Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
> Subject: Re: [petsc-users] Issue with single precision complex numbers in petsc4py
>
> First send configure.log so we can see the setup.
>
> Thanks,
>
> Matt
>
> On Thu, Oct 13, 2022 at 12:53 AM Peng Sun <psun at outlook.com<mailto:psun at outlook.com>> wrote:
> Dear PETSc community,
>
> 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.
>
> 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!
>
> import
> petsc4py
>
> import
> sys
> petsc4py.init(sys.argv)
>
> from petsc4py import
> PETSc
>
> da=PETSc.DA().create(sizes=[
> 2,2,2],dof=1,stencil_type=0,stencil_width=1,boundary_type=1
> )
> da_1 = da.createGlobalVec()
>
> print
> (petsc4py.PETSc.ComplexType)
>
> print(da_1.getArray().dtype)
>
>
>
> Best regards,
> Peng Sun
>
>
> --
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <configure.log>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221014/8dc18904/attachment.html>
More information about the petsc-users
mailing list