stop_profiler

paddle.utils.profiler. stop_profiler ( sorted_key=None, profile_path='/tmp/profile' ) [source]

Stop the profiler. Uers can use fluid.profiler.start_profiler and fluid.profiler.stop_profiler to profile, which is equal to the usage of fluid.profiler.profiler interface.

Parameters
  • sorted_key (str, optional) – The order of profiling results, which should be one of None, ‘calls’, ‘total’, ‘max’, ‘min’ or ‘ave’. Default is None, means the profiling results will be printed in the order of first end time of events. The calls means sorting by the number of calls. The total means sorting by the total execution time. The max means sorting by the maximum execution time. The min means sorting by the minimum execution time. The ave means sorting by the average execution time. and write it into profile_path. The default profile_path is /tmp/profile.

  • profile_path (str, optional) – If state == ‘All’, it will generate timeline,

Raises

ValueError – If sorted_key is not in [‘calls’, ‘total’, ‘max’, ‘min’, ‘ave’].

Examples

import paddle.fluid as fluid
import paddle.fluid.profiler as profiler

profiler.start_profiler('GPU')
for iter in range(10):
    if iter == 2:
        profiler.reset_profiler()
    # except each iteration
profiler.stop_profiler('total', '/tmp/profile')