Fwd: SNESSetUp() and matrix-free options

Barry Smith bsmith at mcs.anl.gov
Tue Jul 21 11:09:13 CDT 2009


>
> Lisandro

     Your moving of the -snes_mf options to SNESSetFromOptions() has  
broken PETSc.

[bsmith-laptop:ts/examples/tests] barrysmith% make runex4_2
1,11c1,42
< At t[0] =      0.00e+00 u=       1.00e+00 at the center
< At t[1] =      1.00e-01 u=       5.73e-01 at the center
< At t[2] =      2.00e-01 u=       3.28e-01 at the center
< At t[3] =      3.00e-01 u=       1.89e-01 at the center
< At t[4] =      4.00e-01 u=       1.09e-01 at the center
< At t[5] =      5.00e-01 u=       6.35e-02 at the center
< At t[6] =      6.00e-01 u=       3.73e-02 at the center
< At t[7] =      7.00e-01 u=       2.20e-02 at the center
< At t[8] =      8.00e-01 u=       1.30e-02 at the center
< At t[9] =      9.00e-01 u=       7.78e-03 at the center
< At t[10] =      1.00e+00 u=       4.67e-03 at the center
---
 > [0]PETSC ERROR: --------------------- Error Message  
------------------------------------
 > [0]PETSC ERROR: Object is in wrong state!
 > [0]PETSC ERROR: SNESSetFunction() must be called first!
 > [0]PETSC ERROR:  
------------------------------------------------------------------------
 > [0]PETSC ERROR: Petsc Development HG revision:  
c6bafef5937b90c6da76d64375619b3f4d7bbc0d HG Date: Thu Jul 16 21:12:42  
2009 -0500
 > [0]PETSC ERROR: See docs/changes/index.html for recent updates.
 > [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
 > [0]PETSC ERROR: See docs/index.html for manual pages.
 > [0]PETSC ERROR:  
------------------------------------------------------------------------
 > [0]PETSC ERROR: ./ex4 on a arch-gnu named bsmith-laptop.mcs.anl.gov  
by barrysmith Tue Jul 21 11:04:11 2009
 > [0]PETSC ERROR: Libraries linked from /Users/barrysmith/Src/petsc- 
dev/arch-gnu/lib
 > [0]PETSC ERROR: Configure run at Thu Jul 16 22:40:01 2009
 > [0]PETSC ERROR: Configure options --with-cc=gcc --download-mpich -- 
with-shared=0 --download-parme[1]PETSC ERROR: ---------------------  
Error Message ------------------------------------
 > [1]PETSC ERROR: Object is in wrong state!
 > [1]PETSC ERROR: SNESSetFunction() must be called first!
 > [1]PETSC ERROR:  
------------------------------------------------------------------------
 > [1]PETSC ERROR: Petsc Development HG revision:  
c6bafef5937b90c6da76d64375619b3f4d7bbc0d HG Date: Thu Jul 16 21:12:42  
2009 -0500
 > [1]PETSC ERROR: See docs/changes/index.html for recent updates.
 > [1]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
 > [1]PETSC ERROR: See docs/index.html for manual pages.
 > [1]PETSC ERROR:  
------------------------------------------------------------------------
 > [1]PETSC ERROR: ./ex4 on a arch-gnu named bsmith-laptop.mcs.anl.gov  
by barrysmith Tue Jul 21 11:04:11 2009
 > [1]PETSC ERROR: Libraries linked from /Users/barrysmith/Src/petsc- 
dev/arch-gnu/lib
 > [1]PETSC ERROR: Configure run at Thu Jul 16 22:40:01 2009
 > [1]PETSC ERROR: Configure options --with-cc=gcc --download-mpich -- 
with-shared=0 --download-parmetis --with-matlab -PETSC_ARCH=arch-gnu -- 
with-fortran-kernels --download-hypre --with-fc=gfortran --download-hdf5
 > [0]PETSC ERROR:  
------------------------------------------------------------------------
 > [0]PETSC ERROR: MatCreateSNESMF() line 134 in src/snes/mf/snesmfj.c
 > [0]PETSC ERROR: SNESSetUpMatrixFree_Private() line 175 in src/snes/ 
interface/snes.c
 > [0]PETSC ERROR: SNESSetFromOptions() line 405 in src/snes/interface/ 
snes.c
 > [0]PETSC ERROR: TSSetFromOptions() line 134 in src/ts/interface/ts.c
 > [0]PETSC ERROR: main() line 163 in src/ts/examples/tests/ex4.c
 > application called MPI_Abort(MPI_COMM_WORLD, 73) - process  
0[cli_0]: aborting job:
 > application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0
 > tis --with-matlab -PETSC_ARCH=arch-gnu --with-fortran-kernels -- 
download-hypre --with-fc=gfortran --download-hdf5
 > [1]PETSC ERROR:  
------------------------------------------------------------------------
 > [1]PETSC ERROR: MatCreateSNESMF() line 134 in src/snes/mf/snesmfj.c
 > [1]PETSC ERROR: SNESSetUpMatrixFree_Private() line 175 in src/snes/ 
interface/snes.c
 > [1]PETSC ERROR: SNESSetFromOptions() line 405 in src/snes/interface/ 
snes.c
 > [1]PETSC ERROR: TSSetFromOptions() line 134 in src/ts/interface/ts.c
 > [1]PETSC ERROR: main() line 163 in src/ts/examples/tests/ex4.c
 > application called MPI_Abort(MPI_COMM_WORLD, 73) - process  
1[cli_1]: aborting job:
 > application called MPI_Abort(MPI_COMM_WORLD, 73) - process 1
Possible problem with ex4_2, diffs above

    Please fix! This has been broken for a long time and broken things  
mean no one checks the nightly builds which means more and more things  
break.
In SNESSetFromOptions() you have


   if (mf) { ierr = SNESSetUpMatrixFree_Private(snes, mf_operator,  
mf_version);CHKERRQ(ierr); }

as my email says in May this is a problem. I think the easiest fix is  
to save the mf flags in the SNES data structure and call  
SNESSetUpMatrixFree_Private()
as it use to be called in SNESSetUp(). Perhaps there is a problem with  
that fix I do not know about.

    Barry





Begin forwarded message:

> From: Barry Smith <bsmith at mcs.anl.gov>
> Date: May 6, 2009 3:25:43 PM CDT
> To: For users of the development version of PETSc <petsc-dev at mcs.anl.gov 
> >
> Subject: Re: SNESSetUp() and matrix-free options
>
>
>   Lisandro,
>
>     The checking of the options can be moved to SNESSetFromOptions()  
> that then set some flag in the snes object;
> but the actual action of MatCreateSNESMF() etc must continue to take  
> place in the setup.
>
>    Feel free to change if you like,
>
>   Barry
>
>
> On May 6, 2009, at 3:15 PM, Lisandro Dalcin wrote:
>
>> Currently, -snes_mf* options are handled in SNESSetUp()... I think  
>> all
>> you will agree that the proper place for them is
>> SNESSetFromOptions()... However, perhaps I'm missing something and
>> things are like that for some reason... In that case I would like to
>> know the reason and perhaps I could fix this...
>>
>> -- 
>> Lisandro Dalcín
>> ---------------
>> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
>> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
>> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
>> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
>> Tel/Fax: +54-(0)342-451.1594
>




More information about the petsc-dev mailing list