Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions colossalai/cli/benchmark/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import math
import time
from typing import Callable, Dict, List, Tuple

import torch

from colossalai.context import Config, ParallelMode
from colossalai.utils import MultiTimer
from colossalai.context import ParallelMode, Config
from typing import List, Dict, Tuple, Callable


def get_time_stamp() -> int:
Expand All @@ -25,8 +26,8 @@ def get_memory_states() -> Tuple[float]:
Return the memory statistics.

Returns:
max_allocated (float): the allocated CUDA memory
max_cached (float): the cached CUDA memory
max_allocated (float): the allocated CUDA memory
max_cached (float): the cached CUDA memory
"""

max_allocated = torch.cuda.max_memory_allocated() / (1024**3)
Expand Down Expand Up @@ -101,7 +102,7 @@ def profile_model(model: torch.nn.Module, warmup_steps: int, profile_steps: int,
profile_steps (int): the number of steps for profiling
data_func (Callable): a function to generate random data
timer (colossalai.utils.Multitimer): a timer instance for time recording

Returns:
fwd_time (float): the average forward time taken by forward pass in second
bwd_time (float): the average backward time taken by forward pass in second
Expand Down