Skip to content

Commit

Permalink
pytest fix: add gc.collect to ensure proper deallocation after large …
Browse files Browse the repository at this point in the history
…memory tests
  • Loading branch information
pspillai committed Feb 5, 2024
1 parent d349efc commit 6bdd881
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ramba/tests/test_distributed_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numba
import time
import os
import gc

full_test = int(os.environ.get("RAMBA_FULL_TEST", "0"))

Expand Down Expand Up @@ -147,6 +148,7 @@ def test_fuse(self):
assert(exec10<2*exec1)
a=ramba.ones(1) # WORKAROUND: ensure large mem released
ramba.sync() # Ideally, should work without these
gc.collect()

def test_nofuse(self):
a = ramba.zeros(1000,dtype=float)
Expand Down Expand Up @@ -186,13 +188,16 @@ def test_nofuse(self):
assert(exec10>5*exec1)
a=ramba.ones(1) # WORKAROUND: ensure large mem released
ramba.sync() # Ideally, should work without these
gc.collect()

def test_fuse2(self):
a = ramba.ones(500*1000*1000,dtype=float) # Should fit in GitHub runner VM (7GB RAM)
a += (7*a-3)+(4*a+5*a) # Should continue to fit if fused, no temporaries materialized
assert a[0]==14
a=ramba.ones(1) # WORKAROUND: ensure large mem released
ramba.sync() # Ideally, should work without these
gc.collect()


class TestBroadcast:
def test1(self):
Expand Down

0 comments on commit 6bdd881

Please sign in to comment.