#!/bin/bash
total=1
base=1
counter=0
sub='/temp/ninja/build/main'
TEMPFILE=/tmp/$$.tmp
nvidia-smi --query-compute-apps=gpu_bus_id,pid,process_name,used_memory --format=csv,noheader,nounits | while read line; do
if [[ "$line" == *"$sub"* ]]; then
$((counter = counter+1))
echo $counter > $TEMPFILE
echo "$line, cc: $counter"
fi
done
echo $(cat $TEMPFILE)
if [ "$(cat $TEMPFILE)" -le "$total" ]; then
docker stop ninja_server
docker rm ninja_server
docker stop ninja_client
docker rm ninja_client
fi
~
Tuesday, 30 August 2022
How to check process or pid running in nvidia-smi and stop it using a bash script?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment