Browse Source

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

Merge pull request !168 from WeibiaoYu/master
tags/v0.3.0-alpha^0
mindspore-ci-bot Gitee 5 years ago
parent
commit
9bcbccd3ce
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      mindinsight/profiler/profiling.py

+ 9
- 0
mindinsight/profiler/profiling.py View File

@@ -81,6 +81,15 @@ class Profiler:

os.environ['PROFILING_MODE'] = 'true'
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['PROFILING_DIR'] = str(self._container_path)
self._subgraph = check_subgraph(subgraph)


Loading…
Cancel
Save