Add clear_streams API for cleanup before exit (#3395)
This commit is contained in:
@@ -7,7 +7,7 @@ import mlx.core as mx
|
||||
import mlx_tests
|
||||
|
||||
|
||||
class TestReduce(mlx_tests.MLXTestCase):
|
||||
class TestThreads(mlx_tests.MLXTestCase):
|
||||
def test_threadlocal_stream(self):
|
||||
test_stream = mx.new_stream(mx.default_device())
|
||||
|
||||
@@ -16,6 +16,7 @@ class TestReduce(mlx_tests.MLXTestCase):
|
||||
with mx.stream(test_stream):
|
||||
x = mx.arange(10)
|
||||
mx.eval(2 * x)
|
||||
mx.clear_streams()
|
||||
|
||||
t1 = threading.Thread(target=test_failure)
|
||||
t2 = threading.Thread(target=test_failure)
|
||||
@@ -31,6 +32,7 @@ class TestReduce(mlx_tests.MLXTestCase):
|
||||
x = mx.arange(10)
|
||||
mx.eval(2 * x)
|
||||
self.assertEqual(x.tolist(), list(range(10)))
|
||||
mx.clear_streams()
|
||||
|
||||
t1 = threading.Thread(target=test_success)
|
||||
t2 = threading.Thread(target=test_success)
|
||||
|
||||
Reference in New Issue
Block a user