I wanna to generate a limit profile by nvprof. how to restrict profiling time to just 5 seconds?
2 Answers
nvprof has a timeout option. From the documentation :
A timeout (in seconds) can be provided to nvprof. The CUDA application being profiled will be killed by nvprof after the timeout. Profiling result collected before the timeout will be shown.
Note: Timeout starts counting from the moment the CUDA driver is initialized. If the application doesn't call any CUDA APIs, timeout won't be triggered.
You can also mark the beginning and end points in time in which nvprof should apply to. This can be done explicitly using cudaProfilerStart() and cudaProfilerEnd(), or in an implicit, RAII way using the lifetime a cuda::profiling::scope object (from my Modern C++ CUDA API wrappers).
Just remember, if you use nvvp, not to check the box telling it to profile the entire run.