Commit a1a6d261 authored by German Leon's avatar German Leon
Browse files

modified: iamalive.sh

	modified:   iamalive_ini.sh
	modified:   reset_test
	typechange: ../microbench/config.py
	modified:   ../microbench/setconfig.sh
	modified:   ../microbench/test.py
	modified:   ../microbench/test.sh
	modified:   ../startup_script.sh
parent f68de899
if [ -z "${MYHOME}" ]
then
MYHOME=$HOME
fi
echo "===========>"${MYHOME}
sudo ${MYHOME}/bin/iamalive & #>/dev/ttyS0 sudo ${MYHOME}/bin/iamalive & #>/dev/ttyS0
if [ -z "${MYHOME}" ]
then
MYHOME=$HOME
fi
sudo ${MYHOME}/bin/iamalive_ini 120 10 & #>/dev/ttyS0 sudo ${MYHOME}/bin/iamalive_ini 120 10 & #>/dev/ttyS0
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
function reset function reset
{ {
$comando $comando
killall iamalive_ini; echo "Enable watchdog";sudo shutdown -r now killall iamalive_ini; echo "Enable watchdog";echo -e "yanoesubuntu\n"|sudo -S shutdown -r now
} }
trap 'reset' INT trap 'reset' INT
function downcounter { function downcounter {
sudo killall -9 test.sh echo -e "yanoesubuntu\n"| sudo -S killall -9 test.sh
sudo killall -2 test.py echo -e "yanoesubuntu\n"| sudo -S killall -2 test.py &
for i in $(seq 3 -1 1); do echo -en "Cuenta atras para shutdown $i \r"; sleep 1; done for i in $(seq 3 -1 1); do echo -en "Cuenta atras para shutdown $i \r"; sleep 1; done
} }
......
#############################################################################
totalFiNumber = -1
size = "2048"
dir = "../block"
exeFile = "lud_block"
bmName = exeFile+"_"+size
inputParameters = "-s" + size + " -v"
timeout = 10
inject = False
verbose = True
#cpufreq = -1
#gpufreq = -1
cpufreq = 2065500
gpufreq = 180000
#############################################################################
configs/glb_32_64.py
\ No newline at end of file
#dir="/home/ubuntu/rodinia/lud/rad" #dir="/home/ubuntu/rodinia/lud/rad"
dir= `grep -v \# $HOME/dir_test` dir=`grep -v \# $HOME/dir_test`
sel=$(ls -l ${dir}/config.py|cut -f2 -d\>|cut -f2 -d/) sel=$(ls -l ${dir}/config.py|cut -f2 -d\>|cut -f2 -d/)
echo sel $sel echo sel $sel
......
#! /usr/bin/python #!/usr/bin/python
import sys, os, subprocess, random, time, datetime import sys, os, subprocess, random, time, datetime
import pexpect, re import pexpect, re
import os.path import os.path
...@@ -9,9 +8,14 @@ import serial ...@@ -9,9 +8,14 @@ import serial
import config import config
from config import * from config import *
if inject:
from config_inject import *
def configurate_serie(): def configurate_serie():
#os.system("sudo stop ttyS0") #os.system("sudo stop ttyS0")
Puerto=0 Puerto=0
Puerto="/dev/ttyS0"
try: try:
serie = serial.Serial(Puerto, 115200) serie = serial.Serial(Puerto, 115200)
serie.timeout=1; serie.timeout=1;
...@@ -23,17 +27,27 @@ def configurate_serie(): ...@@ -23,17 +27,27 @@ def configurate_serie():
#mantener vivos los watdog softwre y hardware #mantener vivos los watdog softwre y hardware
def KeepWatchdog(): def KeepWatchdog():
os.system("/home/ubuntu/bin/refresh_watchdog > watchsoft.test") cab=os.environ.get("MYHOME")
if (cab==None):
cab=os.environ.get("HOME")
os.system(cab+"/bin/refresh_watchdog > watchsoft.test")
os.system("touch watchsoft.test") os.system("touch watchsoft.test")
# Comprime los ficheros con extension .tar
def gzipFiles():
listOfFiles = os.listdir('results')
for entry in listOfFiles:
if fnmatch.fnmatch(entry, "*.tar") or fnmatch.fnmatch(entry, "*.log"):
os.system("gzip -f results/" + entry)
def writeOutput(serie, output, elapsedTime, outputFileName, fileName): def writeOutput(serie, output, elapsedTime, outputFileName, fileName):
# if verbose: if verbose:
# print("\n***Elapsed time: %s ms. ***\n" % (elapsedTime)) print("\n***Elapsed time: %s ms. ***\n" % (elapsedTime))
serie.write("\n***Elapsed time: %s ms. ***\n" % (elapsedTime)) serie.write("\n***Elapsed time: %s ms. ***\n" % (elapsedTime))
if verbose: # if verbose:
print("%s " % (output) ) # print("%s " % (output) )
serie.write("%s " % (output) ) # serie.write("%s " % (output) )
output += "\n\n***Elapsed time: " + `elapsedTime` + " ms. ***\n\n" output += "\n\n***Elapsed time: " + `elapsedTime` + " ms. ***\n\n"
outputFile = open(outputFileName, "w") outputFile = open(outputFileName, "w")
...@@ -54,6 +68,7 @@ def runBenchmark(fiIni, fileName, tIni): ...@@ -54,6 +68,7 @@ def runBenchmark(fiIni, fileName, tIni):
else: else:
forever = False forever = False
if log:
stdLogFile = open("results/"+fileName+"_"+tIni+".log", "w") stdLogFile = open("results/"+fileName+"_"+tIni+".log", "w")
fiNumber = fiIni - 1 fiNumber = fiIni - 1
...@@ -63,6 +78,14 @@ def runBenchmark(fiIni, fileName, tIni): ...@@ -63,6 +78,14 @@ def runBenchmark(fiIni, fileName, tIni):
KeepWatchdog() KeepWatchdog()
# if (fiNumber > 100):
# tout = 90
# else:
# tout = timeout
if inject:
generateFiPointFromGroupedLines()
try: try:
x = datetime.datetime.now() x = datetime.datetime.now()
...@@ -74,9 +97,8 @@ def runBenchmark(fiIni, fileName, tIni): ...@@ -74,9 +97,8 @@ def runBenchmark(fiIni, fileName, tIni):
# os.system("sudo /home/ubuntu/bin/gpufreq-info") # os.system("sudo /home/ubuntu/bin/gpufreq-info")
# os.system("cpufreq-info | grep 'current CPU' | cut -d's' -f2 | cut -d'(' -f1") # os.system("cpufreq-info | grep 'current CPU' | cut -d's' -f2 | cut -d'(' -f1")
# print("./"+outputExeFile+" "+inputParameters)
# os.system("/home/ubuntu/bin/gpufreq-info >> /home/ubuntu/rodinia/lud/rad/results/res.out") p = pexpect.spawn("./"+outputExeFile+" "+inputParameters, timeout=timeout)
p = pexpect.spawn("./"+exeFile+" "+inputParameters, timeout=timeout)
p.expect(pexpect.EOF) p.expect(pexpect.EOF)
...@@ -87,34 +109,54 @@ def runBenchmark(fiIni, fileName, tIni): ...@@ -87,34 +109,54 @@ def runBenchmark(fiIni, fileName, tIni):
if (p.exitstatus == 0): if (p.exitstatus == 0):
if verbose: if verbose:
print("(%d) %s; PASS in %.2f ms. " % (fiNumber, ti, elapsedTime) ) print("(%d) %s; PASS in %.2f ms." % (fiNumber, ti, elapsedTime) )
print(p.before) #print(p.before)
sys.stdout.flush() sys.stdout.flush()
if log:
stdLogFile.write("(%d) %s; PASS in %.2f ms.\n" % (fiNumber, ti, elapsedTime) ) stdLogFile.write("(%d) %s; PASS in %.2f ms.\n" % (fiNumber, ti, elapsedTime) )
stdLogFile.write("%s" % (p.before) ) # stdLogFile.write("%s\n" % (p.before) )
stdLogFile.flush()
# serie.write("(%d) %s; PASS in %.2f ms.\n\r" % (fiNumber, ti, elapsedTime) )
# serie.write("%s\n" % (p.before) )
# serie.flush()
elif (p.exitstatus == 4):
if verbose:
print("(%d) %s; CRASH in %.2f ms." % (fiNumber, ti, elapsedTime) )
sys.stdout.flush()
if log:
stdLogFile.write("(%d) %s; CRASH in %.2f ms.; %s\n" % (fiNumber, ti, elapsedTime, outputFileName) )
# stdLogFile.write("%s\n" % (p.before) )
stdLogFile.flush() stdLogFile.flush()
serie.write("(%d) %s; PASS in %.2f ms.\n\r" % (fiNumber, ti, elapsedTime) ) # serie.write("(%d) %s; CRASH in %.2f ms.; %s\n\r" % (fiNumber, ti, elapsedTime, outputFileName) )
serie.write("%s" % (p.before) ) # serie.flush()
if log:
writeOutput(serie, p.before, elapsedTime, outputFileName, fileName+"_"+tIni)
elif (p.exitstatus == 1): elif (p.exitstatus == 1):
if verbose: if verbose:
print("(%d) %s; FAIL in %.2f ms." % (fiNumber, ti, elapsedTime) ) print("(%d) %s; SDC in %.2f ms." % (fiNumber, ti, elapsedTime) )
# print(p.before)
sys.stdout.flush() sys.stdout.flush()
stdLogFile.write("(%d) %s; FAIL in %.2f ms.; %s\n" % (fiNumber, ti, elapsedTime, outputFileName) ) if log:
stdLogFile.write("%s" % (p.before) ) stdLogFile.write("(%d) %s; SDC in %.2f ms.; %s\n" % (fiNumber, ti, elapsedTime, outputFileName) )
# stdLogFile.write("%s\n" % (p.before) )
stdLogFile.flush() stdLogFile.flush()
serie.write("(%d) %s; FAIL in %.2f ms.; %s\n\r" % (fiNumber, ti, elapsedTime, outputFileName) ) # serie.write("(%d) %s; SDC in %.2f ms.; %s\n\r" % (fiNumber, ti, elapsedTime, outputFileName) )
# serie.flush()
if log:
writeOutput(serie, p.before, elapsedTime, outputFileName, fileName+"_"+tIni) writeOutput(serie, p.before, elapsedTime, outputFileName, fileName+"_"+tIni)
else: else:
if verbose: if verbose:
print("(%d) %s; Exit status: %d in %.2f ms." % (fiNumber, ti, p.exitstatus, elapsedTime) ) print("(%d) %s; Exit status: %d in %.2f ms." % (fiNumber, ti, p.exitstatus, elapsedTime) )
sys.stdout.flush() sys.stdout.flush()
if log:
stdLogFile.write("(%d) %s; Exit status: %d in %.2f ms.\n" % (fiNumber, ti, p.exitstatus, elapsedTime) ) stdLogFile.write("(%d) %s; Exit status: %d in %.2f ms.\n" % (fiNumber, ti, p.exitstatus, elapsedTime) )
stdLogFile.write("%s" % (p.before) ) # stdLogFile.write("%s\n" % (p.before) )
stdLogFile.flush() stdLogFile.flush()
serie.write("(%d) %s; Exit status: %d in %.2f ms.\n\r" % (fiNumber, ti, p.exitstatus, elapsedTime) ) # serie.write("(%d) %s; Exit status: %d in %.2f ms.\n\r" % (fiNumber, ti, p.exitstatus, elapsedTime) )
# serie.flush()
if log:
writeOutput(serie, p.before, elapsedTime, outputFileName, fileName+"_"+tIni) writeOutput(serie, p.before, elapsedTime, outputFileName, fileName+"_"+tIni)
stdLogFile.flush()
numTimeouts = 0 numTimeouts = 0
...@@ -125,8 +167,9 @@ def runBenchmark(fiIni, fileName, tIni): ...@@ -125,8 +167,9 @@ def runBenchmark(fiIni, fileName, tIni):
lastFile.write("%d" % fiNumber) lastFile.write("%d" % fiNumber)
lastFile.flush() lastFile.flush()
lastFile.close() lastFile.close()
stdLogFile.close() if log:
stdLogFile.flush() stdLogFile.flush()
stdLogFile.close()
sys.exit(2) sys.exit(2)
except pexpect.EOF, e: except pexpect.EOF, e:
...@@ -138,14 +181,16 @@ def runBenchmark(fiIni, fileName, tIni): ...@@ -138,14 +181,16 @@ def runBenchmark(fiIni, fileName, tIni):
elapsedTime = time.time() - startTime elapsedTime = time.time() - startTime
if verbose: if verbose:
print("(%d) %s; Timeout after %.2f s." % (fiNumber, ti, elapsedTime) ) print("(%d) %s; Timeout after %.2f ms." % (fiNumber, ti, elapsedTime) )
sys.stdout.flush() sys.stdout.flush()
stdLogFile.write("(%d) %s; Timeout after %.2f s.\n" % (fiNumber, ti, elapsedTime) ) if log:
stdLogFile.write("%s" % (p.before) ) stdLogFile.write("(%d) %s; Timeout after %.2f ms.\n" % (fiNumber, ti, elapsedTime) )
stdLogFile.write("%s\n" % (p.before) )
stdLogFile.flush() stdLogFile.flush()
serie.write("(%d) %s; Timeout after %.2f s.\n\r" % (fiNumber, ti, elapsedTime) ) serie.write("(%d) %s; Timeout after %.2f ms.\n\r" % (fiNumber, ti, elapsedTime) )
serie.flush()
sys.stdout.flush() # sys.stdout.flush()
# stdLogFile.close() # stdLogFile.close()
numTimeouts += 1 numTimeouts += 1
...@@ -158,7 +203,7 @@ def runBenchmark(fiIni, fileName, tIni): ...@@ -158,7 +203,7 @@ def runBenchmark(fiIni, fileName, tIni):
lastFile.write("%d" % fiNumber) lastFile.write("%d" % fiNumber)
lastFile.flush() lastFile.flush()
lastFile.close() lastFile.close()
time.sleep(2) time.sleep(1)
sys.exit(3) sys.exit(3)
else: else:
lastFile.write("%d" % fiNumber) lastFile.write("%d" % fiNumber)
...@@ -172,21 +217,42 @@ def runBenchmark(fiIni, fileName, tIni): ...@@ -172,21 +217,42 @@ def runBenchmark(fiIni, fileName, tIni):
lastFile.flush() lastFile.flush()
lastFile.close() lastFile.close()
time.sleep(1) # time.sleep(1)
# end while # end while
if log:
stdLogFile.close() stdLogFile.close()
#end runBenchmark #end runBenchmark
def main(argv): def main(argv):
fileName = sys.argv[1] fileName = sys.argv[1]
fiIni = int( sys.argv[2] ) fiIni = int( sys.argv[2] )
tIni = sys.argv[3] tIni = sys.argv[3]
# if ( os.path.exists('lastFiNumber') ):
# lastFile = open("lastFiNumber", "r")
# fiIni = int( lastFile.read() ) + 1
# lastFile.close()
# else:
# fiIni = 1
# gzipFiles()
if inject:
groupProfileLines()
# x = datetime.datetime.now()
# fileName = bmName + x.strftime("_%H%M%S")
runBenchmark(fiIni, fileName, tIni) runBenchmark(fiIni, fileName, tIni)
# os.system("rm lastFiNumber")
# os.system("mv /home/ubuntu/startup_script.sh /home/ubuntu/startup_script_noactivo.sh")
############################################################################## ##############################################################################
#main() #main()
if __name__ == "__main__": if __name__ == "__main__":
......
!/bin/bash #!/bin/bash
if [ -z "${MYHOME}" ]
dir=`grep ^"dir = " config.py | cut -d"\"" -f2` then
MYHOME=$HOME
fi
PYTHONPATH=/usr/bin
#dir=`grep ^"dir = " config.py | cut -d"\"" -f2`
name=`grep ^"exeFile = " config.py | cut -d"\"" -f2` name=`grep ^"exeFile = " config.py | cut -d"\"" -f2`
size=`grep ^"size = " config.py | cut -d"\"" -f2` grid=`grep ^"grid = " config.py | cut -d"\"" -f2`
#blk=`grep ^"blk =" config.py | cut -d"\"" -f2` blk=`grep ^"blk =" config.py | cut -d"\"" -f2`
bench=`grep ^"bench =" config.py | cut -d"\"" -f2`
argcampo=`grep ^"duration =" config.py | cut -d"\"" -f2`
campo=`grep ^"scale =" config.py | cut -d"\"" -f2`
totalFiNumber=`grep ^"totalFiNumber = " config.py | cut -d"=" -f2` totalFiNumber=`grep ^"totalFiNumber = " config.py | cut -d"=" -f2`
cpufreq=`grep ^"cpufreq = " config.py | cut -d"=" -f2` cpufreq=`grep ^"cpufreq = " config.py | cut -d"=" -f2`
gpufreq=`grep ^"gpufreq = " config.py | cut -d"=" -f2` gpufreq=`grep ^"gpufreq = " config.py | cut -d"=" -f2`
PATH=${MYHOME}/bin:$PATH PATH=${MYHOME}/bin:$PATH
rm -f goldens #rm -f goldens
ln -s ${dir}/goldens goldens #ln -s ${dir}/goldens goldens
rm -f ${name} #rm -f ${name}
ln -s ${dir}/${name} ${name} #ln -s ${dir}/${name} ${name}
echo >> results/res.out echo >> results/res.out
echo "==================================" >> results/res.out echo "==================================" >> results/res.out
echo `date` >> results/res.out echo `date` >> results/res.out
echo "Experiment: " $name " size: " $size " cpufreq: " $cpufreq "gpufreq: " $gpufreq >> results/res.out echo "Experiment: " $bench " grid: " $grid " blk: " $blk "cpufreq: " $cpufreq "gpufreq: " $gpufreq $campo":" $argcampo>> results/res.out
echo "==================================" >> results/res.out echo "==================================" >> results/res.out
echo >> results/res.out echo >> results/res.out
...@@ -33,7 +42,6 @@ fi ...@@ -33,7 +42,6 @@ fi
if [ ${gpufreq} -ne -1 ] if [ ${gpufreq} -ne -1 ]
then then
# echo "initial GPUfreq: " `/home/buntu/bin/gpufreq-info` >> ./results/res.out
echo "Setting GPUFreq to: " ${gpufreq} >> results/res.out echo "Setting GPUFreq to: " ${gpufreq} >> results/res.out
sudo ${MYHOME}/bin/gpufreq-set ${gpufreq} sudo ${MYHOME}/bin/gpufreq-set ${gpufreq}
echo "GPUfreq set to: " `gpufreq-info` >> results/res.out echo "GPUfreq set to: " `gpufreq-info` >> results/res.out
...@@ -52,7 +60,7 @@ fi ...@@ -52,7 +60,7 @@ fi
#fi #fi
sudo killall iamalive_ini sudo killall iamalive_ini
sudo ${MYHOME}/bin/iamalive > /dev/ttyS0 & ${MYHOME}/bin/iamalive.sh # > /dev/ttyS0 &
if [ $totalFiNumber -eq -1 ] if [ $totalFiNumber -eq -1 ]
then then
...@@ -62,13 +70,13 @@ else ...@@ -62,13 +70,13 @@ else
fi fi
tIni=`date +%H%M%S` tIni=`date +%H%M%S`
# Tengo dudas
########### WARMING, WARMING ################ ########### WARMING, WARMING ################
./${name} -s ${size} -v #./${name} -s ${size} -v
########### WARMING, WARMING ################ ########### WARMING, WARMING ################
if [ ${gpufreq} -ne -1 ] if [ ${gpufreq} -ne -1 ]
then then
# echo "initial GPUfreq: " `/home/ubuntu/bin/gpufreq-info` >> ./results/res.out
echo "After warming. Setting GPUFreq to: " ${gpufreq} >> results/res.out echo "After warming. Setting GPUFreq to: " ${gpufreq} >> results/res.out
sudo ${MYHOME}/bin/gpufreq-set ${gpufreq} sudo ${MYHOME}/bin/gpufreq-set ${gpufreq}
echo "GPUfreq set to: " `gpufreq-info` >> results/res.out echo "GPUfreq set to: " `gpufreq-info` >> results/res.out
...@@ -86,14 +94,13 @@ do ...@@ -86,14 +94,13 @@ do
sufix="_"${g%"000000"} sufix="_"${g%"000000"}
fi fi
fileName=${name}"_"${size}${sufix} fileName=${bench}"_"${grid}"_b"${blk}"_"${sufix}
echo $fileName >> results/res.out echo $fileName >> results/res.out
echo "===========" >> results/res.out echo "===========" >> results/res.out
# fileName=${name}"_"${size}"_b"${blk} # fileName=${name}"_"${size}"_b"${blk}
# gzip -f results/*.log # gzip -f results/*.log
# gzip -f results/*.tar # gzip -f results/*.tar
if [ $# -eq 1 ] # parametro gdb if [ $# -eq 1 ] # parametro gdb
then then
./test_gdb.py $fileName $fiNumber $tIni #| tee ./results/${fileName}_${tIni}.out ./test_gdb.py $fileName $fiNumber $tIni #| tee ./results/${fileName}_${tIni}.out
...@@ -118,9 +125,8 @@ do ...@@ -118,9 +125,8 @@ do
forever=0 forever=0
else else
fiNumber=$((`cat lastFiNumber` + 1)) fiNumber=$((`cat lastFiNumber` + 1))
# pgrep $name fiNumber=$((`cat lastFiNumber` + 1))
# kill -9 `pgrep $name` fiNumber=$((`cat lastFiNumber` + 1))
# echo "Relaunching test after " $fiNumber " iterations."
fi fi
done # end while done # end while
...@@ -131,7 +137,7 @@ then ...@@ -131,7 +137,7 @@ then
fi fi
sudo killall iamalive sudo killall iamalive
sudo iamalive_ini 120 10 & ${MYHOME}/bin/iamalive_ini.sh # 120 10 &
sudo killall -2 reset sudo killall -2 reset
echo "Status after while loop: " $status echo "Status after while loop: " $status
...@@ -141,7 +147,3 @@ then ...@@ -141,7 +147,3 @@ then
sudo rm lastFiNumber sudo rm lastFiNumber
fi fi
#if [ $status != 2 ] # si no se ha interrumpido por teclado
#then
mv ${MYHOME}/startup_script.sh ${MYHOME}/startup_script_noactivo.sh
#fi
#!/bin/bash #!/bin/bash
# start the four cores
#/home/ubuntu/bin/startcores
export MYHOME=$(echo $0|cut -d'/' -f1-3) export MYHOME=$(echo $0|cut -d'/' -f1-3)
cd $MYHOME cd $MYHOME
#chmod 0666 /dev/ttyS0 #chmod a+rw /dev/watchdog0
# Nos vamos al directorio donde estan los test date>> reboot.log
cd `grep -v \# dir_test` export LD_LIBRARY_PATH=/usr/local/cuda/lib64
echo "Solo lo mantenemos vivo..." # Nos vamos al directorio donde estan los test
cd `grep -v \# dir_test`
#$MYHOME/bin/serie.py #tools/serie.py
#/home/happy/bin/serie.py
if test -f "deleteindex.flag"; then if test -f "deleteindex.flag"; then
rm lastFiNumber deleteindex.flag rm lastFiNumber deleteindex.flag
fi fi
$MYHOME/bin/iamalive #/bin/bash
$MYHOME/bin/iamalive_ini 20 10 &
./test.sh
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment