[zero] cuda margin space for OS (#418)

This commit is contained in:
Jiarui Fang
2022-03-15 12:02:19 +08:00
committed by GitHub
parent 56bb412e72
commit adebb3e041
3 changed files with 29 additions and 4 deletions

View File

@@ -0,0 +1,10 @@
import imp
import torch
from colossalai.utils import get_current_device
def col_cuda_memory_capacity():
"""
Get cuda memory capacity of the current cuda.
"""
return torch.cuda.get_device_properties(get_current_device()).total_memory