[petsc-users] error in petsc-dev

2012-04-30 Thread Mohammad Mirzadeh
Hi, Just a quick question. Following petsc-dev/src/ksp/ksp/examples/tutorials/ex2.c, it seems that I need to call both MatMPIAIJSetPreallocation and MatSeqAIJSetPreallocation to be able to preallocate for both MPI and Seq matrices. Does petsc automatically chose the relevant function when the

[petsc-users] error in petsc-dev

2012-04-30 Thread Matthew Knepley
On Mon, Apr 30, 2012 at 7:01 PM, Mohammad Mirzadeh mirzadeh at gmail.comwrote: Hi, Just a quick question. Following petsc-dev/src/ksp/ksp/examples/tutorials/ex2.c, it seems that I need to call both MatMPIAIJSetPreallocation and MatSeqAIJSetPreallocation to be able to preallocate for both

[petsc-users] error in petsc-dev

2012-04-30 Thread Barry Smith
On Apr 30, 2012, at 6:57 PM, Matthew Knepley wrote: On Mon, Apr 30, 2012 at 7:01 PM, Mohammad Mirzadeh mirzadeh at gmail.com wrote: Hi, Just a quick question. Following petsc-dev/src/ksp/ksp/examples/tutorials/ex2.c, it seems that I need to call both MatMPIAIJSetPreallocation and

[petsc-users] error in petsc-dev

2012-04-30 Thread Mohammad Mirzadeh
Barry, Matt, Thank you both. Mohammad On Mon, Apr 30, 2012 at 6:05 PM, Barry Smith bsmith at mcs.anl.gov wrote: On Apr 30, 2012, at 6:57 PM, Matthew Knepley wrote: On Mon, Apr 30, 2012 at 7:01 PM, Mohammad Mirzadeh mirzadeh at gmail.com wrote: Hi, Just a quick question. Following

[petsc-users] error in petsc-dev

2012-04-25 Thread Jed Brown
On Wed, Apr 25, 2012 at 00:53, Mohammad Mirzadeh mirzadeh at gmail.com wrote: Even more than that, I get lots of errors apparently complaining that I have not preallocated the matrix: You are not checking error codes, otherwise you wouldn't see all the subsequent errors. I do not see these

[petsc-users] error in petsc-dev

2012-04-25 Thread Hong Zhang
Mohammad : When I do not explicitly set the type in petsc-dev I get errors: Did you follow same procedural call as petsc examples, e.g., petsc-dev/src/ksp/ksp/examples/tutorials/ex2.c: ierr = MatCreate(PETSC_COMM_WORLD,A);CHKERRQ(ierr); ierr =

[petsc-users] error in petsc-dev

2012-04-25 Thread Mohammad Mirzadeh
Hong, Did you follow same procedural call as petsc examples, e.g., petsc-dev/src/ksp/ksp/examples/tutorials/ex2.c: ierr = MatCreate(PETSC_COMM_WORLD,A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,m*n,m*n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr =

[petsc-users] error in petsc-dev

2012-04-25 Thread Matthew Knepley
On Wed, Apr 25, 2012 at 1:55 PM, Mohammad Mirzadeh mirzadeh at gmail.comwrote: You are not checking error codes, otherwise you wouldn't see all the subsequent errors. That's correct. I don't quite remember, but I think at some point I had trouble with function returns and CHKERRQ( and also

[petsc-users] error in petsc-dev

2012-04-25 Thread Hong Zhang
Mohammad: MatCreate(comm, A); MatSetSizes(A, localRowSize, localColumnSize, globalRowSize, globalColumnSize); MatSetType(A, MATMPIAIJ); MatMPIAIJSetPreallocation(A, 0, d_nnz, 0, o_nnz); MatSetFromOptions(A); MatGetOwnershipRange(A, rStart, rEnd); This (even without MatSetType(A,

[petsc-users] error in petsc-dev

2012-04-25 Thread Mohammad Mirzadeh
Thanks Hong; that fixed the problem. On Wed, Apr 25, 2012 at 11:31 AM, Hong Zhang hzhang at mcs.anl.gov wrote: Mohammad: MatCreate(comm, A); MatSetSizes(A, localRowSize, localColumnSize, globalRowSize, globalColumnSize); MatSetType(A, MATMPIAIJ); MatMPIAIJSetPreallocation(A, 0, d_nnz, 0,

[petsc-users] error in petsc-dev

2012-04-24 Thread Mohammad Mirzadeh
Hi, While trying to figure out a problem, I came across the following situation. Consider the following code: int main (int argc, char **argv){ PetscInitialize(argc, argv, (char*)0, help); Mat m; MatCreate(PETSC_COMM_WORLD, m); MatSetSizes(m, 10, 10, PETSC_DECIDE,

[petsc-users] error in petsc-dev

2012-04-24 Thread Hong Zhang
See http://www.mcs.anl.gov/petsc/documentation/changes/dev.html: You MUST now call MatXXXSetPreallocation() or MatSetUp() on any matrix you create directly (not using DMCreateMatrix()) before calling MatSetValues(), MatSetValuesBlocked() etc. On Tue, Apr 24, 2012 at 6:01 PM, Mohammad Mirzadeh

[petsc-users] error in petsc-dev

2012-04-24 Thread Mohammad Mirzadeh
Thanks Hong. On Tue, Apr 24, 2012 at 4:25 PM, Hong Zhang hzhang at mcs.anl.gov wrote: See http://www.mcs.anl.gov/petsc/documentation/changes/dev.html: You MUST now call MatXXXSetPreallocation() or MatSetUp() on any matrix you create directly (not using DMCreateMatrix()) before calling

[petsc-users] error in petsc-dev

2012-04-24 Thread Mohammad Mirzadeh
Hong, Is this also true with MatSetType()? petsc-dev seems to need it (3.2-p6 does not) but it's not listed in the changes link ... On Tue, Apr 24, 2012 at 4:27 PM, Mohammad Mirzadeh mirzadeh at gmail.comwrote: Thanks Hong. On Tue, Apr 24, 2012 at 4:25 PM, Hong Zhang hzhang at mcs.anl.gov

[petsc-users] error in petsc-dev

2012-04-24 Thread Hong Zhang
Mohammad : Is this also true with MatSetType()? petsc-dev seems to need it (3.2-p6 does not) but it's not listed in the changes link ... There is no change on MatSetType(). The default type is aij. You can check petsc examples, e.g. petsc-dev/src/ksp/ksp/examples/tutorials/ex2.c Hong On

[petsc-users] error in petsc-dev

2012-04-24 Thread Mohammad Mirzadeh
When I do not explicitly set the type in petsc-dev I get errors: [0]PETSC ERROR: - Error Message [0]PETSC ERROR: Object is in wrong state! [0]PETSC ERROR: Mat object's type is not set: Argument # 1! [0]PETSC ERROR: