[petsc-users] Error with MatView on multiple processors
Barry Smith
bsmith at mcs.anl.gov
Fri Jun 3 10:53:51 CDT 2016
> On Jun 3, 2016, at 10:13 AM, Paul Urbanczyk <gomer at stanford.edu> wrote:
>
> For the benefit of anyone else who happens to run into this issue...
>
> Earlier in my code, I had used the function DMDAGetAO(DM da, AO *ao), and then destroyed the AO at the end of the function with AODestroy.
>
> I'm guessing that, when I did this, I destroyed the AO for the DM, so when it came time to view the matrix, PETSc could not convert the numbering for display.
>
> Does this sound right or make sense?
Yes. For PETSc "Get" operations there is sometimes a corresponding "Restore" operation and sometimes not but one should never Destroy() an object obtained with Get (unless one increased the reference count on the object themselves) because it will cause a hanging reference that can cause a crash later. I'll check the manual page for DMDAGetAO to make sure it indicates this.
Barry
> Thanks,
> Paul
>
> On 05/27/2016 06:43 PM, Matthew Knepley wrote:
>> On Fri, May 27, 2016 at 8:38 PM, Paul Urbanczyk <gomer at stanford.edu> wrote:
>> On 05/27/2016 05:44 PM, Matthew Knepley wrote:
>>> On Fri, May 27, 2016 at 6:34 PM, Paul Urbanczyk <gomer at stanford.edu> wrote:
>>> Hello,
>>>
>>> I'm having trouble with the MatView function drawing the matrix structure(s) when I execute my code on multiple processors.
>>>
>>> When I run on a single processor, the code runs fine, and the graphics window displays cleanly.
>>>
>>> Lets start with an example. I do this
>>>
>>> cd $PETSC_DIR/src/snes/examples/tutorials
>>> make ex19
>>>
>>> Make sure it runs
>>>
>>> ./ex19 -snes_monitor
>>>
>>> Make sure it runs in parallel (maybe you need $PETSC_DIR/$PETSC_ARCH/bin/mpiexec)
>>>
>>> mpiexec -n 2 ./ex19 -snes_monitor
>>>
>>> Make sure it can draw
>>>
>>> mpiexec -n 2 ./ex19 -snes_monitor -mat_view draw -draw_pause 1
>>>
>>> This runs fine for me. Can you try it?
>>>
>>> Thanks,
>>>
>>> Matt
>> Hello Matt,
>>
>> Yes, this example seems to run just fine. How should I proceed?
>>
>> I am not sure what you are doing in your code. Can you try and change one of these examples
>> to do something like what you do? SNEX ex19 seems like it does things mostly the way you
>> describe.
>>
>> Matt
>>
>>
>> -Paul
>>>
>>> When I run with multiple processors, I get error messages (see below).
>>>
>>> The matrices are constructed with DMCreateMatrix(da, &A_matrix).
>>>
>>> I then set the values with MatSetValuesStencil(A_matrix,1,&row,2,col_A,value_A,INSERT_VALUES).
>>>
>>> Finally, I call MatAssemblyBegin(A_matrix,MAT_FINAL_ASSEMBLY) and MatAssemblyEnd(A_matrix,MAT_FINAL_ASSEMBLY).
>>>
>>> I also test that the matrices are assembled with MatAssembled(A_matrix, &is_assembled_bool), and it appears they are successfully assembled.
>>>
>>> Any help/advice is greatly appreciated.
>>>
>>> Thanks in advance!
>>>
>>> -Paul Urbanczyk
>>>
>>> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
>>> [0]PETSC ERROR: Invalid argument
>>> [0]PETSC ERROR: Wrong type of object: Parameter # 1
>>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
>>> [0]PETSC ERROR: Petsc Release Version 3.7.1, unknown
>>> [0]PETSC ERROR: ./urbanSCFD on a arch-linux2-c-debug named prometheus by gomer Fri May 27 16:29:01 2016
>>> [0]PETSC ERROR: Configure options --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90
>>> [0]PETSC ERROR: #1 AOApplicationToPetsc() line 267 in /home/gomer/local/petsc/src/vec/is/ao/interface/ao.c
>>> [0]PETSC ERROR: #2 MatView_MPI_DA() line 557 in /home/gomer/local/petsc/src/dm/impls/da/fdda.c
>>> [0]PETSC ERROR: #3 MatView() line 901 in /home/gomer/local/petsc/src/mat/interface/matrix.c
>>> [1]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
>>> [1]PETSC ERROR: Invalid argument
>>> [1]PETSC ERROR: Wrong type of object: Parameter # 1
>>> [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
>>> [1]PETSC ERROR: Petsc Release Version 3.7.1, unknown
>>> [1]PETSC ERROR: ./urbanSCFD on a arch-linux2-c-debug named prometheus by gomer Fri May 27 16:29:01 2016
>>> [1]PETSC ERROR: Configure options --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90
>>> [1]PETSC ERROR: #1 AOApplicationToPetsc() line 267 in /home/gomer/local/petsc/src/vec/is/ao/interface/ao.c
>>> [1]PETSC ERROR: #2 MatView_MPI_DA() line 557 in /home/gomer/local/petsc/src/dm/impls/da/fdda.c
>>> [1]PETSC ERROR: #3 MatView() line 901 in /home/gomer/local/petsc/src/mat/interface/matrix.c
>>> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
>>> [0]PETSC ERROR: Invalid argument
>>> [1]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
>>> [1]PETSC ERROR: Invalid argument
>>> [1]PETSC ERROR: Wrong type of object: Parameter # 1
>>> [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
>>> [1]PETSC ERROR: Petsc Release Version 3.7.1, unknown
>>> [1]PETSC ERROR: ./urbanSCFD on a arch-linux2-c-debug named prometheus by gomer Fri May 27 16:29:01 2016
>>> [1]PETSC ERROR: Configure options --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90
>>> [1]PETSC ERROR: #4 AOApplicationToPetsc() line 267 in /home/gomer/local/petsc/src/vec/is/ao/interface/ao.c
>>> [1]PETSC ERROR: #5 MatView_MPI_DA() line 557 in /home/gomer/local/petsc/src/dm/impls/da/fdda.c
>>> [1]PETSC ERROR: #6 MatView() line 901 in /home/gomer/local/petsc/src/mat/interface/matrix.c
>>> [0]PETSC ERROR: Wrong type of object: Parameter # 1
>>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
>>> [0]PETSC ERROR: Petsc Release Version 3.7.1, unknown
>>> [0]PETSC ERROR: ./urbanSCFD on a arch-linux2-c-debug named prometheus by gomer Fri May 27 16:29:01 2016
>>> [0]PETSC ERROR: Configure options --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90
>>> [0]PETSC ERROR: #4 AOApplicationToPetsc() line 267 in /home/gomer/local/petsc/src/vec/is/ao/interface/ao.c
>>> [0]PETSC ERROR: #5 MatView_MPI_DA() line 557 in /home/gomer/local/petsc/src/dm/impls/da/fdda.c
>>> [0]PETSC ERROR: #6 MatView() line 901 in /home/gomer/local/petsc/src/mat/interface/matrix.c
>>>
>>>
>>>
>>>
>>>
>>> --
>>> 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
>>
>>
>>
>>
>> --
>> 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
>
More information about the petsc-users
mailing list