I want nsys stats of the nvtx range


nsys stats --report gputrace --reports cudaapitrace --format csv,column --output .,- ./app

I want to know results such as gputrace or cudaapitrace of nsys stats --report in a specific nvtx range.( for example, “Dense layer-21” in the blue box of picture above.)

What should I do?

In the short term, you could look in the reports directory of your installation and find the script named “gputrace” and make a copy of that edited to limit time. (See documentation in the product for the SQLite schema, or use the .schema command in sqlite3, shipped with Nsight Systems).

In the moderate term, you can now get stats in the GUI as of Nsight Systems 2021.5 in that drop box (currently “Events View” in your screenshot) for the lower pane. Right now those stats are for the entire run, but we are in the process of making it possible for the user to set time/nvtx range limits for the statistics there.

@jyi do you want to add anything on this?

I should have mentioned that once you have your new script, you can just run it using “nsys stats --report myscriptname”

I want to get the results from the event view as a csv file, what should I do?

Do you mean that shows in the stats view in that pane?

You can get that same information in csv format by using the CLI with the --format csv option.


You can modify the gputrace script by adding the following lines to the setup function:

        err = self.filter_time_range(None, None, 'Dense layer-21')
        if err != None:
            return err

It takes as argument the start time, end time, and nvtx (range[@domain]). It is also used by rule scripts for time/nvtx filtering.

Using the CLI with the --formatcsv option obtains from the beginning to the end of the process. (except for cudaprofilerstart()), but I want to get only the results of the nvtx range in csv.

I use C++.
Does C++ have that function?

Once you make a modified script (the scripts are in python) by adding the thing that Joan suggested, running nsys stats with that script will do what you are asking.