how to use PetscMap?

Yixun Liu yxliu at fudan.edu.cn
Thu Nov 2 20:46:14 CST 2006


Hi,
I do not use PetscMapSetBlockSize firstly and it is ok with compiler. 

PetscMap map;
 ierr = PetscMapInitialize(PETSC_COMM_WORLD, &map);
 ierr = PetscMapSetSize (&map, n);
 CHKERRQ(ierr);
 ierr = PetscMapGetLocalRange(&map,&Istart,&Iend); CHKERRQ(ierr);



However,the running error is:

[0]PETSC ERROR: --------------------- Error Message ------------------------------------
[0]PETSC ERROR: Object is in wrong state!
[0]PETSC ERROR: BlockSize not yet set!
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 2.3.2, Patch 3, Fri Sep 29 17:09:34 CDT 2006 HG revision: 9215af156a9cbcdc1ec666e2b5c7934688ddc526
[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: D:\MyVC\PETSCTest\PETSCTemplate\Debug\PETSCTemplate.exe on a cygwin-cx named DMRC-6700512 by DMRC-user Fri Nov 03 10:26:11 2006
[0]PETSC ERROR: Libraries linked from /cygdrive/D/MyVC/petsc-2.3.2-p3/lib/cygwin-cxx-debug
[0]PETSC ERROR: Configure run at Wed Nov  1 10:08:10 2006
[0]PETSC ERROR: Configure options --with-mpi-dir=/cygdrive/d/MPICH2 --with-cc="win32fe cl" --with-fc=0 --with-cxx="win32fe cl" --with-clanguage=cxx --with-blas-lapack-dir=/cygdrive/D/MyVC/petsc-2.3.2-p3/externalpackages/w_mkl_serial_p_8.1.001/mkl_serial_8.1/mkl_8.1_serial/ia32/lib COPTFLAGS="-MD -Z7" CXXOPTFLAGS="-MD -Z7" --useThreads=0 --with-shared=0
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: PetscMapInitialize() line 44 in src/vec/vec/impls/mpi/d:\MyVC\PETSC-~1.2-P\src\vec\vec\impls\mpi\pmap.c
Norm of error 0.00110997 iterations 44
0.0702505

Yixun





----- Original Message ----- 
From: "Barry Smith" <bsmith at mcs.anl.gov>
To: <petsc-users at mcs.anl.gov>
Sent: Friday, November 03, 2006 10:30 AM
Subject: Re: how to use PetscMap?




On Fri, 3 Nov 2006, Yixun Liu wrote:

> Hi,
> I use PetscMap as below,
> 
>  PetscMap map;
>  ierr = PetscMapInitialize(PETSC_COMM_WORLD, &map); CHKERRQ(ierr);
>  ierr = PetscMapSetBlockSize(&map,n); CHKERRQ(ierr);

  You do not need to use PetscMapSetBlockSize(), in it extraordinarily unlikely
you want to set it to n. 

>  ierr = PetscMapSetSize (&map, n); CHKERRQ(ierr);
>  ierr = PetscMapGetLocalRange(&map,&Istart,&Iend); CHKERRQ(ierr);
> 
> The compiler error is :PetscMapSetBlockSize' : undeclared identifier.  I am sure I include "petscksp.h", so I think 2.3.2 does not support PetscMap.

   Yes, but the other functions (PetscMapInitialize() etc) are NOT undeclared, so they do exist.

  Barry

> BTW,  I am not clear about the block size.
> 
> Best,
> 
> Yixun
> 
> 
> 
> ----- Original Message ----- 
> From: "Barry Smith" <bsmith at mcs.anl.gov>
> To: <petsc-users at mcs.anl.gov>
> Sent: Friday, November 03, 2006 9:26 AM
> Subject: Re: how to use PetscMap?
> 
> 
> 
>   Yixun
> 
>    Please read the manual pages for PetscMapInitialize, PetscMapGetLocalRange,
> PetscMapGetGlobalRange etc. 
> http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Vec/PetscMapInitialize.html
> I told you about PetscMapInitialize() over a week ago.
> 
> You should not need to broadcast these simple tasks to everyone; you should be 
> able to use the manual pages to handle this trivial stuff.
> 
>    Barry
> 
> 
>   
> 
> On Fri, 3 Nov 2006, Yixun Liu wrote:
> 
> > Hi,
> > For example, if N is known,  I call PetscSplitOwnership(PETSC_COMM, PETSC_DECIDE ,  &N) . However, how to get the start and end value like PetscMapGetLocalRange?
> > 
> > Best,
> > 
> > Yixun
> > 
> > ----- Original Message ----- 
> > From: "Matthew Knepley" <knepley at gmail.com>
> > To: <petsc-users at mcs.anl.gov>
> > Sent: Thursday, November 02, 2006 10:27 PM
> > Subject: Re: how to use PetscMap?
> > 
> > 
> > > http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Sys/PetscSplitOwnership.html
> > > 
> > >   Matt
> > > 
> > > On 11/2/06, Yixun Liu <yxliu at fudan.edu.cn> wrote:
> > >> Hi,
> > >>
> > >> I want to use PetscMap to gets the range of values owned by this process, e.g.,PetscMapGetLocalRange(map,&Istart,&Iend). Then according to Istart and Iend to determine the parameters used by MatCreateMPIAIJ to create a matrix.
> > >>
> > >> Best,
> > >>
> > >> Yixun
> > >>
> > >> ----- Original Message -----
> > >> From: "Matthew Knepley" <knepley at gmail.com>
> > >> To: <petsc-users at mcs.anl.gov>
> > >> Sent: Thursday, November 02, 2006 9:56 PM
> > >> Subject: Re: how to use PetscMap?
> > >>
> > >>
> > >> > There is no replacement. What are you tring to do here?
> > >> >
> > >> >   Matt
> > >> >
> > >> > On 11/2/06, Yixun Liu <yxliu at fudan.edu.cn> wrote:
> > >> >> Hi,
> > >> >>
> > >> >> I want to change the code, which is based on old version PETSC to version 2.3.2. The old petsc code are,
> > >> >>
> > >> >> PetscMap map;
> > >> >> ierr = PetscMapCreateMPI(PETSC_COMM_WORLD,PETSC_DECIDE,n,&map);CHKERRQ(ierr);
> > >> >> ierr = PetscMapGetLocalRange(map,&Istart,&Iend); CHKERRQ(ierr);
> > >> >> ierr = PetscMapDestroy(map); CHKERRQ(ierr);
> > >> >>
> > >> >> If 2.3.2 does not support PetscMap, which class should I use?
> > >> >>
> > >> >> Best,
> > >> >>
> > >> >> Yixun
> > >> >>
> > >> >>
> > >> >>
> > >> >> ----- Original Message -----
> > >> >> From: "Matthew Knepley" <knepley at gmail.com>
> > >> >> To: <petsc-users at mcs.anl.gov>
> > >> >> Sent: Thursday, November 02, 2006 9:07 PM
> > >> >> Subject: Re: how to use PetscMap?
> > >> >>
> > >> >>
> > >> >> > No, in 2.3.2 PetscMap no longer exists.
> > >> >> >
> > >> >> >   Matt
> > >> >> >
> > >> >> > On 11/2/06, Yixun Liu <yxliu at fudan.edu.cn> wrote:
> > >> >> >>
> > >> >> >>
> > >> >> >> Hi,
> > >> >> >>
> > >> >> >> I reveive the error as,
> > >> >> >>
> > >> >> >> [0]PETSC ERROR:
> > >> >> >> ------------------------------------------------------------------------
> > >> >> >> [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
> > >> >> >> probably memory access out of range
> > >> >> >> [0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
> > >> >> >> [0]PETSC ERROR: or see
> > >> >> >> http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html#Signal[0]PETSC
> > >> >> >> ERROR: or try http://valgrind.org on linux or man libgmalloc on Apple to
> > >> >> >> find memory corruption errors
> > >> >> >> [0]PETSC ERROR: likely location of problem given in stack below
> > >> >> >> [0]PETSC ERROR: ---------------------  Stack Frames
> > >> >> >> ------------------------------------
> > >> >> >> [0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,
> > >> >> >> [0]PETSC ERROR:       INSTEAD the line number of the start of the function
> > >> >> >> [0]PETSC ERROR:       is given.
> > >> >> >> [0]PETSC ERROR: [0] PetscMapInitialize line 41
> > >> >> >> src/vec/vec/impls/mpi/d:\MyVC\PETSC-~1.2-P\src\vec\vec\impls\mpi\pmap.c
> > >> >> >> [0]PETSC ERROR: --------------------- Error Message
> > >> >> >> ------------------------------------
> > >> >> >> [0]PETSC ERROR: Signal received!
> > >> >> >> [0]PETSC ERROR:
> > >> >> >> ------------------------------------------------------------------------
> > >> >> >> [0]PETSC ERROR: Petsc Release Version 2.3.2, Patch 3, Fri Sep 29 17:09:34
> > >> >> >> CDT 2006 HG revision:
> > >> >> >> 9215af156a9cbcdc1ec666e2b5c7934688ddc526
> > >> >> >> [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: Unknown Name on a cygwin-cx named DMRC-6700512 by DMRC-user
> > >> >> >> Thu Nov 02 16:22:47 2006
> > >> >> >> [0]PETSC ERROR: Libraries linked from
> > >> >> >> /cygdrive/D/MyVC/petsc-2.3.2-p3/lib/cygwin-cxx-debug
> > >> >> >> [0]PETSC ERROR: Configure run at Wed Nov  1 10:08:10 2006
> > >> >> >> [0]PETSC ERROR: Configure options
> > >> >> >> --with-mpi-dir=/cygdrive/d/MPICH2 --with-cc="win32fe cl"
> > >> >> >> --with-fc=0 --with-cxx="win32fe cl" --with-clanguage=cxx
> > >> >> >> --with-blas-lapack-dir=/cygdrive/D/MyVC/petsc-2.3.2-p3/externalpackages/w_mkl_serial_p_8.1.001/mkl_serial_8.1/mkl_8.1_serial/ia32/lib
> > >> >> >> COPTFLAGS="-MD -Z7" CXXOPTFLAGS="-MD -Z7" --useThreads=0 --with-shared=0
> > >> >> >> [0]PETSC ERROR:
> > >> >> >> ------------------------------------------------------------------------
> > >> >> >> [0]PETSC ERROR: User provided function() line 0 in unknown directory unknown
> > >> >> >> file
> > >> >> >> unable to read the cmd header on the pmi context, Undefined dynamic error
> > >> >> >> code.
> > >> >> >>
> > >> >> >> job aborted:
> > >> >> >> rank: node: exit code[: error message]
> > >> >> >> 0: dmrc-6700512: 59: application called MPI_Abort(MPI_COMM_WORLD, 59) -
> > >> >> >> process 0
> > >> >> >>
> > >> >> >> I think this error maybe caused by these codes,
> > >> >> >>
> > >> >> >>  PetscMap *map;
> > >> >> >>  ierr = PetscMapInitialize(PETSC_COMM_WORLD, map);
> > >> >> >>  CHKERRQ(ierr);
> > >> >> >>  ierr = PetscMapSetSize (map, n);
> > >> >> >>  ierr = PetscMapGetLocalRange(map,&Istart,&Iend);
> > >> >> >> CHKERRQ(ierr);
> > >> >> >>
> > >> >> >> Is it correct to use the PetscMap like this?
> > >> >> >>
> > >> >> >> Best,
> > >> >> >>
> > >> >> >> Yixun
> > >> >> >>
> > >> >> >>
> > >> >> >>
> > >> >> >>
> > >> >> >
> > >> >> >
> > >> >> > --
> > >> >> > "Failure has a thousand explanations. Success doesn't need one" -- Sir
> > >> >> > Alec Guiness
> > >> >> >
> > >> >>
> > >> >>
> > >> >
> > >> >
> > >> > --
> > >> > "Failure has a thousand explanations. Success doesn't need one" -- Sir
> > >> > Alec Guiness
> > >> >
> > >>
> > >>
> > > 
> > > 
> > > -- 
> > > "Failure has a thousand explanations. Success doesn't need one" -- Sir
> > > Alec Guiness
> > >
> > 
> >
> 
>




More information about the petsc-users mailing list