Add CUDA profiler tools in new framework.
Created by: qingqing01
Add CUDA profiler tools in new framework to analyze CUDA performance conveniently.
The usage of #5954 is as follows:
import paddle.v2.fluid.profiler as profiler
with profiler.cuda_profiler('cuda_profiler.txt', 'csv') as nvprof:
# run CUDA program.
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 (kvp
) format or Comma separated values (csv
) format. The output file is cuda_profiler.txt
is this example. The users can config the counters/options for profiling by config
argument in profiler.cuda_profiler
. The default config is
['gpustarttimestamp',
'gpustarttimestamp',
'gridsize3d',
'threadblocksize',
'streamid',
'enableonstart 0',
'conckerneltrace'].
Note this tool is only used for CUDA program. And it only counts the CUDA kernels and CUDA API calls within with
scope.