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
if [ -z "${MYHOME}" ]
then
MYHOME=$HOME
fi
sudo ${MYHOME}/bin/iamalive_ini 120 10 & #>/dev/ttyS0
......@@ -2,13 +2,13 @@
function reset
{
$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
function downcounter {
sudo killall -9 test.sh
sudo killall -2 test.py
echo -e "yanoesubuntu\n"| sudo -S killall -9 test.sh
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
}
......
#############################################################################
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= `grep -v \# $HOME/dir_test`
dir=`grep -v \# $HOME/dir_test`
sel=$(ls -l ${dir}/config.py|cut -f2 -d\>|cut -f2 -d/)
echo sel $sel
......
#! /usr/bin/python
#!/usr/bin/python
import sys, os, subprocess, random, time, datetime
import pexpect, re
import os.path
......@@ -9,9 +8,14 @@ import serial
import config
from config import *
if inject:
from config_inject import *
def configurate_serie():
#os.system("sudo stop ttyS0")
Puerto=0
Puerto="/dev/ttyS0"
try:
serie = serial.Serial(Puerto, 115200)
serie.timeout=1;
......@@ -23,17 +27,27 @@ def configurate_serie():
#mantener vivos los watdog softwre y hardware
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")
# 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):
# if verbose:
# print("\n***Elapsed time: %s ms. ***\n" % (elapsedTime))
if verbose:
print("\n***Elapsed time: %s ms. ***\n" % (elapsedTime))
serie.write("\n***Elapsed time: %s ms. ***\n" % (elapsedTime))
if verbose:
print("%s " % (output) )
serie.write("%s " % (output) )
# if verbose:
# print("%s " % (output) )
# serie.write("%s " % (output) )
output += "\n\n***Elapsed time: " + `elapsedTime` + " ms. ***\n\n"
outputFile = open(outputFileName, "w")
......@@ -54,7 +68,8 @@ def runBenchmark(fiIni, fileName, tIni):
else:
forever = False
stdLogFile = open("results/"+fileName+"_"+tIni+".log", "w")
if log:
stdLogFile = open("results/"+fileName+"_"+tIni+".log", "w")
fiNumber = fiIni - 1
while forever or ( (fiNumber+1) < totalFiNumber+1):
......@@ -63,6 +78,14 @@ def runBenchmark(fiIni, fileName, tIni):
KeepWatchdog()
# if (fiNumber > 100):
# tout = 90
# else:
# tout = timeout
if inject:
generateFiPointFromGroupedLines()
try:
x = datetime.datetime.now()
......@@ -74,9 +97,8 @@ def runBenchmark(fiIni, fileName, tIni):
# os.system("sudo /home/ubuntu/bin/gpufreq-info")
# os.system("cpufreq-info | grep 'current CPU' | cut -d's' -f2 | cut -d'(' -f1")
# os.system("/home/ubuntu/bin/gpufreq-info >> /home/ubuntu/rodinia/lud/rad/results/res.out")
p = pexpect.spawn("./"+exeFile+" "+inputParameters, timeout=timeout)
# print("./"+outputExeFile+" "+inputParameters)
p = pexpect.spawn("./"+outputExeFile+" "+inputParameters, timeout=timeout)
p.expect(pexpect.EOF)
......@@ -87,34 +109,54 @@ def runBenchmark(fiIni, fileName, tIni):
if (p.exitstatus == 0):
if verbose:
print("(%d) %s; PASS in %.2f ms. " % (fiNumber, ti, elapsedTime) )
print(p.before)
sys.stdout.flush()
stdLogFile.write("(%d) %s; PASS in %.2f ms.\n" % (fiNumber, ti, elapsedTime) )
stdLogFile.write("%s" % (p.before) )
stdLogFile.flush()
serie.write("(%d) %s; PASS in %.2f ms.\n\r" % (fiNumber, ti, elapsedTime) )
serie.write("%s" % (p.before) )
print("(%d) %s; PASS in %.2f ms." % (fiNumber, ti, elapsedTime) )
#print(p.before)
sys.stdout.flush()
if log:
stdLogFile.write("(%d) %s; PASS in %.2f ms.\n" % (fiNumber, ti, elapsedTime) )
# 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()
# serie.write("(%d) %s; CRASH in %.2f ms.; %s\n\r" % (fiNumber, ti, elapsedTime, outputFileName) )
# serie.flush()
if log:
writeOutput(serie, p.before, elapsedTime, outputFileName, fileName+"_"+tIni)
elif (p.exitstatus == 1):
if verbose:
print("(%d) %s; FAIL in %.2f ms." % (fiNumber, ti, elapsedTime) )
sys.stdout.flush()
stdLogFile.write("(%d) %s; FAIL in %.2f ms.; %s\n" % (fiNumber, ti, elapsedTime, outputFileName) )
stdLogFile.write("%s" % (p.before) )
stdLogFile.flush()
serie.write("(%d) %s; FAIL in %.2f ms.; %s\n\r" % (fiNumber, ti, elapsedTime, outputFileName) )
writeOutput(serie, p.before, elapsedTime, outputFileName, fileName+"_"+tIni)
print("(%d) %s; SDC in %.2f ms." % (fiNumber, ti, elapsedTime) )
# print(p.before)
sys.stdout.flush()
if log:
stdLogFile.write("(%d) %s; SDC in %.2f ms.; %s\n" % (fiNumber, ti, elapsedTime, outputFileName) )
# stdLogFile.write("%s\n" % (p.before) )
stdLogFile.flush()
# 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)
else:
if verbose:
print("(%d) %s; Exit status: %d in %.2f ms." % (fiNumber, ti, p.exitstatus, elapsedTime) )
sys.stdout.flush()
stdLogFile.write("(%d) %s; Exit status: %d in %.2f ms.\n" % (fiNumber, ti, p.exitstatus, elapsedTime) )
stdLogFile.write("%s" % (p.before) )
stdLogFile.flush()
serie.write("(%d) %s; Exit status: %d in %.2f ms.\n\r" % (fiNumber, ti, p.exitstatus, elapsedTime) )
writeOutput(serie, p.before, elapsedTime, outputFileName, fileName+"_"+tIni)
sys.stdout.flush()
if log:
stdLogFile.write("(%d) %s; Exit status: %d in %.2f ms.\n" % (fiNumber, ti, p.exitstatus, elapsedTime) )
# stdLogFile.write("%s\n" % (p.before) )
stdLogFile.flush()
# 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)
stdLogFile.flush()
numTimeouts = 0
......@@ -125,8 +167,9 @@ def runBenchmark(fiIni, fileName, tIni):
lastFile.write("%d" % fiNumber)
lastFile.flush()
lastFile.close()
stdLogFile.close()
stdLogFile.flush()
if log:
stdLogFile.flush()
stdLogFile.close()
sys.exit(2)
except pexpect.EOF, e:
......@@ -138,14 +181,16 @@ def runBenchmark(fiIni, fileName, tIni):
elapsedTime = time.time() - startTime
if verbose:
print("(%d) %s; Timeout after %.2f s." % (fiNumber, ti, elapsedTime) )
sys.stdout.flush()
stdLogFile.write("(%d) %s; Timeout after %.2f s.\n" % (fiNumber, ti, elapsedTime) )
stdLogFile.write("%s" % (p.before) )
stdLogFile.flush()
serie.write("(%d) %s; Timeout after %.2f s.\n\r" % (fiNumber, ti, elapsedTime) )
sys.stdout.flush()
print("(%d) %s; Timeout after %.2f ms." % (fiNumber, ti, elapsedTime) )
sys.stdout.flush()
if log:
stdLogFile.write("(%d) %s; Timeout after %.2f ms.\n" % (fiNumber, ti, elapsedTime) )
stdLogFile.write("%s\n" % (p.before) )
stdLogFile.flush()
serie.write("(%d) %s; Timeout after %.2f ms.\n\r" % (fiNumber, ti, elapsedTime) )
serie.flush()
# sys.stdout.flush()
# stdLogFile.close()
numTimeouts += 1
......@@ -158,7 +203,7 @@ def runBenchmark(fiIni, fileName, tIni):
lastFile.write("%d" % fiNumber)
lastFile.flush()
lastFile.close()
time.sleep(2)
time.sleep(1)
sys.exit(3)
else:
lastFile.write("%d" % fiNumber)
......@@ -172,21 +217,42 @@ def runBenchmark(fiIni, fileName, tIni):
lastFile.flush()
lastFile.close()
time.sleep(1)
# time.sleep(1)
# end while
stdLogFile.close()
if log:
stdLogFile.close()
#end runBenchmark
def main(argv):
fileName = sys.argv[1]
fiIni = int( sys.argv[2] )
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)
# os.system("rm lastFiNumber")
# os.system("mv /home/ubuntu/startup_script.sh /home/ubuntu/startup_script_noactivo.sh")
##############################################################################
#main()
if __name__ == "__main__":
......
!/bin/bash
dir=`grep ^"dir = " config.py | cut -d"\"" -f2`
#!/bin/bash
if [ -z "${MYHOME}" ]
then
MYHOME=$HOME
fi
PYTHONPATH=/usr/bin
#dir=`grep ^"dir = " config.py | cut -d"\"" -f2`
name=`grep ^"exeFile = " config.py | cut -d"\"" -f2`
size=`grep ^"size = " config.py | cut -d"\"" -f2`
#blk=`grep ^"blk =" config.py | cut -d"\"" -f2`
grid=`grep ^"grid = " 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`
cpufreq=`grep ^"cpufreq = " config.py | cut -d"=" -f2`
gpufreq=`grep ^"gpufreq = " config.py | cut -d"=" -f2`
PATH=${MYHOME}/bin:$PATH
rm -f goldens
ln -s ${dir}/goldens goldens
#rm -f goldens
#ln -s ${dir}/goldens goldens
rm -f ${name}
ln -s ${dir}/${name} ${name}
#rm -f ${name}
#ln -s ${dir}/${name} ${name}
echo >> results/res.out
echo "==================================" >> 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
......@@ -33,7 +42,6 @@ fi
if [ ${gpufreq} -ne -1 ]
then
# echo "initial GPUfreq: " `/home/buntu/bin/gpufreq-info` >> ./results/res.out
echo "Setting GPUFreq to: " ${gpufreq} >> results/res.out
sudo ${MYHOME}/bin/gpufreq-set ${gpufreq}
echo "GPUfreq set to: " `gpufreq-info` >> results/res.out
......@@ -52,7 +60,7 @@ fi
#fi
sudo killall iamalive_ini
sudo ${MYHOME}/bin/iamalive > /dev/ttyS0 &
${MYHOME}/bin/iamalive.sh # > /dev/ttyS0 &
if [ $totalFiNumber -eq -1 ]
then
......@@ -62,13 +70,13 @@ else
fi
tIni=`date +%H%M%S`
# Tengo dudas
########### WARMING, WARMING ################
./${name} -s ${size} -v
#./${name} -s ${size} -v
########### WARMING, WARMING ################
if [ ${gpufreq} -ne -1 ]
then
# echo "initial GPUfreq: " `/home/ubuntu/bin/gpufreq-info` >> ./results/res.out
echo "After warming. Setting GPUFreq to: " ${gpufreq} >> results/res.out
sudo ${MYHOME}/bin/gpufreq-set ${gpufreq}
echo "GPUfreq set to: " `gpufreq-info` >> results/res.out
......@@ -86,14 +94,13 @@ do
sufix="_"${g%"000000"}
fi
fileName=${name}"_"${size}${sufix}
fileName=${bench}"_"${grid}"_b"${blk}"_"${sufix}
echo $fileName >> results/res.out
echo "===========" >> results/res.out
# fileName=${name}"_"${size}"_b"${blk}
# gzip -f results/*.log
# gzip -f results/*.tar
if [ $# -eq 1 ] # parametro gdb
then
./test_gdb.py $fileName $fiNumber $tIni #| tee ./results/${fileName}_${tIni}.out
......@@ -118,9 +125,8 @@ do
forever=0
else
fiNumber=$((`cat lastFiNumber` + 1))
# pgrep $name
# kill -9 `pgrep $name`
# echo "Relaunching test after " $fiNumber " iterations."
fiNumber=$((`cat lastFiNumber` + 1))
fiNumber=$((`cat lastFiNumber` + 1))
fi
done # end while
......@@ -131,7 +137,7 @@ then
fi
sudo killall iamalive
sudo iamalive_ini 120 10 &
${MYHOME}/bin/iamalive_ini.sh # 120 10 &
sudo killall -2 reset
echo "Status after while loop: " $status
......@@ -141,7 +147,3 @@ then
sudo rm lastFiNumber
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
# start the four cores
#/home/ubuntu/bin/startcores
export MYHOME=$(echo $0|cut -d'/' -f1-3)
cd $MYHOME
#chmod 0666 /dev/ttyS0
#chmod a+rw /dev/watchdog0
# Nos vamos al directorio donde estan los test
cd `grep -v \# dir_test`
date>> reboot.log
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
#/home/happy/bin/serie.py
#tools/serie.py
if test -f "deleteindex.flag"; then
rm lastFiNumber deleteindex.flag
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