windowsnvidia

How do I run nvidia-smi on Windows?


nvidia-smi executed in a Command Prompt (CMD) in Windows returns the following error

C:\Users>nvidia-smi
'nvidia-smi' is not recognized as an internal or external command,
operable program or batch file.

Where is it located? CUDA is installed already.


Solution

  • Nvidia-SMI is stored by default in the following location

    C:\Windows\System32\DriverStore\FileRepository\nvdm*\nvidia-smi.exe

    Where nvdm* is a directory that starts with nvdm and has an unknown number of characters after it.

    Note: Older installs may have it in C:\Program Files\NVIDIA Corporation\NVSMI

    You can move to that directory and then run nvidia-smi from there. However, the command prompt window will not persist, making it very difficult to see the information. Additionally it is challenging to determine what the nvdm* directory is as this changes and there are multiple directories of this format. To complicate matters, unlike linux, it can't be executed by the command line in a different path. It's better to find the exact location and create a shortcut that runs it in a periodic manner.

    To find your exact location

    1. Open File Explorer (File Folder Icon on your Task Bar, Near Start / Cortana / Task View buttons).
    2. In the left Pane, click 'This PC'.
    3. In the main viewer, just to the top of the Icons, is a search bar. Type nvidia-smi.exe and hit enter. It will come up after some time.
    4. Right-click and choose 'Open File Location' and continue with the below instructions to make a desktop shortcut, or double click to run once (not recommended, as it runs and closes the window once complete, making it hard to see the information).

    Make a shortcut that runs nvidia-smi and refreshes periodically

    1. Follow the above steps under 'To find your exact location'.
    2. Right click on nvidia-smi.exe (it may just say nvidia-smi in the viewpane) and choose create a shortcut. It will likely tell you that you can't create a shortcut here, and ask if you want to put it on your desktop. Hit yes.
    3. Now, on the desktop, right click on the shortcut you have just created, hit properties, and Under Shortcut > Target modify the string path to include -l < time you want it to refresh >.

    For example, modify:

    C:\Windows\System32\DriverStore\FileRepository\nvdm*\nvidia-smi.exe
    

    to

    C:\Windows\System32\DriverStore\FileRepository\nvdm*\nvidia-smi.exe -l 5
    

    Then hit "Apply", and then "OK".

    In this example, when you open the shortcut, it will keep the command prompt open and allow you to watch your work as nvidia-smi refreshes every five seconds.