On Thu, 4 Nov 2010, Kirk, Benjamin (JSC-EG311) wrote:

I'm all for (1).

Note thought that MPI_Request_free does not cancel communication -
MPI_Cancel does.  MPI_Request_free says you have no need for this particular
request - possibly because you will be able to infer when it has completed
due to some knowledge of program structure.

MPI_Cancel is definitely not used in our code and according to the docs 'can
be an expensive operation that should be used only exceptionally.'

So what about Request::free() and a clean destructor?

Okay, I'm convinced. I guess the attached patch does everything we need, doesn't it?

Best Regards,

Tim

--
Dr. Tim Kroeger
CeVis -- Center of Complex Systems and Visualization
University of Bremen              [email protected]
Universitaetsallee 29             [email protected]
D-28359 Bremen                             Phone +49-421-218-7710
Germany                                    Fax   +49-421-218-4236
Index: include/parallel/parallel.h
===================================================================
--- include/parallel/parallel.h (Revision 4083)
+++ include/parallel/parallel.h (Arbeitskopie)
@@ -532,13 +532,6 @@
 
     ~Request ()
     {
-#ifdef LIBMESH_HAVE_MPI
-      // explicitly free this request if not 
-      // done so already, otherwise this would
-      // be a memory leak!
-      if (_request != MPI_REQUEST_NULL)
-       MPI_Request_free (&_request);
-#endif
     }
 
     operator const request & () const
@@ -550,6 +543,14 @@
     request* get()
     { return &_request; }
 
+    void free (void)
+    {
+#ifdef LIBMESH_HAVE_MPI
+      if (_request != MPI_REQUEST_NULL)
+       MPI_Request_free (&_request);
+#endif
+    }
+
     const request* get() const
     { return &_request; }
 
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to