Monitor Nvidia's GPU usage under Linux

Source: Internet
Author: User

When using TensorFlow to run deep learning, there is often a lack of memory, so we want to be able to view the GPU usage at any time. If you are the NVIDIA GPU, you can do this at the command line with just one line of command.

1. Show current GPU usage

Nvidia comes with a NVIDIA-SMI command-line tool that displays video memory usage:

Nvidia-smi

Output:

2. Periodic output of GPU usage

But sometimes we want to not only know the GPU usage at that fixed time, we want to keep track of it, and we want to output it periodically, such as updating the display every 10s. This is the time to use the Watch command to periodically execute the nvidia-smi command.

Learn about Watch's features:

Whatis Watch Watch (1)        -Execute a program periodically, showing output fullscreen

Function: Periodically executes a command and displays the output.

The basic usage of watch is:

Watch [options]  command

The most commonly used parameter is-n, which specifies the number of seconds to execute once per command.

Monitor Memory: We set the video memory to be displayed every 10s:

Ten Nvidia-smi

Shown below:

So, just open this command-line window, you can refresh every 10 seconds, is it convenient?
If we want to perform other command-line operations periodically, then you can simply replace the back nvidia-smi, so Cool!

52649174

Monitor Nvidia's GPU usage under Linux (RPM)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.