Re: [petsc-users] A question about DMPlexDistribute

2016-08-12 Thread leejearl
Thank you for your reply. The source code I have used is from the 
website of PETSc, not from the git repository.


I will have a test with the code from git repository.


leejearl


On 2016年08月13日 08:49, Oxberry, Geoffrey Malcolm wrote:


On Aug 12, 2016, at 5:41 PM, leejearl > wrote:


Hi, Matt:



> Can you verify that you are running the master branch?


cd ${PETSC_DIR}
git branch

The last command should return something like a list of branch names, 
and the branch name with an asterisk to the left of it will be the 
branch you are currently on.


Geoff


I am not sure, how can I verify this?
And I configure PETSc with this command
"./configure --prefix=$HOME/Install/petsc-openmpi 
--with-mpi=/home/leejearl/Install/openmpi/gnu/1.8.4 
--download-exodusii=yes --download-netcdf 
--with-hdf5-dir=/home/leejearl/Install/hdf5-1.8.14 --download-metis=yes".
Is there some problem? Can you show me your command for configuring 
PETSc?



Thanks

leejearl





On 2016年08月13日 01:10, Matthew Knepley wrote:
On Thu, Aug 11, 2016 at 8:00 PM, leejearl > wrote:


Thank you for your reply. I have attached the code, grid and the
error message.

cavity.c is the code file, cavity.exo is the grid, and error.dat
is the error message.

The command is "mpirun -n 2 ./cavity


Can you verify that you are running the master branch? I just ran 
this and got


DM Object: 2 MPI processes
  type: plex
DM_0x8404_0 in 2 dimensions:
  0-cells: 5253 5252
  1-cells: 10352 10350
  2-cells: 5298 (198) 5297 (198)
Labels:
  ghost: 2 strata of sizes (199, 400)
  vtk: 1 strata of sizes (4901)
  Cell Sets: 1 strata of sizes (5100)
  Face Sets: 3 strata of sizes (53, 99, 50)
  depth: 3 strata of sizes (5253, 10352, 5298)

  Thanks,

 Matt

On 2016年08月11日 23:29, Matthew Knepley wrote:

On Thu, Aug 11, 2016 at 3:14 AM, leejearl > wrote:

Hi,
Thank you for your reply. It help me very much.
But, for
"/petsc-3.7.2/src/ts/examples/tutorials/ex11.c", when I set
the overlap to 2 levels, the command is
"mpirun -n 3 ./ex11 -f annulus-20.exo -ufv_mesh_overlap 2
-physics sw", it suffers a error.
It seems to me that setting overlap to 2 is very
common. Are there issues that I have not take into
consideration?
Any help are appreciated.

I will check this out. I have not tested an overlap of 2 here
since I generally use nearest neighbor FV methods for
unstructured stuff. I have test examples that run fine for
overlap > 1. Can you send the entire error message?

If the error is not in the distribution, but rather in the
analytics, that is understandable because this example is only
intended to be run using a nearest neighbor FV method, and thus
might be confused if we give it two layers of ghost
cells.

   Matt


leejearl


On 2016年08月11日 14:57, Julian Andrej wrote:

Hi,

take a look at slide 10 of [1], there is visually
explained what the overlap between partitions is.

[1]
https://www.archer.ac.uk/training/virtual/files/2015/06-PETSc/slides.pdf



On Thu, Aug 11, 2016 at 8:48 AM, leejearl
> wrote:

Hi, all:
I want to use PETSc to build my FVM code. Now, I
have a question about
the function DMPlexDistribute(DM dm, PetscInt overlap,
PetscSF *sf, DM *dmOverlap) .

In the example
"/petsc-3.7.2/src/ts/examples/tutorials/ex11.c". When
I set the overlap
as 0 or 1, it works well. But, if I set the overlap as
2, it suffers a problem.
I am confused about the value of overlap. Can it
be set as 2? What is the meaning of
the parameter overlap?
Any helps are appreciated!

leejearl









-- 
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






--
李季
西北工业大学航空学院流体力学系
Phone: 13324530085
QQ: 188524324



Re: [petsc-users] A question about DMPlexDistribute

2016-08-12 Thread Oxberry, Geoffrey Malcolm

On Aug 12, 2016, at 5:41 PM, leejearl 
> wrote:


Hi, Matt:



> Can you verify that you are running the master branch?

cd ${PETSC_DIR}
git branch

The last command should return something like a list of branch names, and the 
branch name with an asterisk to the left of it will be the branch you are 
currently on.

Geoff

I am not sure, how can I verify this?
And I configure PETSc with this command
"./configure --prefix=$HOME/Install/petsc-openmpi 
--with-mpi=/home/leejearl/Install/openmpi/gnu/1.8.4 --download-exodusii=yes 
--download-netcdf --with-hdf5-dir=/home/leejearl/Install/hdf5-1.8.14 
--download-metis=yes".
Is there some problem? Can you show me your command for configuring PETSc?


Thanks

leejearl





On 2016年08月13日 01:10, Matthew Knepley wrote:
On Thu, Aug 11, 2016 at 8:00 PM, leejearl 
> wrote:

Thank you for your reply. I have attached the code, grid and the error message.

cavity.c is the code file, cavity.exo is the grid, and error.dat is the error 
message.

The command is "mpirun -n 2 ./cavity

Can you verify that you are running the master branch? I just ran this and got

DM Object: 2 MPI processes
  type: plex
DM_0x8404_0 in 2 dimensions:
  0-cells: 5253 5252
  1-cells: 10352 10350
  2-cells: 5298 (198) 5297 (198)
Labels:
  ghost: 2 strata of sizes (199, 400)
  vtk: 1 strata of sizes (4901)
  Cell Sets: 1 strata of sizes (5100)
  Face Sets: 3 strata of sizes (53, 99, 50)
  depth: 3 strata of sizes (5253, 10352, 5298)

  Thanks,

 Matt

On 2016年08月11日 23:29, Matthew Knepley wrote:
On Thu, Aug 11, 2016 at 3:14 AM, leejearl 
> wrote:

Hi,
Thank you for your reply. It help me very much.
But, for "/petsc-3.7.2/src/ts/examples/tutorials/ex11.c", when I set the 
overlap to 2 levels, the command is
"mpirun -n 3 ./ex11 -f annulus-20.exo -ufv_mesh_overlap 2 -physics sw", it 
suffers a error.
It seems to me that setting overlap to 2 is very common. Are there issues 
that I have not take into consideration?
Any help are appreciated.

I will check this out. I have not tested an overlap of 2 here since I generally 
use nearest neighbor FV methods for
unstructured stuff. I have test examples that run fine for overlap > 1. Can you 
send the entire error message?

If the error is not in the distribution, but rather in the analytics, that is 
understandable because this example is only
intended to be run using a nearest neighbor FV method, and thus might be 
confused if we give it two layers of ghost
cells.

   Matt


leejearl

On 2016年08月11日 14:57, Julian Andrej wrote:
Hi,

take a look at slide 10 of [1], there is visually explained what the overlap 
between partitions is.

[1] https://www.archer.ac.uk/training/virtual/files/2015/06-PETSc/slides.pdf

On Thu, Aug 11, 2016 at 8:48 AM, leejearl 
> wrote:
Hi, all:
I want to use PETSc to build my FVM code. Now, I have a question about
the function  DMPlexDistribute(DM dm, PetscInt overlap, PetscSF *sf, DM 
*dmOverlap) .

In the example "/petsc-3.7.2/src/ts/examples/tutorials/ex11.c". When I set 
the overlap
as 0 or 1, it works well. But, if I set the overlap as 2, it suffers a problem.
I am confused about the value of overlap. Can it be set as 2? What is the 
meaning of
the parameter overlap?
Any helps are appreciated!

leejearl








--
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




Re: [petsc-users] A question about DMPlexDistribute

2016-08-12 Thread leejearl

Hi, Matt:



> Can you verify that you are running the master branch?
I am not sure, how can I verify this?
And I configure PETSc with this command
"./configure --prefix=$HOME/Install/petsc-openmpi 
--with-mpi=/home/leejearl/Install/openmpi/gnu/1.8.4 
--download-exodusii=yes --download-netcdf 
--with-hdf5-dir=/home/leejearl/Install/hdf5-1.8.14 --download-metis=yes".

Is there some problem? Can you show me your command for configuring PETSc?


Thanks

leejearl





On 2016年08月13日 01:10, Matthew Knepley wrote:
On Thu, Aug 11, 2016 at 8:00 PM, leejearl > wrote:


Thank you for your reply. I have attached the code, grid and the
error message.

cavity.c is the code file, cavity.exo is the grid, and error.dat
is the error message.

The command is "mpirun -n 2 ./cavity


Can you verify that you are running the master branch? I just ran this 
and got


DM Object: 2 MPI processes
  type: plex
DM_0x8404_0 in 2 dimensions:
  0-cells: 5253 5252
  1-cells: 10352 10350
  2-cells: 5298 (198) 5297 (198)
Labels:
  ghost: 2 strata of sizes (199, 400)
  vtk: 1 strata of sizes (4901)
  Cell Sets: 1 strata of sizes (5100)
  Face Sets: 3 strata of sizes (53, 99, 50)
  depth: 3 strata of sizes (5253, 10352, 5298)

  Thanks,

 Matt

On 2016年08月11日 23:29, Matthew Knepley wrote:

On Thu, Aug 11, 2016 at 3:14 AM, leejearl > wrote:

Hi,
Thank you for your reply. It help me very much.
But, for "/petsc-3.7.2/src/ts/examples/tutorials/ex11.c",
when I set the overlap to 2 levels, the command is
"mpirun -n 3 ./ex11 -f annulus-20.exo -ufv_mesh_overlap 2
-physics sw", it suffers a error.
It seems to me that setting overlap to 2 is very common.
Are there issues that I have not take into consideration?
Any help are appreciated.

I will check this out. I have not tested an overlap of 2 here
since I generally use nearest neighbor FV methods for
unstructured stuff. I have test examples that run fine for
overlap > 1. Can you send the entire error message?

If the error is not in the distribution, but rather in the
analytics, that is understandable because this example is only
intended to be run using a nearest neighbor FV method, and thus
might be confused if we give it two layers of ghost
cells.

   Matt


leejearl


On 2016年08月11日 14:57, Julian Andrej wrote:

Hi,

take a look at slide 10 of [1], there is visually explained
what the overlap between partitions is.

[1]
https://www.archer.ac.uk/training/virtual/files/2015/06-PETSc/slides.pdf



On Thu, Aug 11, 2016 at 8:48 AM, leejearl > wrote:

Hi, all:
I want to use PETSc to build my FVM code. Now, I
have a question about
the function DMPlexDistribute(DM dm, PetscInt overlap,
PetscSF *sf, DM *dmOverlap) .

In the example
"/petsc-3.7.2/src/ts/examples/tutorials/ex11.c". When I
set the overlap
as 0 or 1, it works well. But, if I set the overlap as
2, it suffers a problem.
I am confused about the value of overlap. Can it be
set as 2? What is the meaning of
the parameter overlap?
Any helps are appreciated!

leejearl









-- 
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




Re: [petsc-users] A question about DMPlexDistribute

2016-08-12 Thread Matthew Knepley
On Thu, Aug 11, 2016 at 8:00 PM, leejearl  wrote:

> Thank you for your reply. I have attached the code, grid and the error
> message.
>
> cavity.c is the code file, cavity.exo is the grid, and error.dat is the
> error message.
>
> The command is "mpirun -n 2 ./cavity
>

Can you verify that you are running the master branch? I just ran this and
got

DM Object: 2 MPI processes
  type: plex
DM_0x8404_0 in 2 dimensions:
  0-cells: 5253 5252
  1-cells: 10352 10350
  2-cells: 5298 (198) 5297 (198)
Labels:
  ghost: 2 strata of sizes (199, 400)
  vtk: 1 strata of sizes (4901)
  Cell Sets: 1 strata of sizes (5100)
  Face Sets: 3 strata of sizes (53, 99, 50)
  depth: 3 strata of sizes (5253, 10352, 5298)

  Thanks,

 Matt


> On 2016年08月11日 23:29, Matthew Knepley wrote:
>
> On Thu, Aug 11, 2016 at 3:14 AM, leejearl  wrote:
>
>> Hi,
>> Thank you for your reply. It help me very much.
>> But, for "/petsc-3.7.2/src/ts/examples/tutorials/ex11.c", when I set
>> the overlap to 2 levels, the command is
>> "mpirun -n 3 ./ex11 -f annulus-20.exo -ufv_mesh_overlap 2 -physics sw",
>> it suffers a error.
>> It seems to me that setting overlap to 2 is very common. Are there
>> issues that I have not take into consideration?
>> Any help are appreciated.
>>
> I will check this out. I have not tested an overlap of 2 here since I
> generally use nearest neighbor FV methods for
> unstructured stuff. I have test examples that run fine for overlap > 1.
> Can you send the entire error message?
>
> If the error is not in the distribution, but rather in the analytics, that
> is understandable because this example is only
> intended to be run using a nearest neighbor FV method, and thus might be
> confused if we give it two layers of ghost
> cells.
>
>Matt
>
>
>>
>> leejearl
>>
>> On 2016年08月11日 14:57, Julian Andrej wrote:
>>
>> Hi,
>>
>> take a look at slide 10 of [1], there is visually explained what the
>> overlap between partitions is.
>>
>> [1] https://www.archer.ac.uk/training/virtual/files/2015/06-
>> PETSc/slides.pdf
>>
>> On Thu, Aug 11, 2016 at 8:48 AM, leejearl  wrote:
>>
>>> Hi, all:
>>> I want to use PETSc to build my FVM code. Now, I have a question
>>> about
>>> the function  DMPlexDistribute(DM dm, PetscInt overlap, PetscSF *sf, DM
>>> *dmOverlap) .
>>>
>>> In the example "/petsc-3.7.2/src/ts/examples/tutorials/ex11.c".
>>> When I set the overlap
>>> as 0 or 1, it works well. But, if I set the overlap as 2, it suffers a
>>> problem.
>>> I am confused about the value of overlap. Can it be set as 2? What
>>> is the meaning of
>>> the parameter overlap?
>>> Any helps are appreciated!
>>>
>>> leejearl
>>>
>>>
>>>
>>>
>>
>>
>
>
> --
> 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


Re: [petsc-users] [petsc-maint] GAMG with PETSc

2016-08-12 Thread Mark Adams
Gaetan, This was simple, if you are setup to easily check this you can test
this in my branch mark/gamg-aijcheck -- you should get an error message
"Require AIJ matrix."
Thanks again,


On Fri, Aug 12, 2016 at 11:08 AM, Gaetan Kenway  wrote:

> Thanks.
>
> When I put the type back to mpiaij, my code runs fine without segfaults
> with GAMG.  It doesn't work very well yet, but that is a separate issue.
>
> Gaetan
>
> On Fri, Aug 12, 2016 at 11:03 AM, Mark Adams  wrote:
>
>> Yes, we should check the type.
>>
>> #define MATAIJ "aij"
>> #define MATSEQAIJ  "seqaij"
>> #define MATMPIAIJ  "mpiaij"
>>
>> I assume that MATAIJ is mapped to SEQ or MPI, and so just need to check
>> for the latter two.  I'll do that now.
>>
>> Thanks,
>> Mark
>>
>> On Fri, Aug 12, 2016 at 7:02 AM, Lawrence Mitchell <
>> lawrence.mitch...@imperial.ac.uk> wrote:
>>
>>> [Added petsc-maint to cc, since I think this is an actual bug]
>>>
>>> > On 12 Aug 2016, at 01:16, Gaetan Kenway  wrote:
>>> >
>>> > Hi
>>> >
>>> > I'm attempting to try out using GAMG for a preconditioner for my
>>> compressible CFD problem. However, I'm getting segfaults when trying to run
>>> the code. The code is based on ksp ex23.c which is attached. It just reads
>>> in two precomputed matrices (the actual jacobian and an approximate
>>> jacobian used to build the PC) and solves with a RHS of ones.
>>> >
>>> > My normal approach to solving the system is with ASM+ILU. With the
>>> following options, everything works fine.
>>>
>>> This appears to be a problem that GAMG doesn't work with BAIJ matrices.
>>>
>>> But there is no checking of the input matrix type anywhere.
>>>
>>> For example, with a debug PETSc:
>>>
>>> cd src/ksp/ksp/examples/tutorials
>>> make ex23
>>> ./ex23 -pc_type gamg -mat_type baij
>>>
>>> [0]PETSC ERROR: - Error Message
>>> --
>>> [0]PETSC ERROR: Object is in wrong state
>>> [0]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on
>>> argument 1 "mat" before MatSetValues()
>>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
>>> for trouble shooting.
>>> [0]PETSC ERROR: Petsc Development GIT revision: v3.7.3-1123-g21143a8
>>> GIT Date: 2016-08-08 17:24:17 -0700
>>> [0]PETSC ERROR: ./ex23 on a arch-darwin-c-dbg named yam-laptop.local by
>>> lmitche1 Fri Aug 12 11:51:17 2016
>>> [0]PETSC ERROR: Configure options --download-chaco=1
>>> --download-ctetgen=1 --download-exodusii=1 --download-hdf5=1
>>> --download-hypre=1 --download-metis=1 --download-ml=1 --download-mumps=1
>>> --download-netcdf=1 --download-parmetis=1 --download-ptscotch=1
>>> --download-scalapack=1 --download-triangle=1 --with-c2html=0
>>> --with-debugging=1 --with-shared-libraries=1 PETSC_ARCH=arch-darwin-c-dbg
>>> [0]PETSC ERROR: #1 MatSetValues() line 1195 in
>>> /Users/lmitche1/Documents/work/src/deps/petsc/src/mat/interface/matrix.c
>>> [0]PETSC ERROR: #2 PCGAMGFilterGraph() line 342 in
>>> /Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/pc/imp
>>> ls/gamg/util.c
>>> [0]PETSC ERROR: #3 PCGAMGGraph_AGG() line 908 in
>>> /Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/pc/imp
>>> ls/gamg/agg.c
>>> [0]PETSC ERROR: #4 PCSetUp_GAMG() line 525 in
>>> /Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/pc/imp
>>> ls/gamg/gamg.c
>>> [0]PETSC ERROR: #5 PCSetUp() line 968 in /Users/lmitche1/Documents/work
>>> /src/deps/petsc/src/ksp/pc/interface/precon.c
>>> [0]PETSC ERROR: #6 KSPSetUp() line 393 in /Users/lmitche1/Documents/work
>>> /src/deps/petsc/src/ksp/ksp/interface/itfunc.c
>>> [0]PETSC ERROR: #7 KSPSolve() line 602 in /Users/lmitche1/Documents/work
>>> /src/deps/petsc/src/ksp/ksp/interface/itfunc.c
>>> [0]PETSC ERROR: #8 main() line 158 in /Users/lmitche1/Documents/work
>>> /src/deps/petsc/src/ksp/ksp/examples/tutorials/ex23.c
>>> [0]PETSC ERROR: PETSc Option Table entries:
>>> [0]PETSC ERROR: -mat_type baij
>>> [0]PETSC ERROR: -pc_type gamg
>>> [0]PETSC ERROR: End of Error Message ---send entire
>>> error message to petsc-ma...@mcs.anl.gov--
>>>
>>> Looking in PCGAMGFilterGraph I see:
>>>
>>>   ierr = MatGetType(Gmat,);CHKERRQ(ierr);
>>>   ierr = MatCreate(comm, );CHKERRQ(ierr);
>>>   ierr = MatSetSizes(tGmat,nloc,nloc,MM,MM);CHKERRQ(ierr);
>>>   ierr = MatSetBlockSizes(tGmat, 1, 1);CHKERRQ(ierr);
>>>   ierr = MatSetType(tGmat, mtype);CHKERRQ(ierr);
>>>   ierr = MatSeqAIJSetPreallocation(tGmat,0,d_nnz);CHKERRQ(ierr);
>>>   ierr = MatMPIAIJSetPreallocation(tGmat,0,d_nnz,0,o_nnz);CHKERRQ(ierr);
>>>
>>>
>>> ...
>>>   ierr = MatSetValues(tGmat,1,,1,
>>> x[jj],,ADD_VALUES);CHKERRQ(ierr);
>>>
>>>
>>> So if Gmat is neither SEQAIJ nor MPIAIJ, then no preallocation has
>>> happened (and MatSetUp is not called).
>>>
>>> Fixing the few instances here by just changing the type of these
>>> matrices to AIJ.  One runs into to the problem that creating 

Re: [petsc-users] [petsc-maint] GAMG with PETSc

2016-08-12 Thread Gaetan Kenway
Thanks.

When I put the type back to mpiaij, my code runs fine without segfaults
with GAMG.  It doesn't work very well yet, but that is a separate issue.

Gaetan

On Fri, Aug 12, 2016 at 11:03 AM, Mark Adams  wrote:

> Yes, we should check the type.
>
> #define MATAIJ "aij"
> #define MATSEQAIJ  "seqaij"
> #define MATMPIAIJ  "mpiaij"
>
> I assume that MATAIJ is mapped to SEQ or MPI, and so just need to check
> for the latter two.  I'll do that now.
>
> Thanks,
> Mark
>
> On Fri, Aug 12, 2016 at 7:02 AM, Lawrence Mitchell <
> lawrence.mitch...@imperial.ac.uk> wrote:
>
>> [Added petsc-maint to cc, since I think this is an actual bug]
>>
>> > On 12 Aug 2016, at 01:16, Gaetan Kenway  wrote:
>> >
>> > Hi
>> >
>> > I'm attempting to try out using GAMG for a preconditioner for my
>> compressible CFD problem. However, I'm getting segfaults when trying to run
>> the code. The code is based on ksp ex23.c which is attached. It just reads
>> in two precomputed matrices (the actual jacobian and an approximate
>> jacobian used to build the PC) and solves with a RHS of ones.
>> >
>> > My normal approach to solving the system is with ASM+ILU. With the
>> following options, everything works fine.
>>
>> This appears to be a problem that GAMG doesn't work with BAIJ matrices.
>>
>> But there is no checking of the input matrix type anywhere.
>>
>> For example, with a debug PETSc:
>>
>> cd src/ksp/ksp/examples/tutorials
>> make ex23
>> ./ex23 -pc_type gamg -mat_type baij
>>
>> [0]PETSC ERROR: - Error Message
>> --
>> [0]PETSC ERROR: Object is in wrong state
>> [0]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on
>> argument 1 "mat" before MatSetValues()
>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
>> for trouble shooting.
>> [0]PETSC ERROR: Petsc Development GIT revision: v3.7.3-1123-g21143a8  GIT
>> Date: 2016-08-08 17:24:17 -0700
>> [0]PETSC ERROR: ./ex23 on a arch-darwin-c-dbg named yam-laptop.local by
>> lmitche1 Fri Aug 12 11:51:17 2016
>> [0]PETSC ERROR: Configure options --download-chaco=1 --download-ctetgen=1
>> --download-exodusii=1 --download-hdf5=1 --download-hypre=1
>> --download-metis=1 --download-ml=1 --download-mumps=1 --download-netcdf=1
>> --download-parmetis=1 --download-ptscotch=1 --download-scalapack=1
>> --download-triangle=1 --with-c2html=0 --with-debugging=1
>> --with-shared-libraries=1 PETSC_ARCH=arch-darwin-c-dbg
>> [0]PETSC ERROR: #1 MatSetValues() line 1195 in
>> /Users/lmitche1/Documents/work/src/deps/petsc/src/mat/interface/matrix.c
>> [0]PETSC ERROR: #2 PCGAMGFilterGraph() line 342 in
>> /Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/pc/
>> impls/gamg/util.c
>> [0]PETSC ERROR: #3 PCGAMGGraph_AGG() line 908 in
>> /Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/pc/impls/gamg/agg.c
>> [0]PETSC ERROR: #4 PCSetUp_GAMG() line 525 in
>> /Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/pc/
>> impls/gamg/gamg.c
>> [0]PETSC ERROR: #5 PCSetUp() line 968 in /Users/lmitche1/Documents/work
>> /src/deps/petsc/src/ksp/pc/interface/precon.c
>> [0]PETSC ERROR: #6 KSPSetUp() line 393 in /Users/lmitche1/Documents/work
>> /src/deps/petsc/src/ksp/ksp/interface/itfunc.c
>> [0]PETSC ERROR: #7 KSPSolve() line 602 in /Users/lmitche1/Documents/work
>> /src/deps/petsc/src/ksp/ksp/interface/itfunc.c
>> [0]PETSC ERROR: #8 main() line 158 in /Users/lmitche1/Documents/work
>> /src/deps/petsc/src/ksp/ksp/examples/tutorials/ex23.c
>> [0]PETSC ERROR: PETSc Option Table entries:
>> [0]PETSC ERROR: -mat_type baij
>> [0]PETSC ERROR: -pc_type gamg
>> [0]PETSC ERROR: End of Error Message ---send entire
>> error message to petsc-ma...@mcs.anl.gov--
>>
>> Looking in PCGAMGFilterGraph I see:
>>
>>   ierr = MatGetType(Gmat,);CHKERRQ(ierr);
>>   ierr = MatCreate(comm, );CHKERRQ(ierr);
>>   ierr = MatSetSizes(tGmat,nloc,nloc,MM,MM);CHKERRQ(ierr);
>>   ierr = MatSetBlockSizes(tGmat, 1, 1);CHKERRQ(ierr);
>>   ierr = MatSetType(tGmat, mtype);CHKERRQ(ierr);
>>   ierr = MatSeqAIJSetPreallocation(tGmat,0,d_nnz);CHKERRQ(ierr);
>>   ierr = MatMPIAIJSetPreallocation(tGmat,0,d_nnz,0,o_nnz);CHKERRQ(ierr);
>>
>>
>> ...
>>   ierr = MatSetValues(tGmat,1,,1,
>> x[jj],,ADD_VALUES);CHKERRQ(ierr);
>>
>>
>> So if Gmat is neither SEQAIJ nor MPIAIJ, then no preallocation has
>> happened (and MatSetUp is not called).
>>
>> Fixing the few instances here by just changing the type of these matrices
>> to AIJ.  One runs into to the problem that creating the coarse grid
>> operators doesn't work, since MatMatMult and friends do not exist for BAIJ
>> matrices.
>>
>> I guess GAMG could MatConvert from BAIJ to AIJ (but this uses extra
>> memory).
>>
>> But it should probably barf with a comprehensible error message.
>>
>> Thoughts?
>>
>> Lawrence
>>
>>
>


Re: [petsc-users] [petsc-maint] GAMG with PETSc

2016-08-12 Thread Mark Adams
Yes, we should check the type.

#define MATAIJ "aij"
#define MATSEQAIJ  "seqaij"
#define MATMPIAIJ  "mpiaij"

I assume that MATAIJ is mapped to SEQ or MPI, and so just need to check for
the latter two.  I'll do that now.

Thanks,
Mark

On Fri, Aug 12, 2016 at 7:02 AM, Lawrence Mitchell <
lawrence.mitch...@imperial.ac.uk> wrote:

> [Added petsc-maint to cc, since I think this is an actual bug]
>
> > On 12 Aug 2016, at 01:16, Gaetan Kenway  wrote:
> >
> > Hi
> >
> > I'm attempting to try out using GAMG for a preconditioner for my
> compressible CFD problem. However, I'm getting segfaults when trying to run
> the code. The code is based on ksp ex23.c which is attached. It just reads
> in two precomputed matrices (the actual jacobian and an approximate
> jacobian used to build the PC) and solves with a RHS of ones.
> >
> > My normal approach to solving the system is with ASM+ILU. With the
> following options, everything works fine.
>
> This appears to be a problem that GAMG doesn't work with BAIJ matrices.
>
> But there is no checking of the input matrix type anywhere.
>
> For example, with a debug PETSc:
>
> cd src/ksp/ksp/examples/tutorials
> make ex23
> ./ex23 -pc_type gamg -mat_type baij
>
> [0]PETSC ERROR: - Error Message
> --
> [0]PETSC ERROR: Object is in wrong state
> [0]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on
> argument 1 "mat" before MatSetValues()
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> [0]PETSC ERROR: Petsc Development GIT revision: v3.7.3-1123-g21143a8  GIT
> Date: 2016-08-08 17:24:17 -0700
> [0]PETSC ERROR: ./ex23 on a arch-darwin-c-dbg named yam-laptop.local by
> lmitche1 Fri Aug 12 11:51:17 2016
> [0]PETSC ERROR: Configure options --download-chaco=1 --download-ctetgen=1
> --download-exodusii=1 --download-hdf5=1 --download-hypre=1
> --download-metis=1 --download-ml=1 --download-mumps=1 --download-netcdf=1
> --download-parmetis=1 --download-ptscotch=1 --download-scalapack=1
> --download-triangle=1 --with-c2html=0 --with-debugging=1
> --with-shared-libraries=1 PETSC_ARCH=arch-darwin-c-dbg
> [0]PETSC ERROR: #1 MatSetValues() line 1195 in /Users/lmitche1/Documents/
> work/src/deps/petsc/src/mat/interface/matrix.c
> [0]PETSC ERROR: #2 PCGAMGFilterGraph() line 342 in
> /Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/pc/impls/gamg/util.c
> [0]PETSC ERROR: #3 PCGAMGGraph_AGG() line 908 in /Users/lmitche1/Documents/
> work/src/deps/petsc/src/ksp/pc/impls/gamg/agg.c
> [0]PETSC ERROR: #4 PCSetUp_GAMG() line 525 in /Users/lmitche1/Documents/
> work/src/deps/petsc/src/ksp/pc/impls/gamg/gamg.c
> [0]PETSC ERROR: #5 PCSetUp() line 968 in /Users/lmitche1/Documents/
> work/src/deps/petsc/src/ksp/pc/interface/precon.c
> [0]PETSC ERROR: #6 KSPSetUp() line 393 in /Users/lmitche1/Documents/
> work/src/deps/petsc/src/ksp/ksp/interface/itfunc.c
> [0]PETSC ERROR: #7 KSPSolve() line 602 in /Users/lmitche1/Documents/
> work/src/deps/petsc/src/ksp/ksp/interface/itfunc.c
> [0]PETSC ERROR: #8 main() line 158 in /Users/lmitche1/Documents/
> work/src/deps/petsc/src/ksp/ksp/examples/tutorials/ex23.c
> [0]PETSC ERROR: PETSc Option Table entries:
> [0]PETSC ERROR: -mat_type baij
> [0]PETSC ERROR: -pc_type gamg
> [0]PETSC ERROR: End of Error Message ---send entire
> error message to petsc-ma...@mcs.anl.gov--
>
> Looking in PCGAMGFilterGraph I see:
>
>   ierr = MatGetType(Gmat,);CHKERRQ(ierr);
>   ierr = MatCreate(comm, );CHKERRQ(ierr);
>   ierr = MatSetSizes(tGmat,nloc,nloc,MM,MM);CHKERRQ(ierr);
>   ierr = MatSetBlockSizes(tGmat, 1, 1);CHKERRQ(ierr);
>   ierr = MatSetType(tGmat, mtype);CHKERRQ(ierr);
>   ierr = MatSeqAIJSetPreallocation(tGmat,0,d_nnz);CHKERRQ(ierr);
>   ierr = MatMPIAIJSetPreallocation(tGmat,0,d_nnz,0,o_nnz);CHKERRQ(ierr);
>
>
> ...
>   ierr = MatSetValues(tGmat,1,,1,[jj],,ADD_VALUES);
> CHKERRQ(ierr);
>
>
> So if Gmat is neither SEQAIJ nor MPIAIJ, then no preallocation has
> happened (and MatSetUp is not called).
>
> Fixing the few instances here by just changing the type of these matrices
> to AIJ.  One runs into to the problem that creating the coarse grid
> operators doesn't work, since MatMatMult and friends do not exist for BAIJ
> matrices.
>
> I guess GAMG could MatConvert from BAIJ to AIJ (but this uses extra
> memory).
>
> But it should probably barf with a comprehensible error message.
>
> Thoughts?
>
> Lawrence
>
>


Re: [petsc-users] GAMG with PETSc

2016-08-12 Thread Lawrence Mitchell
[Added petsc-maint to cc, since I think this is an actual bug]

> On 12 Aug 2016, at 01:16, Gaetan Kenway  wrote:
> 
> Hi
> 
> I'm attempting to try out using GAMG for a preconditioner for my compressible 
> CFD problem. However, I'm getting segfaults when trying to run the code. The 
> code is based on ksp ex23.c which is attached. It just reads in two 
> precomputed matrices (the actual jacobian and an approximate jacobian used to 
> build the PC) and solves with a RHS of ones.
> 
> My normal approach to solving the system is with ASM+ILU. With the following 
> options, everything works fine.

This appears to be a problem that GAMG doesn't work with BAIJ matrices.

But there is no checking of the input matrix type anywhere.

For example, with a debug PETSc:

cd src/ksp/ksp/examples/tutorials
make ex23
./ex23 -pc_type gamg -mat_type baij

[0]PETSC ERROR: - Error Message 
--
[0]PETSC ERROR: Object is in wrong state
[0]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on argument 1 
"mat" before MatSetValues()
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for 
trouble shooting.
[0]PETSC ERROR: Petsc Development GIT revision: v3.7.3-1123-g21143a8  GIT Date: 
2016-08-08 17:24:17 -0700
[0]PETSC ERROR: ./ex23 on a arch-darwin-c-dbg named yam-laptop.local by 
lmitche1 Fri Aug 12 11:51:17 2016
[0]PETSC ERROR: Configure options --download-chaco=1 --download-ctetgen=1 
--download-exodusii=1 --download-hdf5=1 --download-hypre=1 --download-metis=1 
--download-ml=1 --download-mumps=1 --download-netcdf=1 --download-parmetis=1 
--download-ptscotch=1 --download-scalapack=1 --download-triangle=1 
--with-c2html=0 --with-debugging=1 --with-shared-libraries=1 
PETSC_ARCH=arch-darwin-c-dbg
[0]PETSC ERROR: #1 MatSetValues() line 1195 in 
/Users/lmitche1/Documents/work/src/deps/petsc/src/mat/interface/matrix.c
[0]PETSC ERROR: #2 PCGAMGFilterGraph() line 342 in 
/Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/pc/impls/gamg/util.c
[0]PETSC ERROR: #3 PCGAMGGraph_AGG() line 908 in 
/Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/pc/impls/gamg/agg.c
[0]PETSC ERROR: #4 PCSetUp_GAMG() line 525 in 
/Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/pc/impls/gamg/gamg.c
[0]PETSC ERROR: #5 PCSetUp() line 968 in 
/Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/pc/interface/precon.c
[0]PETSC ERROR: #6 KSPSetUp() line 393 in 
/Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: #7 KSPSolve() line 602 in 
/Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: #8 main() line 158 in 
/Users/lmitche1/Documents/work/src/deps/petsc/src/ksp/ksp/examples/tutorials/ex23.c
[0]PETSC ERROR: PETSc Option Table entries:
[0]PETSC ERROR: -mat_type baij
[0]PETSC ERROR: -pc_type gamg
[0]PETSC ERROR: End of Error Message ---send entire error 
message to petsc-ma...@mcs.anl.gov--

Looking in PCGAMGFilterGraph I see:

  ierr = MatGetType(Gmat,);CHKERRQ(ierr);
  ierr = MatCreate(comm, );CHKERRQ(ierr);
  ierr = MatSetSizes(tGmat,nloc,nloc,MM,MM);CHKERRQ(ierr);
  ierr = MatSetBlockSizes(tGmat, 1, 1);CHKERRQ(ierr);
  ierr = MatSetType(tGmat, mtype);CHKERRQ(ierr);
  ierr = MatSeqAIJSetPreallocation(tGmat,0,d_nnz);CHKERRQ(ierr);
  ierr = MatMPIAIJSetPreallocation(tGmat,0,d_nnz,0,o_nnz);CHKERRQ(ierr);


...
  ierr = 
MatSetValues(tGmat,1,,1,[jj],,ADD_VALUES);CHKERRQ(ierr);


So if Gmat is neither SEQAIJ nor MPIAIJ, then no preallocation has happened 
(and MatSetUp is not called).

Fixing the few instances here by just changing the type of these matrices to 
AIJ.  One runs into to the problem that creating the coarse grid operators 
doesn't work, since MatMatMult and friends do not exist for BAIJ matrices.

I guess GAMG could MatConvert from BAIJ to AIJ (but this uses extra memory).

But it should probably barf with a comprehensible error message.

Thoughts?

Lawrence



signature.asc
Description: Message signed with OpenPGP using GPGMail