当前位置:网站首页>shell monitors gpu usage
shell monitors gpu usage
2022-08-11 03:52:00 【HackerTom】
The output of a nvidia-smi looks like this:
Tue Aug 9 23:05:08 2022+-----------------------------------------------------------------------------+| NVIDIA-SMI 440.44 Driver Version: 440.44 CUDA Version: 10.2 ||-------------------------------+----------------------+----------------------+| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC || Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. ||================================+=======================+========================|| 0 TITAN Xp Off | 00000000:01:00.0 Off | N/A || 37% 58C P2 75W / 250W | 8481MiB / 12195MiB | 2% Default |+--------------------------------------------+----------------------+----------------------++-----------------------------------------------------------------------------+| Processes: GPU Memory || GPU PID Type Process name Usage ||=================================================================================|| 0 2292 C python 8467MiB |+-----------------------------------------------------------------------------+Where 8481MiB / 12195MiB shows the used video memory and the total amount of video memory.Now use the shell command to calculate the available video memory size:
nvidia-smi | \grep -E "[0-9]+MiB\s*/\s*[0-9]+MiB" | \awk '{print ($9" "$11)}' | \sed "s/\([0-9]\{1,\}\)MiB \([0-9]\{1,\}\)MiB/\1 \2/" | \awk '{print $2 - $1}'Where:
|pipeline, pass the result of the previous command to the next command;\continue;grep -E "[0-9]+MiB\s*/\s*[0-9]+MiB"Filter out the line of output that contains usage, get:| 37% 58C P2 75W / 250W | 8481MiB / 12195MiB | 2% Default |awk '{print ($9" "$11)}'filters out the core data of used video memory and total video memory (here are the 9th and 11th columns of the row),Open the space, get:8481MiB 12195MiBsed "s/\([0-9]\{1,\}\)MiB \([0-9]\{1,\}\)MiB/\1 \2/"Remove theMiBsuffix (brackets enclose the matching group,\1,\2refer to the matched string), get:8481 12195awk '{print $2 - $1}'Calculate the difference between two columns and calculate the available video memory, get:3714
This is the case of a single card, if there are multiple cards, maybe | should be used with xarg?
边栏推荐
- Basic understanding of MongoDB (2)
- Roewe imax8ev cube battery security, what blackening and swelling are hidden behind it?
- Is Redis old?Performance comparison between Redis and Dragonfly
- 阿里云发布3大高性能计算解决方案
- STC8H开发(十五): GPIO驱动Ci24R1无线模块
- Get the length of the linked list
- 机器学习可以应用在哪些场景?机器学习有什么用?
- The development of the massage chair control panel makes the massage chair simple and intelligent
- How can users overcome emotional issues in programmatic trading?
- Day20 FPGA 】 【 - block the I2C read and write EEPROM
猜你喜欢

Basic understanding of MongoDB (2)

Multi-serial port RS485 industrial gateway BL110

树莓派入门(5)系统备份

【愚公系列】2022年08月 Go教学课程 035-接口和继承和转换与空接口

【FPGA】SDRAM

机器学习可以应用在哪些场景?机器学习有什么用?
![[C Language] Getting Started](/img/5e/484e3d426a6f1cc0d792a9ba330695.png)
[C Language] Getting Started

电力机柜数据监测RTU

QueryDet: Cascading Sparse Query Accelerates Small Object Detection at High Resolution

多串口RS485工业网关BL110
随机推荐
The impact of programmatic trading and subjective trading on the profit curve!
C# 一周入门高级编程之《C#-LINQ》Day Four
What should I do if the channel ServerID is incorrect when EasyCVR is connected to a Hikvision Dahua device and selects another cluster server?
MYSQLg advanced ------ clustered and non-clustered indexes
What is Machine Reinforcement Learning?What is the principle?
云平台下ESB产品开发步骤说明
构建程序化交易系统需要注意什么问题?
E-commerce project - mall time-limited seckill function system
uni-app - 获取汉字拼音首字母(根据中文获取拼音首字母)
蹭个热度-请勿打开
【FPGA】名词缩写
LeetCode热题(12.买卖股票的最佳时机)
Rotary array problem: how to realize the array "overall reverse, internal orderly"?"Three-step conversion method" wonderful array
学编程的第十三天
音频编解码,利用FAAC来实现AAC编码
The thirteenth day of learning programming
Differences and connections between distributed and clustered
移动端地图开发选择哪家?
AI + medical: for medical image recognition using neural network analysis
Will oracle cardinality affect query speed?