[petsc-users] check for NULL pointer in VecCreateGhost
Matthew Knepley
knepley at gmail.com
Mon Feb 20 18:10:09 CST 2012
On Mon, Feb 20, 2012 at 5:58 PM, Mohammad Mirzadeh <mirzadeh at gmail.com>wrote:
> Just if wondering what the actual code is, here's the bit causing the
> trouble:
>
> AOApplicationToPetsc(ao, ghostNodes.size(), (int*)ghostNodes);
> VecCreateGhost(comm, localNodes.size(), PETSC_DECIDE, ghostNodes.size(),
> (int*)ghostNodes, &v);
> AOPetscToApplication(ao, ghostNodes.size(), (int*)ghostNodes);
>
> when the code is in serial, ghostNodes.size() = 0 and (int*)ghostNodes =
> NULL.
>
So you are asking us to give up checking for NULL if the size is 0?
Matt
> On Mon, Feb 20, 2012 at 3:54 PM, Mohammad Mirzadeh <mirzadeh at gmail.com>wrote:
>
>> Sure, Jed. My bad. Here's the whole message when the code is run in
>> _serial_:
>>
>> [0]PETSC ERROR: --------------------- Error Message
>> ------------------------------------
>> [0]PETSC ERROR: Invalid pointer!
>> [0]PETSC ERROR: Null Pointer: Parameter # 3!
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: Petsc Release Version 3.2.0, Patch 6, Wed Jan 11 09:28:45
>> CST 2012
>> [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: ./petsc on a arch-linu named mohammad-laptop by mohammad
>> Mon Feb 20 15:52:25 2012
>> [0]PETSC ERROR: Libraries linked from
>> /home/mohammad/soft/petsc-3.2-p6/arch-linux2-cxx-debug/lib
>> [0]PETSC ERROR: Configure run at Thu Feb 16 02:16:40 2012
>> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
>> --with-fc=gfortran --with-clanguage=cxx --download-f-blas-lapack=1
>> --download-mpich=1 --download-hypre=1 --download-ml=1
>> --with-parmetis-include=/home/mohammad/soft/parmetis/include
>> --with-parmetis-lib="-L/home/mohammad/soft/parmetis/lib -lparmetis -lmetis"
>> --download-superlu_dist=1
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: AOApplicationToPetsc() line 249 in
>> /home/mohammad/soft/petsc-3.2-p6/src/dm/ao/interface/ao.c
>> [0]PETSC ERROR: --------------------- Error Message
>> ------------------------------------
>> [0]PETSC ERROR: Invalid pointer!
>> [0]PETSC ERROR: Null Pointer: Parameter # 3!
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: Petsc Release Version 3.2.0, Patch 6, Wed Jan 11 09:28:45
>> CST 2012
>> [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: ./petsc on a arch-linu named mohammad-laptop by mohammad
>> Mon Feb 20 15:52:25 2012
>> [0]PETSC ERROR: Libraries linked from
>> /home/mohammad/soft/petsc-3.2-p6/arch-linux2-cxx-debug/lib
>> [0]PETSC ERROR: Configure run at Thu Feb 16 02:16:40 2012
>> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
>> --with-fc=gfortran --with-clanguage=cxx --download-f-blas-lapack=1
>> --download-mpich=1 --download-hypre=1 --download-ml=1
>> --with-parmetis-include=/home/mohammad/soft/parmetis/include
>> --with-parmetis-lib="-L/home/mohammad/soft/parmetis/lib -lparmetis -lmetis"
>> --download-superlu_dist=1
>> [0]PETSC ERROR:
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: AOPetscToApplication() line 210 in
>> /home/mohammad/soft/petsc-3.2-p6/src/dm/ao/interface/ao.c
>>
>>
>> It seems to complain about the 3rd parameter of AOApplicationToPetsc()
>> and AOPetscToApplication(). VecCreateGhost, on the other hand, is fine.
>>
>> On Mon, Feb 20, 2012 at 3:47 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>>
>>> On Mon, Feb 20, 2012 at 17:25, Mohammad Mirzadeh <mirzadeh at gmail.com>wrote:
>>>
>>>> Hi,
>>>>
>>>> Is there an internal check to see if the 'ghost' pointer in
>>>> VecCreateGhost() is NULL ? This can happen, for example, if the code is run
>>>> in serial and the there are no ghost points (hence n_ghost = 0 and ghost =
>>>> NULL(implementation dependent of course) ). AOXXXXToYYYY functions seem to
>>>> crash if the corresponding pointer is NULL.
>>>>
>>>
>>> Always send the whole error message.
>>>
>>
>>
>
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120220/4386e88f/attachment.htm>
More information about the petsc-users
mailing list