Coverage for onnxcustom/cli/profiling.py: 100%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2@file
3@brief Command lines for profiling.
4"""
5from ..utils.nvprof2json import convert_trace_to_json
8def nvprof2json(filename, output="", temporary_file="", verbose=1,
9 fLOG=print):
10 """
11 Converts traces produced by :epkg:`nvprof` and saved with
12 format :epkg:`sqlite3` (extension `.sql`).
14 :param filename: filename
15 :param output: output file, if left empty, the result is printed
16 on the standard output
17 :param temporary_file: if the file needs to be unzipped,
18 this file will be created to be the unzipped file,
19 it is not cleaned after the unzipping.
20 :param verbose: verbosity
21 :param fLOG: logging function
22 :return: json (if output is None, the list of events otherwise)
24 .. cmdref::
25 :title: Converts a profile stored by nvprof into json
26 :cmd: -m onnxcustom nvprof2json --help
28 The sqlite dump is generated with a command line similar to:
30 ::
32 nvprof -o gpu_profile.sql python plot_gpu_training.py
34 The command produces a json file following the *Trace Event Format*.
35 """
36 verbose = int(verbose)
37 res = convert_trace_to_json(filename, output, verbose=verbose,
38 temporary_file=temporary_file, fLOG=fLOG)
39 if output is None: # pragma: no cover
40 fLOG(res)