Hi, I am currently trying to automate some Nsight Systems profiling. What I would like to do is to start profiling the application after it has performed its setup - the issue with nsys profile is that it either begins the profiling during the setup (which inaccurately depicts the performance of the application itself), or I must hardcode a certain time to wait.
Ideally, I would like to do is launch the application, and then start the profiling when the application has been launched. I thought this could be done through
nsys launch and
nsys start, but I’m unsure of how to call
nsys start after
nsys launch because
nsys launch doesn’t end until the application is closed. Am I misunderstanding something?
So this (from the manual) is not working for you:
Run application, begin collection manually, run until process ends
nsys launch -w true [application-arguments] nsys start
Effect: Create interactive CLI and launch an application set up for default analysis. Send application output to the terminal. No data is collected until you manually start collection at area of interest. Profile until the application ends. Generate the report#.qdrep in the default location.
Note: If you launch an application and that application and any descendants exit before start is called Nsight Systems will create a fully formed .qdrep file containing no data.
Are you not getting the cursor back? or is start not finding the running Nsys?
Also, there is the option to set a cuProfilerStart/Stop or nvtx range and use that to control the start and stop time for the analysis.
Hi, thank you for your response.
Here is the output when I run the given command:
nsys launch --trace=vulkan -w true main.exe nsys start
WARNING: CPU sampling requires administrative privileges, disabling.
WARNING: CPU context switches trace requires administrative privileges, disabling.
WARNING: Backtraces will not be collected because sampling is disabled.
The target application returned non-zero exit code 1
No report generated: no data to collect
If I simply run
nsys launch, then it opens the application but is stuck on the main loop, so I have no way to call
nsys start after. My current solution is to use
nsys profile and wait for 10 seconds to set up the application before recording, but I would prefer a more concrete and efficient solution.
Yeah, it won’t work with the nsys start on the same line. I would have expected launch to return and let you start. @rknight to look into this.
A workaround would be to use nsys launch with a set session name and then from a second window you can call nsys start with that session name.
What platform are you working on?
nsys launch will not return. It is waiting for the launched process to exit to determine when to end the session. You could put the nsys launch command in the background if you are running on Linux. For example
nsys launch [options] [app args] &
// wait until the interesting part of the workload
Or you can open two terminals and do the ‘nsys launch’ command from the first terminal and the other nsys commands from the other terminal - i.e. ‘nsys start | stop | shutdown’.
Hi, thanks for getting back!
Unfortunately, I’m on Windows so I don’t think the Linux solution will work. I’m using
std::system() to call
nsys, so I was thinking of a similar solution that you mentioned by calling the other commands through a separate thread. However, I still feel like this ends up with the same issue as before where there is no effective way to start recording immediately as soon as the Vulkan application windows has been created.
nsys profile wait option seems to work alright for now, but it’s a little hard to judge what a good wait period should be - if it’s too short, then nsys may start recording too early and thus the wrong data, but if it’s too long, then the wait may take up a lot of unnecessary time.
If you have access to the workload’s src, you could control the start and stop of the profiling using a capture range- i.e. the cudaProfilerStart|Stop API or an NVTX range. It’s also possible to use a hotkey to start and stop a collection. Check out the Nsight System’s ‘capture range’, ‘nvtx capture’, and ‘hotkey capture’ documentation.
Thank you for your response!
Given these options, I believe the wait duration will suffice for now, but it’s good to know that there are a variety of different ways to solve this problem.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.