An interactive NVIDIA-GPU process viewer.
Project description
gpu_lurker
服务器 GPU 监控程序,当 GPU 属性满足预设条件 (如至少有 4 张卡且每张卡的显存多于 1000M) 时通过微信发送提示消息。
服务器上输入监控命令:
满足条件后发送消息到微信:
安装
从 PyPI 上安装:
pip install --upgrade gpulurker
从 GitHub 上安装最新版本 (推荐):
pip install git+https://github.com/RenShuhuai-Andy/gpu_lurker.git#egg=gpulurker
或克隆该仓库手动安装:
git clone --depth=1 https://github.com/RenShuhuai-Andy/gpu_lurker.git
cd gpu_lurker
pip install .
使用
一、在WxPusher微信推送服务上注册并且创建应用
-
进入https://wxpusher.zjiecode.com/admin/login,使用微信扫码关注「新消息服务」公众号并完善信息。
-
创建新的应用,创建成功后请保存好显示的 APP_TOKEN
- 微信扫码关注应用
- 进入「新消息服务」公众号,点击「我的」-「我的UID」获取 UID
二、在服务器上输入命令进行 GPU 监控
# 每隔 30 分钟检查服务器状态,当有 8 张卡,每张卡的显存多余 1000M 时,向微信发送提示消息
gpulurker -m 1000 -n 8 -f 30m
首次使用时需要输入自己的 UID 和 APP_TOKEN。
主要参数
-m
,--cuda-memory
: 每张卡所需的显存 (默认为 5000 MB)-n
,--device-num
: 所需的 GPU 数 (默认为 1 块)-f
,--check-freq
: 检查服务器状态的间隔时间,如1d (1天),1h (1小时),1m (1分钟),1s (1秒),1h30m (1小时30分钟) 等。默认为 10 分钟-r
,--reload
: 重新输入用户信息 (包括 UID 和 APP_TOKEN,默认关闭)-c
,--continuous
: 满足条件时持续推送消息 (默认关闭)
键入 ctrl+c
终止监控。
键入 gpulurker --help
以获得更多信息:
usage: gpulurker [-h] [-m CUDA_MEMORY] [-n DEVICE_NUM] [-f CHECK_FREQ] [-r]
[--log_file LOG_FILE]
check if gpu is available and notify on your WeChat
optional arguments:
-h, --help show this help message and exit
-m CUDA_MEMORY, --cuda-memory CUDA_MEMORY
Required CUDA memory per device
-n DEVICE_NUM, --device-num DEVICE_NUM
Required number of devices
-f CHECK_FREQ, --check-freq CHECK_FREQ
Frequency of inspection, eg. 10m (10 minutes)
-r, --reload Reload and update your appToken and uid
-c, --continuous Continue to push message when the conditions are met
--log_file LOG_FILE define the threshold of avaliable (in MB)
致谢
本项目参考了以下仓库的代码:
微信消息实时推送服务由 WxPusher 提供。
许可证
GNU General Public License, version 3 (GPLv3)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gpulurker-0.1.tar.gz
(11.5 kB
view hashes)
Built Distribution
gpulurker-0.1-py3-none-any.whl
(24.5 kB
view hashes)