[mpich-discuss] clean up after MPI_Cart_create

burlen burlen.loring at gmail.com
Thu Mar 18 10:20:55 CDT 2010


I tried it, but it crashes, some info below. The program is in fortran. 
The first member of the user defined type c is the comm.

0-1:  (gdb) p c
0:  $1 = ( -2080374780, (.TRUE., .TRUE., .TRUE.), .TRUE., 2, (2, 1, 0), 
(0, 0, 0), 2, ( (1, 512, 1, 512, 1, 512) ), ( (1, 512, 1, 256, 1, 512) ) )
1:  $1 = ( -2080374782, (.TRUE., .TRUE., .TRUE.), .TRUE., 2, (2, 1, 0), 
(1, 0, 0), 2, ( (1, 512, 1, 512, 1, 512) ), ( (1, 512, 257, 512, 1, 512) ) )
0-1:  (gdb) n
0-1:  79              call MPI_Comm_free(c%Comm)
0-1:  (gdb) n
0-1:
0-1:  Program received signal SIGSEGV, Segmentation fault.
0-1:  0x00007ffff78080d9 in pmpi_comm_free_ (v1=<value optimized out>, 
ierr=0x0)
0-1:      at comm_freef.c:190
0-1:  190           *ierr = MPI_Comm_free( (MPI_Comm *)(v1) );


Rajeev Thakur wrote:
> Did you do a Comm_free?
>
> Rajeev 
>
>   
>> -----Original Message-----
>> From: mpich-discuss-bounces at mcs.anl.gov 
>> [mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of burlen
>> Sent: Thursday, March 18, 2010 5:50 AM
>> To: mpich-discuss at mcs.anl.gov
>> Subject: [mpich-discuss] clean up after MPI_Cart_create
>>
>> Is there a way to clean up after MPI_Cart_create ? Other wise 
>> it leaks some resources and pollutes valgrind output.
>>
>> Thanks
>> Burlen
>>
>>
>> ==22729== Memcheck, a memory error 
>> detector                                                      
>>                
>>
>> ==22729== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et 
>> al.                                      
>> ==22729== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for 
>> copyright info                             
>> ==22729== Command: 
>> ./TestSubArrayWriter                                          
>>                                
>>
>> ==22729==                                                     
>>                                                   
>>
>> leaked context IDs detected: mask=0x54b31a0 
>> mask[0]=0x7fffffff                                                 
>> In direct memory block for handle type ATTR, 1 handles are still 
>> allocated                                     
>> In direct memory block for handle type KEYVAL, 1 handles are still 
>> allocated                                   
>> In direct memory block for handle type COMM, 1 handles are still 
>> allocated                                     
>> [0] 8 at [0x0000000006416bf8], 
>> cart_create.c[154]                                            
>>                    
>>
>> [0] 8 at [0x0000000006416b08], 
>> cart_create.c[152]                                            
>>                    
>>
>> [0] 8 at [0x0000000006416a18], 
>> cart_create.c[150]                                            
>>                    
>>
>> [0] 56 at [0x00000000064168f8], 
>> cart_create.c[144]                                            
>>                   
>>
>> [0] 8 at [0x0000000006416538], 
>> local_proc.c[91]                                              
>>                    
>>
>> [0] 8 at [0x0000000006416448], 
>> local_proc.c[90]                                              
>>                    
>>
>> [0] 24 at [0x0000000006416168], 
>> mpid_vc.c[79]                                                 
>>                   
>>
>>  ==22729==
>> ==22729== HEAP SUMMARY:
>> ==22729==     in use at exit: 1,240 bytes in 7 blocks
>> ==22729==   total heap usage: 164 allocs, 149 frees, 8,509,866 bytes 
>> allocated
>> ==22729==
>> ==22729== 168 bytes in 1 blocks are definitely lost in loss 
>> record 4 of 7
>> ==22729==    at 0x4C25153: malloc (vg_replace_malloc.c:195)
>> ==22729==    by 0x521C386: MPIU_trmalloc (trmem.c:230)
>> ==22729==    by 0x517DD14: MPIU_Find_local_and_external 
>> (local_proc.c:90)
>> ==22729==    by 0x511FAE1: MPIR_Comm_commit (commutil.c:228)
>> ==22729==    by 0x511E31B: PMPI_Comm_split (comm_split.c:384)
>> ==22729==    by 0x50C06BA: MPIR_Cart_create (cart_create.c:119)
>> ==22729==    by 0x50C1A8F: PMPI_Cart_create (cart_create.c:298)
>> ==22729==    by 0x50C1E7C: MPI_CART_CREATE (cart_createf.c:199)
>> ==22729==    by 0x402EC4: 
>> __cartesiandecompmodule_MOD_createcommunicator 
>> (CartesianDecompModule.f90:194)
>> ==22729==    by 0x40325A: 
>> __cartesiandecompmodule_MOD_initializecartesiandecomp_u
>> (CartesianDecompModule.f90:66)
>> ==22729==    by 0x40190D: MAIN__ (TestSubArrayWriter.f90:76)
>> ==22729==    by 0x403369: main (in 
>> /home/burlen/ext/MPI-IO/TestSubArrayWriter)
>> ==22729==
>> ==22729== 168 bytes in 1 blocks are definitely lost in loss 
>> record 5 of 7
>> ==22729==    at 0x4C25153: malloc (vg_replace_malloc.c:195)
>> ==22729==    by 0x521C386: MPIU_trmalloc (trmem.c:230)
>> ==22729==    by 0x517DD47: MPIU_Find_local_and_external 
>> (local_proc.c:91)
>> ==22729==    by 0x511FAE1: MPIR_Comm_commit (commutil.c:228)
>> ==22729==    by 0x511E31B: PMPI_Comm_split (comm_split.c:384)
>> ==22729==    by 0x50C06BA: MPIR_Cart_create (cart_create.c:119)
>> ==22729==    by 0x50C1A8F: PMPI_Cart_create (cart_create.c:298)
>> ==22729==    by 0x50C1E7C: MPI_CART_CREATE (cart_createf.c:199)
>> ==22729==    by 0x402EC4: 
>> __cartesiandecompmodule_MOD_createcommunicator 
>> (CartesianDecompModule.f90:194)
>> ==22729==    by 0x40325A: 
>> __cartesiandecompmodule_MOD_initializecartesiandecomp_u
>> (CartesianDecompModule.f90:66)
>> ==22729==    by 0x40190D: MAIN__ (TestSubArrayWriter.f90:76)
>> ==22729==    by 0x403369: main (in 
>> /home/burlen/ext/MPI-IO/TestSubArrayWriter)
>> ==22729==
>> ==22729== 184 bytes in 1 blocks are definitely lost in loss 
>> record 6 of 7
>> ==22729==    at 0x4C25153: malloc (vg_replace_malloc.c:195)
>> ==22729==    by 0x521C386: MPIU_trmalloc (trmem.c:230)
>> ==22729==    by 0x51A9D59: MPID_VCRT_Create (mpid_vc.c:79)
>> ==22729==    by 0x511E135: PMPI_Comm_split (comm_split.c:365)
>> ==22729==    by 0x50C06BA: MPIR_Cart_create (cart_create.c:119)
>> ==22729==    by 0x50C1A8F: PMPI_Cart_create (cart_create.c:298)
>> ==22729==    by 0x50C1E7C: MPI_CART_CREATE (cart_createf.c:199)
>> ==22729==    by 0x402EC4: 
>> __cartesiandecompmodule_MOD_createcommunicator 
>> (CartesianDecompModule.f90:194)
>> ==22729==    by 0x40325A: 
>> __cartesiandecompmodule_MOD_initializecartesiandecomp_u
>> (CartesianDecompModule.f90:66)
>> ==22729==    by 0x40190D: MAIN__ (TestSubArrayWriter.f90:76)
>> ==22729==    by 0x403369: main (in 
>> /home/burlen/ext/MPI-IO/TestSubArrayWriter)
>> ==22729==
>> ==22729== 552 (216 direct, 336 indirect) bytes in 1 blocks 
>> are definitely lost in loss record 7 of 7
>> ==22729==    at 0x4C25153: malloc (vg_replace_malloc.c:195)
>> ==22729==    by 0x521C386: MPIU_trmalloc (trmem.c:230)
>> ==22729==    by 0x50C07A0: MPIR_Cart_create (cart_create.c:143)
>> ==22729==    by 0x50C1A8F: PMPI_Cart_create (cart_create.c:298)
>> ==22729==    by 0x50C1E7C: MPI_CART_CREATE (cart_createf.c:199)
>> ==22729==    by 0x402EC4: 
>> __cartesiandecompmodule_MOD_createcommunicator 
>> (CartesianDecompModule.f90:194)
>> ==22729==    by 0x40325A: 
>> __cartesiandecompmodule_MOD_initializecartesiandecomp_u
>> (CartesianDecompModule.f90:66)
>> ==22729==    by 0x40190D: MAIN__ (TestSubArrayWriter.f90:76)
>> ==22729==    by 0x403369: main (in 
>> /home/burlen/ext/MPI-IO/TestSubArrayWriter)
>> ==22729==
>> ==22729== LEAK SUMMARY:
>> ==22729==    definitely lost: 736 bytes in 4 blocks
>> ==22729==    indirectly lost: 336 bytes in 2 blocks
>> ==22729==      possibly lost: 0 bytes in 0 blocks
>> ==22729==    still reachable: 168 bytes in 1 blocks
>> ==22729==         suppressed: 0 bytes in 0 blocks
>> ==22729== Reachable blocks (those to which a pointer was 
>> found) are not shown.
>> ==22729== To see them, rerun with: --leak-check=full 
>> --show-reachable=yes ==22729== ==22729== For counts of 
>> detected and suppressed errors, rerun with: -v ==22729== 
>> ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 4 from 4)
>>
>> _______________________________________________
>> mpich-discuss mailing list
>> mpich-discuss at mcs.anl.gov
>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>>
>>     
>
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>   



More information about the mpich-discuss mailing list