7 if ! [ "$(uname)" = "Linux" ]; then exit;fi
9 query
=$
(nvidia-smi
--query-gpu=memory.used
,temperature.gpu
,utilization.gpu \
10 --format=csv |
sed 's/memory.*//g' |
tr -d '\n,')
12 cur_mem
=$
(echo "$query" |
awk '{print $1}')
13 cur_temp
=$
(echo "$query" |
awk '{print $3}')
14 cur_gpu
=$
(echo "$query" |
awk '{print $4}')
16 if [ "$cur_mem" -gt "$max_mem" ] ||
17 [ "$cur_temp" -gt "$max_temp" ] ||
18 [ "$cur_gpu" -gt "$max_gpu" ]; then
19 echo "\fGPU [$cur_mem MB] [$cur_temp C] [$cur_gpu %]\x01"