You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/10/11 21:30:20 UTC

[GitHub] [incubator-mxnet] anirudh2290 commented on a change in pull request #16328: Fix large array tests

anirudh2290 commented on a change in pull request #16328: Fix large array tests
URL: https://github.com/apache/incubator-mxnet/pull/16328#discussion_r334180996
 
 

 ##########
 File path: tests/python/unittest/common.py
 ##########
 @@ -272,6 +272,27 @@ def teardown():
     mx.nd.waitall()
 
 
+def with_post_test_cleanup():
+    """
+    Helper function that cleans up memory by releasing it from memory pool
+    Required especially by large tensor tests that have memory footprints in GBs.
+    """
+    def test_helper(orig_test):
+        @make_decorator(orig_test)
+        def test_new(*args, **kwargs):
+            logger = default_logger()
+            try:
+                orig_test(*args, **kwargs)
+            except:
+                logger.info(test_msg)
+                raise
+            finally:
+                mx.nd.waitall()
+                mx.cpu().empty_cache()
 
 Review comment:
   are the tests only for cpu context ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services