已合并
[sync] PR-39802: [fix]profiler fix config cache when analyse multi card #39873
[sync] PR-39802: [fix]profiler fix config cache when analyse multi card #39873
已合并
ascend-robot创建于 7月2日
3 个文件变更+13-0
Mtest/profiler/analysis/test_profiler_config.py+9-0
@@ -69,6 +69,15 @@ class TestProfilerConfig(TestCase):
69 self.assertEqual(config._rank_id, -1)69 self.assertEqual(config._rank_id, -1)
70 self.assertEqual(config._activities, [])70 self.assertEqual(config._activities, [])
71 71 
72+ def test_reset_is_load_will_reset_is_load_to_false(self):
73+ config = profiler_config.ProfilerConfig()
74+ config._rank_id = 1
75+ config._is_load = True
76+ 
77+ config.reset_is_load()
78+ 
79+ self.assertEqual(config._rank_id, 1)
80+ self.assertFalse(config._is_load)
72 81 
73 def test_load_syscnt_info_json_decode_error(self):82 def test_load_syscnt_info_json_decode_error(self):
74 config = profiler_config.ProfilerConfig()83 config = profiler_config.ProfilerConfig()
Mtorch_npu/profiler/analysis/_profiler_config.py+3-0
@@ -82,6 +82,9 @@ class ProfilerConfig:
82 self._activities = []82 self._activities = []
83 self._is_load = False83 self._is_load = False
84 84 
85+ def reset_is_load(self):
86+ self._is_load = False
87+ 
85 @property88 @property
86 def data_simplification(self):89 def data_simplification(self):
87 return self._data_simplification90 return self._data_simplification
Mtorch_npu/profiler/analysis/_profiling_parser.py+1-0
@@ -130,6 +130,7 @@ class ProfilingParser:
130 f"Start parsing profiling data in "130 f"Start parsing profiling data in "
131 f"{'async' if self._kwargs.get('async_mode') else 'sync'} mode at: {self._profiler_path}"131 f"{'async' if self._kwargs.get('async_mode') else 'sync'} mode at: {self._profiler_path}"
132 )132 )
133+ ProfilerConfig().reset_is_load()
133 ProfilerConfig().load_info(self._profiler_path)134 ProfilerConfig().load_info(self._profiler_path)
134 self.update_export_type()135 self.update_export_type()
135 self.delete_previous_cann_db_files()136 self.delete_previous_cann_db_files()