mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-08-25 03:01:45 +00:00
* [fx] compute memory stat and flop count for MetaInfoProp. * [fx] modify node attribute. * [fx] modify ckpt_chen. * [fx] fix compatibility. * [fx] fix import error. * [fx] skip test for MetaInfoProp. * [fx] skip test for MetaInfoProp. * [fx] skip test for MetaInfoProp. * [fx] skip test for MetaInfoProp. * [fx] skip if torch 1.11.0. * [fx] recover MetaInfoProp support for PyTorch 1.11. * [fx] provide a stable but not accurate enough version of profiler. * [fx] provide a stable but not accurate enough version of profiler. * [fx] fix compatibility in tests. * [fx] fix compatibility in tests. * [fx] fix compatibility in tests. * [fx] fix compatibility in tests. * [fx] fix compatibility in tests. * [fx] fix compatibility in tests. * [fx] fix compatibility in tests. * [fx] fix compatibility in tests. * [fx] fix compatibility in tests. * [fx] fix compatibility in tests. * [fx] fix import error.
26 lines
605 B
Python
26 lines
605 B
Python
class ProfilerRegistry:
|
|
|
|
def __init__(self, name):
|
|
self.name = name
|
|
self.store = {}
|
|
|
|
def register(self, source):
|
|
|
|
def wrapper(func):
|
|
self.store[source] = func
|
|
return func
|
|
|
|
return wrapper
|
|
|
|
def get(self, source):
|
|
assert source in self.store
|
|
target = self.store[source]
|
|
return target
|
|
|
|
def has(self, source):
|
|
return source in self.store
|
|
|
|
|
|
meta_profiler_function = ProfilerRegistry(name='patched_functions_for_meta_profile')
|
|
meta_profiler_module = ProfilerRegistry(name='patched_modules_for_meta_profile')
|