Files
nvcc/common/helper.py
T
Ștefan-Cosmin Ciocan 887c809d07 Add option to use NVIDIA Nsight Compute CLI profiler (#21)
* 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
2023-12-27 10:00:14 +01:00

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)