Browse Source

!9022 Add error log if Profiler object initialized before set context in gpu scene

From: @gzhcv
Reviewed-by: @yuximiao,@wangyue01
Signed-off-by: @wangyue01
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
46ba4a975a
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      mindspore/profiler/profiling.py

+ 4
- 0
mindspore/profiler/profiling.py View File

@@ -146,6 +146,10 @@ class Profiler:
>>> profiler.analyse()
"""
if self._device_target and self._device_target == "GPU":
if context.get_auto_parallel_context('device_num') > 1 and self._dev_id != get_rank():
self._dev_id = get_rank()
logger.error('Please check the Profiler object initialized after set_auto_parallel_context() '
'and init(). Profiler should be initialized after these code. ')
self._gpu_profiler.stop()
self._generate_timeline()



Loading…
Cancel
Save