# profiler

## cuda_profiler

`paddle.fluid.profiler.``cuda_profiler`(*args, **kwds)

  The CUDA profiler. This fuctions is used to profile CUDA program by CUDA runtime application programming interface. The profiling result will be written into output_file with Key-Value pair format or Comma separated values format. The user can set the output mode by output_mode argument and set the counters/options for profiling by config argument. The default config is [‘gpustarttimestamp’, ‘gpustarttimestamp’, ‘gridsize3d’, ‘threadblocksize’, ‘streamid’, ‘enableonstart 0’, ‘conckerneltrace’].

  Parameters: | output_file (string) – The output file name, the result will be written into this file. output_mode (string) – The output mode has Key-Value pair format and Comma separated values format. It should be ‘kvp’ or ‘csv’. config (list of string) – The profiler options and counters can refer to “Compute Command Line Profiler User Guide”.

## reset_profiler

`paddle.fluid.profiler.``reset_profiler`()

  The profiler clear interface. reset_profiler will clear the previous time record.

## profiler

`paddle.fluid.profiler.``profiler`(*args, **kwds)

  The profiler interface. Different from cuda_profiler, this profiler can be used to profile both CPU and GPU program. By defalut, it records the CPU and GPU operator kernels, if you want to profile other program, you can refer the profiling tutorial to add more records.

  Parameters: | state (string) – The profiling state, which should be ‘CPU’ or ‘GPU’, telling the profiler to use CPU timer or GPU timer for profiling. Although users may have already specified the execution place (CPUPlace/CUDAPlace) in the begining, for flexibility the profiler would not inherit this place. sorted_key (string) – If None, the profiling results will be printed in the order of first end time of events. Otherwise, the profiling results will be sorted by the this flag. This flag should be one of ‘calls’, ‘total’, ‘max’, ‘min’ or ‘ave’. 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. profile_path (string) – If state == ‘All’, it will write a profile proto output file.