Shortcuts

config

Classes

MemProfilerCfg

Configuration dataclass for the MemProfiler.

MemProfilerFuncs

MemProfilerHooks

MemProfilerSchedule

MemProfiler Configuration Dataclasses

This module defines the configuration dataclasses for the MemProfiler.

class fts_examples.profiling.config.MemProfilerCfg(enabled=False, collect_funcs=<factory>, cuda_allocator_history=False, track_fsdp_mem=False, fsdp_mem_track_module_depth=2, fsdp_mem_tracker_tabulate=False, fsdp_mem_tracker_units='MiB', fsdp_mem_tracker_root_module='', dump_memorystats_pickle=False, dump_memorystats_yaml=True, schedule=<factory>, save_dir=None, enable_memory_hooks=True, enable_saved_tensors_hooks=True, memory_hooks=<factory>, saved_tensors_funcs=<factory>, save_hook_attrs=<factory>, retain_hooks_for_funcs=<factory>)[source]

Configuration dataclass for the MemProfiler.

Parameters:
  • enabled (bool) – Whether to enable memory profiling.

  • collect_funcs (MemProfilerFuncs) – A MemProfilerFuncs instance specifying the functions to collect per memory collection type.

  • cuda_allocator_history (bool) – Whether to collect CUDA memory allocator history.

  • track_fsdp_mem (bool) – Whether to collect FSDP memory statistics.

  • fsdp_mem_track_module_depth (int) – The depth of FSDP modules to track.

  • fsdp_mem_tracker_tabulate (bool) – Whether to print FSDP memory statistics in a tabular format.

  • fsdp_mem_tracker_units (str) – The units to use for FSDP memory statistics.

  • fsdp_mem_tracker_root_module (str) – The root module to use for FSDP memory statistics.

  • dump_memorystats_pickle (bool) – Whether to dump memory statistics to a pickle file.

  • dump_memorystats_yaml (bool) – Whether to dump memory statistics to a yaml file.

  • schedule (MemProfilerSchedule) – A MemProfilerSchedule instance specifying the schedule for memory collection.

  • save_dir (str | Path | None) – The directory to save the memory statistics.

  • enable_memory_hooks (bool) – Whether to enable memory hooks.

  • enable_saved_tensors_hooks (bool) – Whether to enable saved tensors hooks.

  • memory_hooks (MemProfilerHooks) – A MemProfilerHooks instance specifying the memory hooks.

  • saved_tensors_funcs (list) – A list of saved tensors functions.

  • save_hook_attrs (list) – A list of module state attributes to save.

  • retain_hooks_for_funcs (set[str]) – A set of functions to retain memory hooks for.

class fts_examples.profiling.config.MemProfilerFuncs(default=<factory>, cpu=<factory>, cuda=<factory>, cuda_allocator_history=<factory>, fsdp=<factory>)[source]
class fts_examples.profiling.config.MemProfilerHooks(pre_forward_hooks=<factory>, post_forward_hooks=<factory>, reset_state_hooks=<factory>)[source]
class fts_examples.profiling.config.MemProfilerSchedule(warmup_iters=1, max_iter=None)[source]