Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to monitor the GPU usage of NVIDIA in Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to monitor the GPU usage of NVIDIA in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

When using TensorFlow to run deep learning, there is often insufficient memory, so we want to be able to check the usage of GPU at any time. If you are the GPU of Nvidia, you only need one command from the command line.

1. Show current GPU usage

Nvidia comes with a command line tool for nvidia-smi, which displays the usage of video memory:

$nvidia-smi

Output:

two。 Periodically output GPU usage

But sometimes we want not only to know the GPU usage at that fixed time, but also to keep abreast of its trends, and then we want to output periodically, such as updating the display every 10 seconds. At this point, you need to use the watch command to execute the nvidia-smi command periodically.

Learn about the functions of watch:

$whatis watch watch (1)-execute a program periodically, showing output fullscreen

Function: execute a command periodically and display the output.

The basic usage of watch is:

$watch [options] command

The most commonly used argument is-n, which specifies how many seconds to execute the command.

Monitor video memory: we set it to display video memory every 10 seconds:

$watch-n 10 nvidia-smi

The display is as follows:

In this way, as long as the command line window is open, it can be refreshed every ten seconds, isn't it convenient?

If we want to periodically perform other command line operations, then we can simply change the following nvidia-smi, So Cool!

This is the end of this article on "how to monitor the GPU usage of NVIDIA in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report