8000
File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -91,8 +91,6 @@ namespace Native {
91
91
* notifyCaptureDestroy.
92
92
*/
93
93
94
- namespace {
95
-
96
94
constexpr size_t kMinBlockSize =
97
95
512 ; // all sizes are rounded to at least 512 bytes
98
96
constexpr size_t kSmallSize = 1048576 ; // largest "small" allocation is 1 MiB
Original file line number Diff line number Diff line change @@ -378,6 +378,7 @@ def test_out_of_memory(self):
378
378
self .assertTrue ((tensor == 1 ).all ())
379
379
380
380
def test_out_of_memory_retry (self ):
381
+ torch .cuda .empty_cache ()
381
382
total_memory = torch .cuda .get_device_properties (0 ).total_memory
382
383
oom_regex = "would exceed allowed memory" if TEST_CUDAMALLOCASYNC else \
383
384
"Tried to allocate"
@@ -387,6 +388,10 @@ def test_out_of_memory_retry(self):
387
388
b = torch .empty (size , dtype = torch .int8 , device = 'cuda' )
388
389
del a
389
390
b = torch .empty (size , dtype = torch .int8 , device = 'cuda' )
391
+ del b
392
+ # We used a lot of memory here, clean up so we don't affect other tests too much
393
+ torch .cuda .empty_cache ()
394
+ torch .cuda .reset_peak_memory_stats ()
390
395
391
396
def test_set_per_process_memory_fraction (self ):
392
397
# test invalid fraction value.
You can’t perform that action at this time.
0 commit comments