Help with Nsight Compute CLI

Hello,

I am having a hard time understanding the options for using the command line interface of the Nsight Compute.

  1. If I profile all the kernels and all their passes, and I store the results using the -o option that is available, what can I use to open this profile report generated. The report is of the following format:

myReport.nsight-cuprof-report

Is there any tool available which might be shipped with the profiler that can be used to read this report? I want to access the data and further process it (for example, from a csv or a txt file). I do not want to use the Nsight Compute UI to view the data.

  1. To filter the profiling to just profile some of the kernels. Using --nvtx and --include/–exclude-nvtx I can limit the profiling to my NVTX ranges of choice. But the issue I am facing is with the options:

-k, --kernel-regex-base, --kernel-id

Could you provide a few examples for using the above options? The ones in the documentation are quite vague. Specifically, I am looking for an example for --kernel-id, the format of which I am unable to understand.

Also, if I know the names of the kernels I want to profile, how can I do that? Say for example I have 5 kernels named:

one
two
three
four
five

which do not have any common sub-names. Is there a way I can profile just these in a single go? Using -k (–kernel-regex) does not allow using multiple kernel names. Also, the CLI errors out when I try to use the option -k (–kernel-regex) multiple times.

If I can run the CLI like this,

nv-nsight-cu-cli -k ‘one’ -k ‘two’ -k ‘three’ -k ‘four’ -k ‘five’ ./myApp

or

nv-nsight-cu-cli -k ‘one’ , ‘two’ , ‘three’ , ‘four’ , ‘five’ ./myApp

If not the above two, please provide me an alternative to have profiling restricted to the name of the kernels I provide to the profiler.

Currently, I am running a for loop to get profiling infotmation to run profiler on each of the kernels I want profiling to be restricted to:

(please ignore the syntax)

for i in (1 ,numKernels)

run CLI with name[i]

end

Please provide a better option if applicable.

Looking forward to hearing from you!

Thanks
Lakshay

You can use the Nsight Compute CLI to read collected reports, in addition to the UI. You can use the same output options that you could use during data collection when importing a previously collected report. Specifically, you can use --csv to generate CSV-formatted output.

You can use both -k and --kernel-id to select various kernel names at the same time, since these options support regular expression inputs. For example, you can use -k “one|two” to collect both kernels “one” and “two”. By default, the option only does a partial match, so use line begin and end regex operators ^ and $ if you require a full match.

The --kernel-regex-base option determines which variant of the kernel function name is used for this regex match, the options are described in the documentation https://docs.nvidia.com/nsight-compute/NsightComputeCli/index.html#command-line-options-profile

The --kernel-id option allows you to filter by context and stream ID and invocation number, in addition to the kernel name. You can leave unmatched fields empty, so that ::regex:“one|two”: would match the -k option described above. 0:1:one:4 would match the 4th invocation of the kernel named exactly “one” in context 0 and stream 1.

Hello

Thank you for the answer.

I tried what you suggested using the -k option. Say I have two kernels named kernelv1 and kernelv2, and I want to fully match the names of these kernels while profiling

option1: nv-nsight-cu-cli --target-processes all -k “kernelv1|kernelv2” ./myApp

option2: nv-nsight-cu-cli --target-processes all -k “kernelv*” ./myApp

Option 2 produces what you would expect: profiling information for kernelv1 and kernelv2.

Option 1 throws a warning saying no kernels were profiled.

Also, in your comment above you mentioned that use line begin and end regex operators for full matching names. Could you please give me an example of the command that I could use to do this?

Please provide a detailed command so it does not create further confusion.

Thank you so much for the help so far.

Looking forward to hearing from you!

Thanks
Lakshay