You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.profiler.rst 2.8 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. mindspore.profiler
  2. ========================
  3. profiler模块简介。
  4. 本模块提供Python API,用于启用MindSpore神经网络性能数据的分析。
  5. 用户可以通过 ``import mindspore.profiler.Profiler`` 并初始化Profiler对象以开始分析,并使用 `Profiler.analyse()` 停止收集和分析。
  6. 用户可通过Mindinsight工具可视化分析结果。
  7. 目前,Profiler支持AICore算子、AICpu算子、HostCpu算子、内存、设备通信、集群等数据的分析。
  8. .. py:class:: mindspore.profiler.Profiler(**kwargs)
  9. 性能采集API。
  10. 此API能够让MindSpore用户采集神经网络的性能。
  11. Profiler支持Ascend和GPU,两者的使用方式相同。
  12. **参数:**
  13. - **output_path** (str) – 表示输出数据的路径。
  14. - **optypes_not_deal** (str) – (仅限Ascend)该参数已弃用,该功能已不再支持。
  15. - **ascend_job_id** (str) – (仅限Ascend)该参数已弃用,该功能已不再支持。
  16. - **profile_communication** (bool) – (仅限Ascend)表示是否在多设备训练中收集通信性能数据。当值为True时,收集这些数据。默认值为False。在单台设备训练中,该参数的设置无效。
  17. - **profile_memory** (bool) – (仅限Ascend)表示是否收集Tensor内存数据。当值为True时,收集这些数据。默认值为False。
  18. - **start_profile** (bool) – 该参数控制是否在Profiler初始化的时候开启采集数据。默认值为True。
  19. **异常:**
  20. - **RuntimeError** – 当CANN的版本与MindSpore版本不匹配时,生成的ascend_job_id目录结构MindSpore无法解析。
  21. .. py:method:: analyse()
  22. 收集和分析训练后或训练期间调用的性能数据。样例如上所示。
  23. .. py:method:: profile(network,profile_option)
  24. 获取训练网络中可训练参数的数量。
  25. **参数:**
  26. - **network** (Cell) - 表示训练网络。
  27. - **profile_option** (ProfileOption) - 该参数已弃用,该功能已不再支持。
  28. **返回:**
  29. dict,其中key为选项名称,value为选项结果。
  30. .. py:method:: start()
  31. 开启Profiler数据采集,可以按条件开启Profiler。
  32. **异常:**
  33. - **RuntimeError** – profiler已经开启。
  34. - **RuntimeError** – 停止Minddata采集后,不支持重复开启。
  35. - **RuntimeError** – 如果start_profile参数设置为True。
  36. .. py:method:: stop()
  37. 停止Profiler,可以按条件停止Profiler。
  38. **异常:**
  39. - **RuntimeError** – profiler没有开启。
  40. .. py:class:: mindspore.profiler.ProfileOption
  41. 这个类已经弃用,该功能已不再支持。