class_docstr: A Memory statistic collector.
  It works in two phases.
  Phase 1. Collection Phase: collect memory usage statistics of CPU and GPU.
  The first iteration of DNN training.
  Phase 2. Runtime Phase: use the read-only collected stats
  The rest iterations of DNN training.
  
  It has a Sampling counter which is reset after DNN training iteration.
class_docstr_tok: ["A","Memory","statistic","collector",".","It","works","in","two","phases",".","Phase","1",".","Collection","Phase",":","collect","memory","usage","statistics","of","CPU","and","GPU",".","The","first","iteration","of","DNN","training",".","Phase","2",".","Runtime","Phase",":","use","the","read-only","collected","stats","The","rest","iterations","of","DNN","training",".","It","has","a","Sampling","counter","which","is","reset","after","DNN","training","iteration","."]
docstr: Maximum non model data memory usage during the next Op run
  
  Args:
      device_type (str): device type, can be 'cpu' or 'cuda'.
  
  Returns:
      int: max non model data memory usage of current sampling period
docstr_tok: ["Maximum","non","model","data","memory","usage","during","the","next","Op","run","Args",":","device_type","(","str",")",":","device","type",",","can","be","'cpu","'","or","'cuda","'",".","Returns",":","int",":","max","non","model","data","memory","usage","of","current","sampling","period"]
code: def next_period_non_model_data_usage(self, device_type: str) -> int:
      """Maximum non model data memory usage during the next Op run
  
      Args:
          device_type (str): device type, can be 'cpu' or 'cuda'.
  
      Returns:
          int: max non model data memory usage of current sampling period
      """
      assert (
          not self._start_flag
      ), "Cannot get mem stats info during collection phase."
      assert (
          self._step_total > 0
      ), "Cannot get mem stats info before collection phase."
      assert (
          len(self._memstats.non_model_data_list(device_type))
          > self._step_idx
      ), (
          f"{len(self._memstats.non_model_data_list(device_type))} should be > than step idx {self._step_idx}, "
          f"step total {self._step_total}"
      )
      next_non_model_data = self._memstats.non_model_data_list(
          device_type
      )[self._step_idx]
      self._step_idx = (self._step_idx + 1) % self._step_total
      return next_non_model_data
  
file_path: colossalai/colossalai/zero/gemini/memory_tracer/memstats_collector.py
imports: import time
  from typing import Optional
  from .memory_monitor import SyncCudaMemoryMonitor
  from .memory_stats import MemStats
label_desc: Use image node_id 2 for calling the MemStatsCollector obj's underlying member method code with example usage: obj.next_period_non_model_data_usage(device_type) and returns: next_non_model_data