提交 51c078d8 编写于 作者: W WeibiaoYu

Mindspore VM backend modify the profiling interface to context option, need to adapt

上级 4bdf80be
...@@ -81,6 +81,15 @@ class Profiler: ...@@ -81,6 +81,15 @@ class Profiler:
os.environ['PROFILING_MODE'] = 'true' os.environ['PROFILING_MODE'] = 'true'
os.environ['PROFILING_OPTIONS'] = 'training_trace:task_trace' os.environ['PROFILING_OPTIONS'] = 'training_trace:task_trace'
# use context interface to open profiling, for the new mindspore version(after 2020.5.21)
try:
import mindspore.context as context
context.set_context(enable_profiling=True, profiling_options="training_trace:task_trace")
except ImportError:
logger.error("Profiling: fail to import context from mindspore.")
except ValueError as err:
logger.err("Profiling: fail to set context", err.message)
os.environ['AICPU_PROFILING_MODE'] = 'true' os.environ['AICPU_PROFILING_MODE'] = 'true'
os.environ['PROFILING_DIR'] = str(self._container_path) os.environ['PROFILING_DIR'] = str(self._container_path)
self._subgraph = check_subgraph(subgraph) self._subgraph = check_subgraph(subgraph)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册