Skip to content

Instantly share code, notes, and snippets.

@icyveins7
Last active November 20, 2023 03:06
Show Gist options
  • Save icyveins7/b1e8769751d37db3f444da438d050536 to your computer and use it in GitHub Desktop.
Save icyveins7/b1e8769751d37db3f444da438d050536 to your computer and use it in GitHub Desktop.
Timing Cupy Code

Pre compute capability 8.0

Just look at this directly.

For compute capability 8.0 and above

Using nsys

This seems like a better replacement for nvprof than ncu. Had to add this to PATH myself to find it though..

C:\Program Files\NVIDIA Corporation\Nsight Systems 2022.4.2\target-windows-x64

Some details/troubleshooting

There are some cupy related nvcc compile errors. It seems like it may be good to run the exact script (with any command line arguments) once before running it through nsys, so that it can be compiled beforehand. Seems like this fixes it sometimes(?)

Also recommended to 'Run as Administrator' on your command prompt, even if your user already has admin rights.

Run a python script like this:

nsys profile D:\Python\Python311\envs\main\Scripts\python.exe myscript.py otherarguments

For now, it seems like it doesn't detect your virtualenv, so you have to specify the full path to the interpreter you are using. This generates a report, which can be double-clicked to open nsys (a lot like nvvp before!) or read via

nsys stats report1.nsys-rep

Using ncu

nvprof no longer works. You should use

ncu --target-processes all python myscript.py

It seems like you may need admin rights to run this now (Only tested on Windows).

You may want to dump the output, and then open it with Nsight Compute, because the raw output is a little hard to read:

ncu -o output --target-processes all python myscript.py

The file created should be double clickable (Tested on Windows). It will be automatically suffixed with .ncu-rep.

This link can help with transitioning from NVVP to the new Nsight Systems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment