Re: Suspend NAMD (to RAM)

From: Ajasja Ljubetič (ajasja.ljubetic_at_gmail.com)
Date: Sat Jul 30 2011 - 09:44:23 CDT

Thanks, it works great.
Below is the resulting script (in case other people have similar problems).
(This is just a stop-gap measure, I'll look into under-clocking the cards
and controlling the fan speed next).

Best regards,
Ajasja

throttle-gpu:
#!/bin/bash

#the first parameter is the GPU id of the card you'd like to throttle

GPU=$1

MAX_TEMP=$2
: ${MAX_TEMP:=99} ;# in C

#the check time
CHK_TIME=$3
: ${CHK_TIME:=5} ;# in seconds

#the sleep time
SLEEP_TIME=$4
: ${SLEEP_TIME:=20} ;# in seconds

#Time since last suspend (in seconds)
TSL=0

while true; do
   TEMP=$(nvidia-smi -q --id=$GPU --display=TEMPERATURE | egrep -e
'[0-9]{1,3} C' | awk '{print $3}')
   echo "GPU $GPU temp is $TEMP C (tsl: $TSL s)"
   if [[ "$TEMP" -gt "$MAX_TEMP" ]]; then
     TSL=0
     echo "Suspending namd2$GPU for $SLEEP_TIME s"
     killall -STOP namd2$GPU
     sleep $SLEEP_TIME
     killall -CONT namd2$GPU
   else
     sleep $CHK_TIME
     TSL=$(( $TSL + $CHK_TIME ))
   fi

done

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 05:24:15 CST