[MPICH] Freeing Userdefined resources (Datatypes, Communicators, ... ) properly with C++

Rajeev Thakur thakur at mcs.anl.gov
Mon May 28 09:47:55 CDT 2007


MPI_Finalize frees memory that the MPI library internally uses (such as
message queues) and which is invisible to the user. The user is responsible
for freeing objects that the user had explicitly created.

Rajeev
 

> -----Original Message-----
> From: owner-mpich-discuss at mcs.anl.gov 
> [mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Martin 
> Schwinzerl
> Sent: Monday, May 28, 2007 4:14 AM
> To: mpich-discuss at mcs.anl.gov
> Subject: Re: [MPICH] Freeing Userdefined resources 
> (Datatypes, Communicators, ... ) properly with C++
> 
> Dear Rajeev!
> > MPI_Finalize does not deallocate user-created objects. 
> >   
> Thanks for clearing this up. I was a little bit uncertain about this,
> as the MPI-2 standard states in the clarification to MPI_FINALIZE that
> 
> "This routine cleans up all MPI state."
> 
> But (if I'm not mistaken) it does not elaborate what exactly 
> qualifies as
>  "state". Since these user allocated resources are already handles
> by nature (e.g. assigning
> 
> MPI::Intracomm m_commA =  /* ... */
> MPI::Intracomm m_commB = commA
> 
> performs no deep copy), I had speculations that MPI::Finalize()
> would perhaps free all raw resources automatically, since these
> are obviously handled already at a global level
> somewhere in the MPI namespace. Would have been a nice
> time and effort saver :-)
> 
> Just out of curiosity: Are there any special reasons/obstacles for not
> doing this
> in MPI::Finalize() ? If I understand the Finalize() and 
> Free() mechanism
> correctly, then Free() directives have no immediate influence 
> on currently
> active jobs (e.g. they just hinder new operations from accessing the
> resource in
> question and keep the resource intact as long as it is needed 
> by active
> operations).
> Would there been (too much) communication / synchronisation overhead
> necessary between the different processes to decide when to explicitly
> remove
> the resource ?
> > MPI_Finalized is an MPI-2 function. There is no equivalent 
> in MPI-1.2. But
> > in practice, this may not be a problem as most 
> implementation support at
> > least some MPI-2 functions, and hence may support MPI_Finalized.
> >   
> Ah! MPICH-1.2.6 / 1.2.7 has problems with MPI::Is_finalized() 
> but can handle
> MPI_Finalized() as it seems.
> 
> Best regards & Thank your for your support !
> 
> Martin
> 
> 




More information about the mpich-discuss mailing list