[petsc-users] Correct approach for updating deprecated code

Patrick Sanan patrick.sanan at gmail.com
Tue Mar 3 02:46:00 CST 2020


There was a relevant change in PETSc 3.8, you now need to call DMSetUp()
after DMDACreate1d(), DMDACreate2d(), or DMDACreate3d().

https://www.mcs.anl.gov/petsc/documentation/changes/38.html
"Replace calls to DMDACreateXd() with DMDACreateXd(), [DMSetFromOptions()]
DMSetUp()"

Am Di., 3. März 2020 um 05:46 Uhr schrieb Richard Beare via petsc-users <
petsc-users at mcs.anl.gov>:

> This is the error. Maybe nothing to do with the viewer part and something
> to do with changes in initialization? Something that has happened since
> version 3.6.3, perhaps.
>
> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
> [0]PETSC ERROR: Operation done in wrong order
> [0]PETSC ERROR: You should call DMSetUp() first
> [0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> [0]PETSC ERROR: Petsc Development GIT revision: v3.12.4-753-gbac983c101
>  GIT Date: 2020-02-18 15:05:54 +0000
> [0]PETSC ERROR: simul_atrophy on a  named m3j007 by rbeare Tue Mar  3
> 14:12:22 2020
> [0]PETSC ERROR: Configure options --with-cc=gcc-6 --with-cxx=g++-6
> --with-fc=gfortran --download-mpich --download-fblaslapack --with-clangu
> age=cxx --prefix=/opt/petsc/ --with-64-bit-indices=yes
> [0]PETSC ERROR: #1 DMDASetFieldName() line 68 in
> /petsc/src/dm/impls/da/dacorn.c
> [0]PETSC ERROR: #2 PetscAdLemTaras3D() line 68 in
> /simul-atrophy/src/includes/PetscAdLemTaras3D.hxx
> terminate called after throwing an instance of 'std::runtime_error'
>   what():  Error detected in C PETSc
> SIGABRT: abort
> PC=0x47282b m=0 sigcode=0
>
> goroutine 1 [running, locked to thread]:
> syscall.RawSyscall(0x3e, 0x5cbd, 0x6, 0x0, 0xc0001e3ef0, 0x48f422, 0x5cbd)
>         /usr/local/go/1.11.1/src/syscall/asm_linux_amd64.s:78 +0x2b
> fp=0xc0001e3eb8 sp=0xc0001e3eb0 pc=0x47282b
> syscall.Kill(0x5cbd, 0x6, 0x4377de, 0xc0001e3f20)
>         /usr/local/go/1.11.1/src/syscall/zsyscall_linux_amd64.go:597 +0x4b
> fp=0xc0001e3f00 sp=0xc0001e3eb8 pc=0x46f1db
> github.com/sylabs/singularity/internal/app/starter.Master.func4()
>         internal/app/starter/master_linux.go:158 +0x3e fp=0xc0001e3f38
> sp=0xc0001e3f00 pc=0x8d51be
> github.com/sylabs/singularity/internal/pkg/util/mainthread.Execute.func1()
>         internal/pkg/util/mainthread/mainthread.go:20 +0x2f
> fp=0xc0001e3f60 sp=0xc0001e3f38 pc=0x87472f
> main.main()
>         cmd/starter/main_linux.go:102 +0x68 fp=0xc0001e3f98
> sp=0xc0001e3f60 pc=0x8d59f8
> runtime.main()
>         /usr/local/go/1.11.1/src/runtime/proc.go:201 +0x207
> fp=0xc0001e3fe0 sp=0xc0001e3f98 pc=0x42faa7
> runtime.goexit()
>         /usr/local/go/1.11.1/src/runtime/asm_amd64.s:1333 +0x1
> fp=0xc0001e3fe8 sp=0xc0001e3fe0 pc=0x45b4f1
>
> goroutine 5 [syscall]:
> os/signal.signal_recv(0xaa2620)
>         /usr/local/go/1.11.1/src/runtime/sigqueue.go:139 +0x9c
> os/signal.loop()
>         /usr/local/go/1.11.1/src/os/signal/signal_unix.go:23 +0x22
> created by os/signal.init.0
>         /usr/local/go/1.11.1/src/os/signal/signal_unix.go:29 +0x41
>
> goroutine 7 [chan receive]:
>
> github.com/sylabs/singularity/internal/pkg/util/mainthread.Execute(0xc0003e83a0)
>         internal/pkg/util/mainthread/mainthread.go:23 +0xb4
> github.com/sylabs/singularity/internal/app/starter.Master(0x4, 0xa,
> 0x2300, 0x5cca, 0xc000213e00)
>         internal/app/starter/master_linux.go:157 +0x44e
> main.startup()
>         cmd/starter/main_linux.go:73 +0x563
> created by main.main
>         cmd/starter/main_linux.go:98 +0x3e
>
> On Tue, 25 Feb 2020 at 03:04, Matthew Knepley <knepley at gmail.com> wrote:
>
>> On Sun, Feb 23, 2020 at 6:45 PM Richard Beare <richard.beare at monash.edu>
>> wrote:
>>
>>> That's what I did (see below), but I got ordering errors (unfortunately
>>> deleted those logs too soon). I'll rerun if no one recognises what I've
>>> done wrong.
>>>
>>> PetscViewer viewer1;
>>> ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,fileName.c_str
>>> (),FILE_MODE_WRITE,&viewer1);CHKERRQ(ierr);
>>> //ierr =
>>> PetscViewerSetFormat(viewer1,PETSC_VIEWER_BINARY_MATLAB);CHKERRQ(ierr);
>>> ierr = PetscViewerPushFormat(viewer1,PETSC_VIEWER_BINARY_MATLAB);CHKERRQ
>>> (ierr);
>>>
>>
>> This should not cause problems. However, is it possible that somewhere
>> you are pushing a format
>> again and again without popping? This could exceed the stack size.
>>
>>   Thanks,
>>
>>     Matt
>>
>>
>>> ierr = PetscObjectSetName((PetscObject)mX,"x");CHKERRQ(ierr);
>>> ierr = PetscObjectSetName((PetscObject)mB,"b");CHKERRQ(ierr);
>>>
>>> On Mon, 24 Feb 2020 at 10:43, Matthew Knepley <knepley at gmail.com> wrote:
>>>
>>>> On Sun, Feb 23, 2020 at 6:25 PM Richard Beare via petsc-users <
>>>> petsc-users at mcs.anl.gov> wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>> The following code gives a deprecation warning. What is the correct
>>>>> way of updating the use of ViewerSetFormat to ViewerPushFormat (which I
>>>>> presume is the preferred replacement). My first attempt gave errors
>>>>> concerning ordering.
>>>>>
>>>>
>>>> You can't just change SetFormat to PushFormat here?
>>>>
>>>>   Matt
>>>>
>>>>
>>>>> Thanks
>>>>>
>>>>> PetscViewer viewer1;
>>>>> ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,fileName.c_str
>>>>> (),FILE_MODE_WRITE,&viewer1);CHKERRQ(ierr);
>>>>> ierr = PetscViewerSetFormat(viewer1,PETSC_VIEWER_BINARY_MATLAB);
>>>>> CHKERRQ(ierr);
>>>>>
>>>>> ierr = PetscObjectSetName((PetscObject)mX,"x");CHKERRQ(ierr);
>>>>> ierr = PetscObjectSetName((PetscObject)mB,"b");CHKERRQ(ierr);
>>>>>
>>>>> ierr = VecView(mX,viewer1);CHKERRQ(ierr);
>>>>> ierr = VecView(mB,viewer1);CHKERRQ(ierr);
>>>>>
>>>>>
>>>>> --
>>>>> --
>>>>> A/Prof Richard Beare
>>>>> Imaging and Bioinformatics, Peninsula Clinical School
>>>>> orcid.org/0000-0002-7530-5664
>>>>> Richard.Beare at monash.edu
>>>>> +61 3 9788 1724
>>>>>
>>>>>
>>>>>
>>>>> Geospatial Research:
>>>>> https://www.monash.edu/medicine/scs/medicine/research/geospatial-analysis
>>>>>
>>>>
>>>>
>>>> --
>>>> 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/
>>>> <http://www.cse.buffalo.edu/~knepley/>
>>>>
>>>
>>>
>>> --
>>> --
>>> A/Prof Richard Beare
>>> Imaging and Bioinformatics, Peninsula Clinical School
>>> orcid.org/0000-0002-7530-5664
>>> Richard.Beare at monash.edu
>>> +61 3 9788 1724
>>>
>>>
>>>
>>> Geospatial Research:
>>> https://www.monash.edu/medicine/scs/medicine/research/geospatial-analysis
>>>
>>
>>
>> --
>> 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/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>
>
> --
> --
> A/Prof Richard Beare
> Imaging and Bioinformatics, Peninsula Clinical School
> orcid.org/0000-0002-7530-5664
> Richard.Beare at monash.edu
> +61 3 9788 1724
>
>
>
> Geospatial Research:
> https://www.monash.edu/medicine/scs/medicine/research/geospatial-analysis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200303/8cdf70a5/attachment.html>


More information about the petsc-users mailing list