Skip to content

Commit

Permalink
Add a script for recording nvidia-smi stats.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjanusz committed Jul 1, 2012
1 parent f660aa3 commit 4913e6c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions benchmark/record_stats.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Records nvidia-smi stats (power draw, GPU utilization, memory bandwidth
# utilization, GPU memory use) while a Sailfish simulation is running.
#
# Usage:
# ./record_stats.sh <summary_file> <program_to_run>

DEVICE=0
TMP=$(mktemp -d)

summary=$1
shift

$* &
PID=$!

while ps -p $! >&- ; do
nvidia-smi -q -d POWER,UTILIZATION,MEMORY -i $DEVICE > $TMP/rec$(date +%s)
sleep 2
done

cat $TMP/rec* | grep Draw | awk '{ print $4 }' > $TMP/ser_power
cat $TMP/rec* | grep Gpu | awk '{ print $3 }' > $TMP/ser_gpu_util
cat $TMP/rec* | grep ' Memory ' | awk '{ print $3 }' > $TMP/ser_mem_util
cat $TMP/rec* | grep ' Used ' | awk '{ print $3 }' > $TMP/ser_mem_used

paste $TMP/ser_power $TMP/ser_gpu_util $TMP/ser_mem_util $TMP/ser_mem_used > ${summary}
rm -rf ${TMP}

0 comments on commit 4913e6c

Please sign in to comment.