mirror of
https://github.com/andreinechaev/nvcc4jupyter.git
synced 2026-06-13 18:50:47 +05:30
887c809d07
* Use NVIDIA Nsight Compute CLI profiler * Add profile and profiler-args options to argument parser. * Add missing comma to profiler-args option. * Use profile args in version 1 of the plugin * Change profiler-args option to take all remaining arguments * Change profiler_args type from string to list of strings * Add profile option to version 2 of the plugin * Add profiler usage instructions
33 lines
936 B
Python
33 lines
936 B
Python
import argparse
|
|
|
|
|
|
def get_argparser():
|
|
parser = argparse.ArgumentParser(description='NVCCPlugin params')
|
|
parser.add_argument(
|
|
'-t',
|
|
'--timeit',
|
|
action='store_true',
|
|
help='If set, returns the output of the "timeit" built-in ipython magic instead of stdout.',
|
|
)
|
|
parser.add_argument(
|
|
'-p',
|
|
'--profile',
|
|
action='store_true',
|
|
help='If set, runs the nvidia nsight compute profiler. Has no effect if used with --timeit.',
|
|
)
|
|
parser.add_argument(
|
|
'-a',
|
|
'--profiler-args',
|
|
type=str,
|
|
nargs=argparse.REMAINDER,
|
|
default=[],
|
|
help='Extra options that can be passed to the nvidia nsight compute profiler. '
|
|
'Must be the last option given to the argument parser so you can pass arguments with dashes.',
|
|
)
|
|
return parser
|
|
|
|
|
|
def print_out(out: str):
|
|
for l in out.split('\n'):
|
|
print(l)
|