Tuesday, 15 November 2022

How to check nvidia-smi processes still alive or not?

#!/bin/bash

total=1 base=1 counter=0 sub='/hello/world/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

No comments:

Post a Comment