torch-memory-saver 0.0.2__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {torch_memory_saver-0.0.2/torch_memory_saver.egg-info → torch_memory_saver-0.0.4}/PKG-INFO +1 -1
- {torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4}/setup.py +1 -1
- {torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4}/torch_memory_saver/__init__.py +10 -1
- {torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4/torch_memory_saver.egg-info}/PKG-INFO +1 -1
- {torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4}/LICENSE +0 -0
- {torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4}/README.md +0 -0
- {torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4}/csrc/torch_memory_saver.cpp +0 -0
- {torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4}/setup.cfg +0 -0
- {torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4}/torch_memory_saver.egg-info/SOURCES.txt +0 -0
- {torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4}/torch_memory_saver.egg-info/dependency_links.txt +0 -0
- {torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4}/torch_memory_saver.egg-info/top_level.txt +0 -0
@@ -13,13 +13,14 @@ logger = logging.getLogger(__name__)
|
|
13
13
|
|
14
14
|
class TorchMemorySaver:
|
15
15
|
def __init__(self):
|
16
|
-
self._mem_pool =
|
16
|
+
self._mem_pool = None
|
17
17
|
self._id = _global_info.next_id()
|
18
18
|
assert self._id == 1, 'Only support one single instance yet (multi-instance will be implemented later)'
|
19
19
|
|
20
20
|
@contextmanager
|
21
21
|
def region(self):
|
22
22
|
if _global_info.binary_info.enabled:
|
23
|
+
self._ensure_mem_pool()
|
23
24
|
with torch.cuda.use_mem_pool(self._mem_pool):
|
24
25
|
_global_info.binary_info.cdll.tms_region_enter()
|
25
26
|
try:
|
@@ -37,6 +38,14 @@ class TorchMemorySaver:
|
|
37
38
|
if _global_info.binary_info.enabled:
|
38
39
|
_global_info.binary_info.cdll.tms_resume()
|
39
40
|
|
41
|
+
@property
|
42
|
+
def enabled(self):
|
43
|
+
return _global_info.binary_info.enabled
|
44
|
+
|
45
|
+
def _ensure_mem_pool(self):
|
46
|
+
if self._mem_pool is None:
|
47
|
+
self._mem_pool = torch.cuda.MemPool()
|
48
|
+
|
40
49
|
|
41
50
|
@dataclass
|
42
51
|
class _BinaryInfo:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4}/torch_memory_saver.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{torch_memory_saver-0.0.2 → torch_memory_saver-0.0.4}/torch_memory_saver.egg-info/top_level.txt
RENAMED
File without changes
|