MindInsight Profiler is a performance analysis tool for MindSpore. It can help to analyse and optimize the performance of the neural networks.
The Profiler enables users to:
To enable profiling on MindSpore, the MindInsight Profiler apis should be added to the script:
Import MindInsight Profiler
from mindinsight.profiler import Profiler
Initialize the Profiler after set context, and before the network initialization.
Example:
context.set_context(mode=context.GRAPH_MODE, device_target="Ascend", device_id=int(os.environ["DEVICE_ID"]))
profiler = Profiler(output_path="./data", is_detail=True, is_show_op_path=False, subgraph='All')
net = Net()
Parameters of Profiler including:
subgraph (str): Defines which subgraph to monitor and analyse, can be 'all', 'Default', 'Gradients'.
is_detail (bool): Whether to show profiling data for op_instance level, only show optype level if False.
is_show_op_path (bool): Whether to save the full path for each op instance.
output_path (str): Output data path.
optypes_to_deal (list): Op type names, the data of which optype should be collected and analysed,
will deal with all op if null.
optypes_not_deal (list): Op type names, the data of which optype will not be collected and analysed.
Call Profiler.analyse() at the end of the program
Profiler.analyse() will collect profiling data and generate the analysis results.
After training, we can open MindInsight UI to analyse the performance.
The operator performance analysis component is used to display the execution time of the operators during MindSpore run.
Figure 17: Statistics for Operator Types
Figure 17 displays the statistics for the operator types, including:
Figure 18: Statistics for Operators
Figure 18 displays the statistics table for the operators, including:
The Profiler has the following limitations now: