Skip to content

Commit

Permalink
Fix monitor_proc
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhao9 committed Jan 27, 2025
1 parent e02f038 commit 38b379c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions userbenchmark/release-test/monitor_proc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ get_gpu_max_memory_usage_cuda() {
local my_pid=$1
local max=$2
local curr
# Some processes might not use the GPU
if ! nvidia-smi dmon -s m -c 1 -o T -i 0 | grep "${my_pid}" >/dev/null 2>/dev/null; then
# pick the process that uses the most GPU memory
curr=$(nvidia-smi dmon -s m -c 1 -o T -i 0 | tail -n +3 | awk '{print $3}' | sort -n | tail -1 | grep -o "[0-9.]*")
# Some processes might not use the GPU, then memory usage should be 0
if [ "${curr}" -eq 0 ] ; then
echo "${max}"
return
fi
curr=$(nvidia-smi dmon -s m -c 1 -o T -i 0 | grep "${my_pid}" | awk '{print $4}' | sort | tail -1 | grep -o "[0-9.]*")
max "${curr}" "${max}"
}

Expand Down

0 comments on commit 38b379c

Please sign in to comment.