[petsc-dev] Including petsc.h breaks user code

Matthew Knepley knepley at gmail.com
Sun Sep 14 17:40:35 CDT 2014


On Sun, Sep 14, 2014 at 5:37 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Sun, Sep 14, 2014 at 4:16 PM, Pierre Jolivet <jolivet at ann.jussieu.fr>
> wrote:
>
>> Hello,
>> Could you please explain to me why the following example is not working
>> properly when <petsc.h> (from master, with OpenMPI 1.8.1) is included ?
>>
>> $ mpicxx in-place.cpp  -I$PETSC_DIR/include
>> -I$PETSC_DIR/$PETSC_ARCH/include -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc
>> $ mpirun -np 2 ./a.out
>> Done with the scatter !
>> 0 0 0 0 (this line should be filled with 0)
>> 1 1 1 1 (this line should be filled with 1)
>> Done with the gather !
>>
>> $ mpicxx in-place.cpp  -I$PETSC_DIR/include
>> -I$PETSC_DIR/$PETSC_ARCH/include -L$PETSC_DIR/$PETSC_ARCH/lib -lpetsc
>> -DPETSC_BUG
>> $ mpirun -np 2 ./a.out
>> [:3367] *** An error occurred in MPI_Type_size
>> [:3367] *** reported by process [4819779585,140733193388032]
>> [:3367] *** on communicator MPI_COMM_WORLD
>> [:3367] *** MPI_ERR_TYPE: invalid datatype
>> [:3367] *** MPI_ERRORS_ARE_FATAL (processes in this communicator will now
>> abort,
>> [:3367] ***    and potentially your MPI job)
>>
>
> I just built this with MPICH and it runs fine:
>
> master:/PETSc3/petsc/petsc-pylith$
> /PETSc3/petsc/petsc-pylith/arch-pylith-cxx-debug/bin/mpiexec -host
> localhost -n 2
> /PETSc3/petsc/petsc-pylith/arch-pylith-cxx-debug/lib/in-place-obj/in-place
> Done with the scatter !
> 0 0 0 0 (this line should be filled with 0)
> 1 1 1 1 (this line should be filled with 1)
> Done with the gather !
>
> Will valgrind.
>

I think you have a size problem:

==43469== Syscall param writev(vector[...]) points to uninitialised byte(s)
==43469==    at 0x10297129E: writev (in /usr/lib/libSystem.B.dylib)
==43469==    by 0x1031F394B: MPIDI_CH3_iSendv (in
/PETSc3/petsc/petsc-pylith/arch-pylith-cxx-debug/lib/libmpich.10.dylib)
==43469==    by 0x1031E728D: MPIDI_CH3_PktHandler_RndvClrToSend (in
/PETSc3/petsc/petsc-pylith/arch-pylith-cxx-debug/lib/libmpich.10.dylib)
==43469==    by 0x1031F4BEC: MPIDI_CH3I_Progress_handle_sock_event (in
/PETSc3/petsc/petsc-pylith/arch-pylith-cxx-debug/lib/libmpich.10.dylib)
==43469==    by 0x1031F4E24: MPIDI_CH3I_Progress (in
/PETSc3/petsc/petsc-pylith/arch-pylith-cxx-debug/lib/libmpich.10.dylib)
==43469==    by 0x1031B51B6: MPIC_Wait (in
/PETSc3/petsc/petsc-pylith/arch-pylith-cxx-debug/lib/libmpich.10.dylib)
==43469==    by 0x1031B638B: MPIC_Send (in
/PETSc3/petsc/petsc-pylith/arch-pylith-cxx-debug/lib/libmpich.10.dylib)
==43469==    by 0x103219BFD: MPIR_Scatter_intra (in
/PETSc3/petsc/petsc-pylith/arch-pylith-cxx-debug/lib/libmpich.10.dylib)
==43469==    by 0x1030EE24C: MPI_Scatter (in
/PETSc3/petsc/petsc-pylith/arch-pylith-cxx-debug/lib/libpmpich.10.dylib)
==43469==    by 0x100002252: main (in-place.cxx:23)
==43469==  Address 0x103582400 is 32 bytes inside a block of size 64 alloc'd
==43469==    at 0x10001CC16: malloc (vg_replace_malloc.c:274)
==43469==    by 0x10304EF04: operator new(unsigned long) (in
/usr/lib/libstdc++.6.0.9.dylib)
==43469==    by 0x10304EF96: operator new[](unsigned long) (in
/usr/lib/libstdc++.6.0.9.dylib)
==43469==    by 0x1000021C4: main (in-place.cxx:15)
==43469==
Done with the scatter !
0 0 0 0 (this line should be filled with 0)
1 1 1 1 (this line should be filled with 1)
Done with the gather !

   Matt


>    Matt
>
>
>> Thank you for looking,
>> Pierre
>>
>>
>
>
> --
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20140914/68ea1208/attachment.html>


More information about the petsc-dev mailing list