Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
German Leon
Carol-fi
Commits
707781af
Commit
707781af
authored
Jan 18, 2021
by
German Leon
Browse files
Por si falta algun detallito
parent
b5431069
Changes
11
Show whitespace changes
Inline
Side-by-side
app_profiler.py
View file @
707781af
...
@@ -101,13 +101,16 @@ def generate_gold(gdb_exec, benchmark_binary, benchmark_args,device):
...
@@ -101,13 +101,16 @@ def generate_gold(gdb_exec, benchmark_binary, benchmark_args,device):
def
main
():
def
main
():
os
.
system
(
"rm -f {}"
.
format
(
cp
.
KERNEL_INFO_DIR
))
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'-c'
,
'--conf'
,
dest
=
"config_file"
,
help
=
'Configuration file'
,
required
=
True
)
parser
.
add_argument
(
'-c'
,
'--conf'
,
dest
=
"config_file"
,
help
=
'Configuration file'
,
required
=
True
)
parser
.
add_argument
(
'-d'
,
'--device'
,
dest
=
"device"
,
help
=
"The GPU to perform FI."
parser
.
add_argument
(
'-d'
,
'--device'
,
dest
=
"device"
,
help
=
"The GPU to perform FI."
" Default is 0."
,
required
=
False
,
default
=
0
,
type
=
int
)
" Default is 0."
,
required
=
False
,
default
=
0
,
type
=
int
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
(
args
.
device
>
0
):
cp
.
LOGS_PATH
=
cp
.
LOGS_PATH
+
"-"
+
str
(
args
.
device
)
cp
.
rewrite_path
()
os
.
system
(
"rm -f {}"
.
format
(
cp
.
KERNEL_INFO_DIR
))
# Read the configuration file with data for all the apps that will be executed
# Read the configuration file with data for all the apps that will be executed
conf
=
cf
.
load_config_file
(
args
.
config_file
)
conf
=
cf
.
load_config_file
(
args
.
config_file
)
...
...
classes/BitFlip.py
View file @
707781af
...
@@ -38,30 +38,22 @@ class BitFlip:
...
@@ -38,30 +38,22 @@ class BitFlip:
def
numreg
(
kernel
):
def
numreg
(
kernel
):
try
:
try
:
disassemble_array
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
"disassemble {}"
.
format
(
kernel
))
disassemble_array
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
"disassemble {}"
.
format
(
kernel
))
print
(
"kenel={}"
.
format
(
kernel
))
#
print ("kenel={}".format(kernel))
except
:
except
:
print
(
"SIN NOmbre"
)
disassemble_array
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
"disassemble"
)
disassemble_array
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
"disassemble"
)
listareg
=
set
()
listareg
=
set
()
listaregdst
=
set
()
listaregdst
=
set
()
listaregcond
=
set
()
listaregcond
=
set
()
for
i
in
range
(
0
,
len
(
disassemble_array
)
-
1
):
for
i
in
range
(
0
,
len
(
disassemble_array
)
-
1
):
line
=
disassemble_array
[
i
]
line
=
disassemble_array
[
i
]
m
=
re
.
match
(
r
".*:\t(\S+) .*"
,
line
)
#
m=re.match(r".*:\t(\S+) .*",line)
#Para que es m
todacadena
=
"ASSM_LINE:{}"
.
format
(
line
)
todacadena
=
"ASSM_LINE:{}"
.
format
(
line
)
#print(todacadena)
lista
=
re
.
findall
(
r
"R(\d+)"
,
line
)
lista
=
re
.
findall
(
r
"R(\d+)"
,
line
)
if
(
len
(
lista
)
>
0
):
if
(
len
(
lista
)
>
0
):
listareg
.
update
(
lista
)
listareg
.
update
(
lista
)
#print (listareg)
#listaregdst.add (lista[0])
#print (listaregdst)
lista
=
re
.
findall
(
r
" P(\d+)"
,
line
)
lista
=
re
.
findall
(
r
" P(\d+)"
,
line
)
if
(
len
(
lista
)
>
0
):
if
(
len
(
lista
)
>
0
):
#print (listaregcond)
listaregcond
.
update
(
lista
)
listaregcond
.
update
(
lista
)
# if m and m.group(1) != '0':
# Print ("Encontrado"
print
(
"Registros Visibles ({})"
.
format
(
len
(
listareg
)))
print
(
"Registros Visibles ({})"
.
format
(
len
(
listareg
)))
print
(
listareg
)
print
(
listareg
)
...
@@ -75,13 +67,16 @@ class BitFlip:
...
@@ -75,13 +67,16 @@ class BitFlip:
"""
"""
def
asmline
(
self
):
def
asmline
(
self
):
#Leo la linea de ejecucion
#Leo la linea de ejecucion
return
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
"x/1i $pc"
)
linea
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
"x/1i $pc"
)
self
.
__logging
.
info
(
"ASSM_LINE:{}"
.
format
(
linea
[
0
]))
return
linea
def
reg_asmline
(
self
):
def
reg_asmline
(
self
):
#Obtengo los registros de la instruccion
#Obtengo los registros de la instruccion
linea
=
self
.
asmline
()
linea
=
self
.
asmline
()
self
.
__assmline
=
"ASSM_LINE:{}"
.
format
(
linea
[
0
])
#print (linea)#+"-"+str(len(linea))+"-"+linea[0])
#print ("============")
lista
=
re
.
findall
(
r
"R(\d+)"
,
linea
[
0
])
lista
=
re
.
findall
(
r
"R(\d+)"
,
linea
[
0
])
#Ahora son todos los registros.
#Ahora son todos los registros.
...
@@ -89,8 +84,11 @@ class BitFlip:
...
@@ -89,8 +84,11 @@ class BitFlip:
setlista
=
set
()
setlista
=
set
()
setlista
.
update
(
lista
)
setlista
.
update
(
lista
)
#self.__logging.info(str(len(setlista)))
return
setlista
return
setlista
def
regmod
(
self
):
def
regmod
(
self
):
lista
=
self
.
reg_asmline
()
lista
=
self
.
reg_asmline
()
while
len
(
lista
)
==
0
:
#Habria que poner un limite.
while
len
(
lista
)
==
0
:
#Habria que poner un limite.
...
@@ -102,9 +100,9 @@ class BitFlip:
...
@@ -102,9 +100,9 @@ class BitFlip:
strlistareg
=
"info registers "
strlistareg
=
"info registers "
for
x
in
listareg
:
for
x
in
listareg
:
strlistareg
+=
x
;
strlistareg
+=
x
;
#print (strlistareg)
self
.
__stringregs
=
strlistareg
self
.
__stringregs
=
strlistareg
#self.__logging.info("REFERED REGISTERS :"+strlistareg)
#Obtengo el valor de los registro referenciados
#Obtengo el valor de los registro referenciados
valores
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
strlistareg
)
valores
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
strlistareg
)
return
valores
return
valores
...
@@ -112,11 +110,12 @@ class BitFlip:
...
@@ -112,11 +110,12 @@ class BitFlip:
#Obtengo el valor de los registro referenciados por la primera instruccipn
#Obtengo el valor de los registro referenciados por la primera instruccipn
#self.__logging.info("===============================")
#self.__logging.info("===============================")
gdb
.
execute
(
"nexti"
)
gdb
.
execute
(
"nexti"
)
#self.__logging.info("==============================="+self.__stringregs)
linea
=
self
.
asmline
()
linea
=
self
.
asmline
()
#self.__logging.info("ASSM_LINE:{}".format(linea))
valores
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
self
.
__stringregs
)
valores
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
self
.
__stringregs
)
return
valores
return
valores
def
dictreg
(
self
,
valores
):
def
dictreg
(
self
,
valores
):
#self.__logging.info("Execute dictreg")
#self.__logging.info("Execute dictreg")
#Almaceno en un dictionario los valores de los registros
#Almaceno en un dictionario los valores de los registros
...
@@ -126,18 +125,11 @@ class BitFlip:
...
@@ -126,18 +125,11 @@ class BitFlip:
m
=
re
.
match
(
r
".*R(\d+).*0x([0-9a-fA-F]+).*"
,
x
)
m
=
re
.
match
(
r
".*R(\d+).*0x([0-9a-fA-F]+).*"
,
x
)
if
m
:
if
m
:
regs
[
m
.
group
(
1
)]
=
m
.
group
(
2
)
regs
[
m
.
group
(
1
)]
=
m
.
group
(
2
)
#print (str(m.group(1))+":= "+str(m.group(2)))
#print(regs)
#print ("========DR")
return
regs
return
regs
def
cmpregdst
(
self
,
valores
,
regs
):
def
cmpregdst
(
self
,
valores
,
regs
):
#Comparo los regsitros, para saber cuales he modificado.
#self.__logging.info("Execute cmpregdst------------")#+str(type(valores)))
regdst
=
set
()
regdst
=
set
()
#print("==cmpregdst")
#print("Arg;..valores...")
#print(type(valores))
#print (valores)
for
x
in
valores
:
for
x
in
valores
:
...
@@ -150,14 +142,13 @@ class BitFlip:
...
@@ -150,14 +142,13 @@ class BitFlip:
#self.__logging.info(str(len(regdst)))
#self.__logging.info(str(len(regdst)))
return
regdst
return
regdst
def
__inst_generic_injector
(
self
):
def
__inst_generic_injector
(
self
):
#def miinst_out():
#self.__logging.info("Comienzo")
regs
=
self
.
dictreg
(
self
.
regmod
())
regs
=
self
.
dictreg
(
self
.
regmod
())
#self.__logging.info("Reg1")
valores
=
self
.
nextinstr
()
valores
=
self
.
nextinstr
()
#self.__logging.info("Ejecutado sfte instuccion")
r
=
self
.
cmpregdst
(
valores
,
regs
)
r
=
self
.
cmpregdst
(
valores
,
regs
)
#self.__logging.info("Se han modificado {}".format(len(r)))
while
(
len
(
r
)
==
0
):
while
(
len
(
r
)
==
0
):
self
.
__logging
.
info
(
"INSTRUCTION WITHOUT OPERANDS"
)
self
.
__logging
.
info
(
"INSTRUCTION WITHOUT OPERANDS"
)
gdb
.
execute
(
"nexti"
)
gdb
.
execute
(
"nexti"
)
...
@@ -167,7 +158,7 @@ class BitFlip:
...
@@ -167,7 +158,7 @@ class BitFlip:
self
.
__register
=
"R{}"
.
format
(
r
.
pop
())
self
.
__register
=
"R{}"
.
format
(
r
.
pop
())
self
.
__logging
.
info
(
"SELECTED_REGISTER:{}"
.
format
(
self
.
__register
))
self
.
__logging
.
info
(
"SELECTED_REGISTER:{}"
.
format
(
self
.
__register
))
self
.
__logging
.
info
(
"ASSM_LINE:{}"
.
format
(
self
.
__assmline
))
# __rf_generic_injector will set fault_injected attribute
# __rf_generic_injector will set fault_injected attribute
self
.
__rf_generic_injector
()
self
.
__rf_generic_injector
()
...
@@ -265,6 +256,7 @@ class BitFlip:
...
@@ -265,6 +256,7 @@ class BitFlip:
def
__rf_generic_injector
(
self
):
def
__rf_generic_injector
(
self
):
try
:
try
:
# get register content
# get register content
self
.
asmline
()
reg_cmd
=
cf
.
execute_command
(
gdb
,
"p/t ${}"
.
format
(
self
.
__register
))
reg_cmd
=
cf
.
execute_command
(
gdb
,
"p/t ${}"
.
format
(
self
.
__register
))
m
=
re
.
match
(
r
'\$(\d+)[ ]*=[ ]*(\S+).*'
,
reg_cmd
[
0
])
m
=
re
.
match
(
r
'\$(\d+)[ ]*=[ ]*(\S+).*'
,
reg_cmd
[
0
])
...
...
codes/hotspot/hotspot.conf
View file @
707781af
...
@@ -26,20 +26,20 @@ maxWaitTimes = 5
...
@@ -26,20 +26,20 @@ maxWaitTimes = 5
# binary file of the application
# binary file of the application
# Must be full path
# Must be full path
benchmarkBinary
= /
home
/
badia
/
rodinia_3
.
1
/
cuda
/
hotspot
/
hotspot
benchmarkBinary
= /
home
/
badia
/
mycarol
-
fi
/
codes
/
hotspot
/
hotspot
#benchmarkBinary_noverificar = /home/badia/rodinia_3.1/cuda/lavaMD/lavaMD
#benchmarkBinary_noverificar = /home/badia/rodinia_3.1/cuda/lavaMD/lavaMD
# Commands to set the session inside GDB environment
# Commands to set the session inside GDB environment
benchmarkArgs
=
1024
2
10000
/
home
/
badia
/
rodinia_3
.
1
/
data
/
hotspot
/
temp_1024
/
home
/
badia
/
rodinia_3
.
1
/
/
data
/
hotspot
/
power_1024
output
.
out
benchmarkArgs
=
2
10000
/
home
/
badia
/
mycarol
-
fi
/
data
/
hotspot
/
temp_1024
/
home
/
badia
/
mycarol
-
fi
/
data
/
hotspot
/
power_1024
output
.
out
#benchmarkArgs = 16384 2 2 /home/badia/rodinia_3.1/data/hotspot/temp_16384 /home/badia/rodinia_3.1/data/hotspot/power_16384 output.out
#benchmarkArgs = 16384 2 2 /home/badia/rodinia_3.1/data/hotspot/temp_16384 /home/badia/rodinia_3.1/data/hotspot/power_16384 output.out
benchmarkArgs_noverificar
=
1024
2
10000
/
home
/
badia
/
rodinia_3
.
1
/
data
/
hotspot
/
temp_1024
/
home
/
badia
/
rodinia_3
.
1
/
data
/
hotspot
/
power_1024
output
.
out
benchmarkArgs_noverificar
=
1024
2
10000
/
home
/
badia
/
mycarol
-
fi
/
data
/
hotspot
/
temp_1024
/
home
/
badia
/
mycarol
-
fi
/
data
/
hotspot
/
power_1024
output
.
out
#benchmarkArgs_noverificar = 16384 2 2 /home/badia/rodinia_3.1/data/hotspot/temp_16384 /home/badia/rodinia_3.1/data/hotspot/power_16384 .
#benchmarkArgs_noverificar = 16384 2 2 /home/badia/rodinia_3.1/data/hotspot/temp_16384 /home/badia/rodinia_3.1/data/hotspot/power_16384 .
# CSV output file. It will be overwrite at each injection
# CSV output file. It will be overwrite at each injection
csvFile
=
results
/
hotspot_RF
.
csv
csvFile
=
results
/
hotspot_RF
.
csv
# You should create a script on the benchmark source folder to verify GOLD_OUTPUT x INJ_OUTPUT
# You should create a script on the benchmark source folder to verify GOLD_OUTPUT x INJ_OUTPUT
goldenCheckScript
=
../
rodinia_3
.
1
/
cuda
/
hotspot
/
sdc_check
.
sh
goldenCheckScript
=
codes
/
hotspot
/
sdc_check
.
sh
# Number of signals that will be sent to the application
# Number of signals that will be sent to the application
seqSignals
=
2
seqSignals
=
2
...
...
codes/lavaMD/lavaMD.conf
View file @
707781af
...
@@ -18,8 +18,8 @@ faultModel = 0
...
@@ -18,8 +18,8 @@ faultModel = 0
# INST_OUT -> Instruction Output (NOT IMPLEMENTED YET)
# INST_OUT -> Instruction Output (NOT IMPLEMENTED YET)
# INST_composed -> Instruction Adress (NOT IMPLEMENTED YET)
# INST_composed -> Instruction Adress (NOT IMPLEMENTED YET)
injectionSite
=
RF
#
injectionSite = RF
#
injectionSite = INST_OUT
injectionSite
=
INST_OUT
# Max time factor to finish the app, this will be multiplied by the application running time
# Max time factor to finish the app, this will be multiplied by the application running time
# For example if your app spend 2s, and the maxWaitTimes is 5, the max running time before it is
# For example if your app spend 2s, and the maxWaitTimes is 5, the max running time before it is
# Considered as a crash is 10s
# Considered as a crash is 10s
...
...
codes/nw/nw.conf
View file @
707781af
...
@@ -17,7 +17,7 @@ faultModel = 0
...
@@ -17,7 +17,7 @@ faultModel = 0
# RF -> Register File
# RF -> Register File
# INST_OUT -> Instruction Output (NOT IMPLEMENTED YET)
# INST_OUT -> Instruction Output (NOT IMPLEMENTED YET)
# INST_composed -> Instruction Adress (NOT IMPLEMENTED YET)
# INST_composed -> Instruction Adress (NOT IMPLEMENTED YET)
injectionSite
=
INST_OUT
injectionSite
=
RF
# Max time factor to finish the app, this will be multiplied by the application running time
# Max time factor to finish the app, this will be multiplied by the application running time
# For example if your app spend 2s, and the maxWaitTimes is 5, the max running time before it is
# For example if your app spend 2s, and the maxWaitTimes is 5, the max running time before it is
...
@@ -26,9 +26,9 @@ maxWaitTimes = 5
...
@@ -26,9 +26,9 @@ maxWaitTimes = 5
# binary file of the application
# binary file of the application
# Must be full path
# Must be full path
benchmarkBinary
= /
home
/
badia
/
rodinia_3
.
1
/
cuda
/
nw
/
needle
benchmarkBinary
= /
home
/
badia
/
mycarol
-
fi
/
codes
/
nw
/
needle
benchmarkBinary_noverificar
= /
home
/
badia
/
rodinia_3
.
1
/
cuda
/
nw
/
needle_MUDO
benchmarkBinary_noverificar
= /
home
/
badia
/
mycarol
-
fi
/
codes
/
nw
/
needle_MUDO
#benchmarkBinary_noverificar = /home/badia/rodinia_3.1/cuda/lavaMD/lavaMD
#benchmarkBinary_noverificar = /home/badia/rodinia_3.1/cuda/lavaMD/lavaMD
# Commands to set the session inside GDB environment
# Commands to set the session inside GDB environment
...
@@ -37,10 +37,10 @@ benchmarkArgs = 32000 1
...
@@ -37,10 +37,10 @@ benchmarkArgs = 32000 1
#benchmarkArgs_noverificar = -s 2048
#benchmarkArgs_noverificar = -s 2048
# CSV output file. It will be overwrite at each injection
# CSV output file. It will be overwrite at each injection
csvFile
=
/
home
/
badia
/
rodinia_3
.
1
/
cuda
/
nw
/
fi_nw_single_bit
.
csv
csvFile
=
results
/
nw_RF
.
csv
# You should create a script on the benchmark source folder to verify GOLD_OUTPUT x INJ_OUTPUT
# You should create a script on the benchmark source folder to verify GOLD_OUTPUT x INJ_OUTPUT
goldenCheckScript
=
../
rodinia_3
.
1
/
cuda
/
nw
/
sdc_check
.
sh
goldenCheckScript
=
codes
/
nw
/
sdc_check
.
sh
# Number of signals that will be sent to the application
# Number of signals that will be sent to the application
seqSignals
=
2
seqSignals
=
2
...
...
codes/nw/sdc_check.sh
View file @
707781af
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
# are environment variables defined by the fault_injector.py
# are environment variables defined by the fault_injector.py
# diff stdout
# diff stdout
diff
-B
${
INJ_OUTPUT_PATH
}
${
GOLD_OUTPUT_PATH
}
>
${
DIFF_LOG
}
# Special comparison like the following one can be done in this script
# Special comparison like the following one can be done in this script
grep
-q
"Result = FAIL"
${
INJ_OUTPUT_PATH
}
>>
${
DIFF_LOG
}
grep
-q
"Result = FAIL"
${
INJ_OUTPUT_PATH
}
>>
${
DIFF_LOG
}
...
@@ -18,9 +17,9 @@ grep -q "Result = FAIL" ${INJ_OUTPUT_PATH} >> ${DIFF_LOG}
...
@@ -18,9 +17,9 @@ grep -q "Result = FAIL" ${INJ_OUTPUT_PATH} >> ${DIFF_LOG}
diff
-B
${
INJ_ERR_PATH
}
${
GOLD_ERR_PATH
}
>
${
DIFF_ERR_LOG
}
diff
-B
${
INJ_ERR_PATH
}
${
GOLD_ERR_PATH
}
>
${
DIFF_ERR_LOG
}
echo
$pwd
echo
$pwd
ls
-l
result
*
ls
-l
result
*
diff ./result.txt
~/rodinia_3.1/cuda
/nw/gold/result.1.txt
>>
${
INJ_OUTPUT_PATH
}
diff ./result.txt
codes
/nw/gold/result.1.txt
>>
${
INJ_OUTPUT_PATH
}
diff ./result.txt ~/rodinia_3.1/cuda/nw/gold/result.1.txt
#>> ${INJ_OUTPUT_PATH}
#
diff ./result.txt ~/rodinia_3.1/cuda/nw/gold/result.1.txt #>> ${INJ_OUTPUT_PATH}
if
[
$?
-ne
0
]
if
[
$?
-ne
0
]
then
then
echo
"Result = FAIL"
>>
${
INJ_OUTPUT_PATH
}
echo
"Result = FAIL"
>>
${
INJ_OUTPUT_PATH
}
...
@@ -29,4 +28,6 @@ else
...
@@ -29,4 +28,6 @@ else
fi
fi
rm
result.txt
rm
result.txt
# Must exit 0
# Must exit 0
p
diff
-B
${
INJ_OUTPUT_PATH
}
${
GOLD_OUTPUT_PATH
}
>
${
DIFF_LOG
}
exit
0
exit
0
common_parameters.py
View file @
707781af
...
@@ -9,24 +9,11 @@ MAX_TIMES_TO_PROFILE = 2
...
@@ -9,24 +9,11 @@ MAX_TIMES_TO_PROFILE = 2
# Log path to store all injections info
# Log path to store all injections info
LOGS_PATH
=
'logs'
LOGS_PATH
=
'logs'
# Temporary file to store kernel information
KERNEL_INFO_DIR
=
LOGS_PATH
+
'/tmp/carol-fi-kernel-info.txt'
# For golden generation
GOLD_ERR_PATH
=
LOGS_PATH
+
'/tmp/carol_fi_golden_bench_err.txt'
GOLD_OUTPUT_PATH
=
LOGS_PATH
+
'/tmp/carol_fi_golden_bench_output.txt'
# Files that will be compared to golden ones
INJ_OUTPUT_PATH
=
LOGS_PATH
+
'/tmp/carol_fi_inj_bench_output_{}.txt'
INJ_ERR_PATH
=
LOGS_PATH
+
'/tmp/carol_fi_inj_bench_err_{}.txt'
# Internal python scripts
# Internal python scripts
FLIP_SCRIPT
=
'flip_value.py'
FLIP_SCRIPT
=
'flip_value.py'
PROFILER_SCRIPT
=
'profiler.py'
PROFILER_SCRIPT
=
'profiler.py'
# Temporary difference logs
DIFF_LOG
=
LOGS_PATH
+
'/tmp/diff_{}.log'
DIFF_ERR_LOG
=
LOGS_PATH
+
'/tmp/diff_err_{}.log'
# Debug env vars
# Debug env vars
# Debug FI process
# Debug FI process
...
@@ -34,14 +21,12 @@ DEBUG = True
...
@@ -34,14 +21,12 @@ DEBUG = True
# Debug profiler process
# Debug profiler process
DEBUG_PROFILER
=
True
DEBUG_PROFILER
=
True
# Log file for SignalApp thread
SIGNAL_APP_LOG
=
LOGS_PATH
+
'/tmp/signal_app_thread_{}.txt'
# Num of sleep time divisor
# Num of sleep time divisor
NUM_DIVISION_TIMES
=
100.0
NUM_DIVISION_TIMES
=
100.0
# Common body of log filename
# Common body of log filename
LOG_DEFAULT_NAME
=
LOGS_PATH
+
'/tmp/carolfi-flipvalue-{}.log'
# MAX INT 32 bits
# MAX INT 32 bits
...
@@ -110,3 +95,30 @@ LEAST_8_BITS = 5
...
@@ -110,3 +95,30 @@ LEAST_8_BITS = 5
# Focus error string
# Focus error string
FOCUS_ERROR_STRING
=
"Focus not set on any active CUDA kernel."
FOCUS_ERROR_STRING
=
"Focus not set on any active CUDA kernel."
def
rewrite_path
():
# Temporary file to store kernel information
global
KERNEL_INFO_DIR
,
GOLD_ERR_PATH
,
GOLD_OUTPUT_PATH
,
INJ_OUTPUT_PATH
,
INJ_ERR_PATH
,
DIFF_LOG
,
DIFF_ERR_LOG
,
SIGNAL_APP_LOG
,
LOG_DEFAULT_NAME
KERNEL_INFO_DIR
=
LOGS_PATH
+
'/tmp/carol-fi-kernel-info.txt'
# For golden generation
GOLD_ERR_PATH
=
LOGS_PATH
+
'/tmp/carol_fi_golden_bench_err.txt'
GOLD_OUTPUT_PATH
=
LOGS_PATH
+
'/tmp/carol_fi_golden_bench_output.txt'
# Files that will be compared to golden ones
INJ_OUTPUT_PATH
=
LOGS_PATH
+
'/tmp/carol_fi_inj_bench_output_{}.txt'
INJ_ERR_PATH
=
LOGS_PATH
+
'/tmp/carol_fi_inj_bench_err_{}.txt'
# Temporary difference logs
DIFF_LOG
=
LOGS_PATH
+
'/tmp/diff_{}.log'
DIFF_ERR_LOG
=
LOGS_PATH
+
'/tmp/diff_err_{}.log'
SIGNAL_APP_LOG
=
LOGS_PATH
+
'/tmp/signal_app_thread_{}.txt'
# Common body of log filename
LOG_DEFAULT_NAME
=
LOGS_PATH
+
'/tmp/carolfi-flipvalue-{}.log'
fault_injector.py
View file @
707781af
...
@@ -69,6 +69,7 @@ def signal_handler(sig, frame):
...
@@ -69,6 +69,7 @@ def signal_handler(sig, frame):
os
.
system
(
cmd
+
" > /dev/null 2>&1"
)
os
.
system
(
cmd
+
" > /dev/null 2>&1"
)
os
.
system
(
"rm -f {}/bin/*"
.
format
(
current_path
))
os
.
system
(
"rm -f {}/bin/*"
.
format
(
current_path
))
print
(
"Current_path "
+
current_path
)
for
th
in
gpus_threads
:
for
th
in
gpus_threads
:
th
.
join
()
th
.
join
()
#sys.exit(0)
#sys.exit(0)
...
@@ -309,19 +310,26 @@ def check_injection_outcome(host_thread, logging, injection_site):
...
@@ -309,19 +310,26 @@ def check_injection_outcome(host_thread, logging, injection_site):
# Check specific outcomes
# Check specific outcomes
# No need to process for RF
# No need to process for RF
instruction
=
'register'
instruction
=
'register'
assm_line
=
logging
.
search
(
"ASSM_LINE"
)
dpc
=
{}
dpc
[
'absoluto'
]
=
"0x"
+
re
.
match
(
r
".*0x([0-9a-fA-F]+) <.*"
,
assm_line
).
group
(
1
)
dpc
[
'relativo'
]
=
assm_line
.
split
(
'<'
)[
1
].
split
(
'>'
)[
0
]
print
(
"---PC: "
+
dpc
[
'absoluto'
]
+
"PC rel"
+
dpc
[
'relativo'
])
pc
=
dpc
[
'absoluto'
]
+
"<"
+
dpc
[
'relativo'
]
+
">"
if
cp
.
INJECTION_SITES
[
injection_site
]
in
[
cp
.
INST_OUT
,
cp
.
INST_ADD
]:
if
cp
.
INJECTION_SITES
[
injection_site
]
in
[
cp
.
INST_OUT
,
cp
.
INST_ADD
]:
# if fault was injected ASSM_LINE MUST be in the logfile
# if fault was injected ASSM_LINE MUST be in the logfile
assm_line
=
logging
.
search
(
"ASSM_LINE"
)
instruction
=
re
.
match
(
r
".*:\t(\S+) .*"
,
assm_line
).
group
(
1
)
instruction
=
re
.
match
(
r
".*:\t(\S+) .*"
,
assm_line
).
group
(
1
)
#instruction = assm_line
except
TypeError
as
te
:
except
TypeError
as
te
:
instruction
=
new_value
=
old_value
=
None
instruction
=
new_value
=
old_value
=
None
pc
=
instruction
fi_successful
=
False
fi_successful
=
False
if
cp
.
DEBUG
:
if
cp
.
DEBUG
:
cf
.
printf
(
"THREAD {} FAULT WAS NOT INJECTED. ERROR {}"
.
format
(
host_thread
,
te
))
cf
.
printf
(
"THREAD {} FAULT WAS NOT INJECTED. ERROR {}"
.
format
(
host_thread
,
te
))
return
block
,
fi_successful
,
new_value
,
old_value
,
register
,
thread
,
instruction
return
block
,
fi_successful
,
new_value
,
old_value
,
register
,
thread
,
instruction
,
pc
"""
"""
Function to run one execution of the fault injector
Function to run one execution of the fault injector
return old register value, new register value
return old register value, new register value
...
@@ -444,7 +452,7 @@ def gdb_inject_fault(**kwargs):
...
@@ -444,7 +452,7 @@ def gdb_inject_fault(**kwargs):
# Check if the carolfi logfile contains the information
# Check if the carolfi logfile contains the information
# to confirm the fault injection outcome
# to confirm the fault injection outcome
block
,
fi_successful
,
new_value
,
old_value
,
register
,
thread
,
instruction
=
check_injection_outcome
(
block
,
fi_successful
,
new_value
,
old_value
,
register
,
thread
,
instruction
,
pc
=
check_injection_outcome
(
host_thread
=
host_thread
,
host_thread
=
host_thread
,
logging
=
logging
,
logging
=
logging
,
injection_site
=
injection_site
injection_site
=
injection_site
...
@@ -460,7 +468,7 @@ def gdb_inject_fault(**kwargs):
...
@@ -460,7 +468,7 @@ def gdb_inject_fault(**kwargs):
cf
.
printf
(
"THREAD {} SAVE OUTPUT AND RETURN"
.
format
(
host_thread
))
cf
.
printf
(
"THREAD {} SAVE OUTPUT AND RETURN"
.
format
(
host_thread
))
return_list
=
[
register
,
old_value
,
new_value
,
fi_successful
,
return_list
=
[
register
,
old_value
,
new_value
,
fi_successful
,
is_hang
,
is_crash
,
is_sdc
,
is_masked
,
signal_init_wait_time
,
block
,
thread
,
instruction
,
user_defined_string
]
is_hang
,
is_crash
,
is_sdc
,
is_masked
,
signal_init_wait_time
,
block
,
thread
,
instruction
,
pc
,
user_defined_string
]
return
return_list
return
return_list
...
@@ -580,7 +588,7 @@ def fault_injection_by_signal(**kwargs):
...
@@ -580,7 +588,7 @@ def fault_injection_by_signal(**kwargs):
fi_tic
=
int
(
time
.
time
())
fi_tic
=
int
(
time
.
time
())
[
register
,
old_val
,
new_val
,
fault_injected
,
[
register
,
old_val
,
new_val
,
fault_injected
,
hang
,
crash
,
masked
,
sdc
,
signal_init_time
,
block
,
hang
,
crash
,
masked
,
sdc
,
signal_init_time
,
block
,
thread
,
instruction
,
user_defined_val
]
=
gdb_inject_fault
(
**
kwargs
)
thread
,
instruction
,
pc
,
user_defined_val
]
=
gdb_inject_fault
(
**
kwargs
)
# Time toc
# Time toc
...
@@ -596,7 +604,7 @@ def fault_injection_by_signal(**kwargs):
...
@@ -596,7 +604,7 @@ def fault_injection_by_signal(**kwargs):
row
=
[
unique_id
,
register
,
num_rounds
,
fault_model
,
thread
,
row
=
[
unique_id
,
register
,
num_rounds
,
fault_model
,
thread
,
block
,
old_val
,
new_val
,
injection_site
,
block
,
old_val
,
new_val
,
injection_site
,
fault_injected
,
hang
,
crash
[
0
],
sdc
,
masked
,
tmp
,
injection_time
,
fault_injected
,
hang
,
crash
[
0
],
sdc
,
masked
,
tmp
,
injection_time
,
signal_init_time
,
bits_to_flip
,
instruction
,
user_defined_val
]
signal_init_time
,
bits_to_flip
,
instruction
,
pc
,
user_defined_val
]
if
fault_injected
:
if
fault_injected
:
# output_str = "THREAD:{}, FAULT NUM:{}".format(host_thread, num_rounds)
# output_str = "THREAD:{}, FAULT NUM:{}".format(host_thread, num_rounds)
...
@@ -662,6 +670,9 @@ def main():
...
@@ -662,6 +670,9 @@ def main():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
args
.
iterations
<
1
:
if
args
.
iterations
<
1
:
parser
.
error
(
'Iterations must be greater than zero'
)
parser
.
error
(
'Iterations must be greater than zero'
)
if
(
args
.
device
>
0
):
cp
.
LOGS_PATH
=
cp
.
LOGS_PATH
+
"-"
+
str
(
args
.
device
)
cp
.
rewrite_path
()
# Start with a different seed every time to vary the random numbers generated
# Start with a different seed every time to vary the random numbers generated
# the seed will be the current number of second since 01/01/70
# the seed will be the current number of second since 01/01/70
...
@@ -689,7 +700,7 @@ def main():
...
@@ -689,7 +700,7 @@ def main():
# Csv log
# Csv log
fieldnames
=
[
'unique_id'
,
'register'
,
'iteration'
,
'fault_model'
,
'thread'
,
'block'
,
'old_value'
,
fieldnames
=
[
'unique_id'
,
'register'
,
'iteration'
,
'fault_model'
,
'thread'
,
'block'
,
'old_value'
,
'new_value'
,
'inj_site'
,
'fault_successful'
,
'hang'
,
'crash'
,
'masked'
,
'sdc'
,
'Exception'
,
'time'
,
'new_value'
,
'inj_site'
,
'fault_successful'
,
'hang'
,
'crash'
,
'masked'
,
'sdc'
,
'Exception'
,
'time'
,
'inj_time_location'
,
'bits_flipped'
,
'instruction'
,
'user_defined'
]
'inj_time_location'
,
'bits_flipped'
,
'instruction'
,
'pc'
,
'user_defined'
]
if
os
.
path
.
exists
(
"tmpxxx_num_rounds.conf"
):
if
os
.
path
.
exists
(
"tmpxxx_num_rounds.conf"
):
mode
=
'a'
mode
=
'a'
...
...
test.sh
View file @
707781af
...
@@ -5,7 +5,7 @@ set -e
...
@@ -5,7 +5,7 @@ set -e
#uncomment to a more verbose script
#uncomment to a more verbose script
#set -x
#set -x
FAULTS
=
10
00
FAULTS
=
10
#CONFFILE=codes/matrixMul/matrixmul_16K.conf
#CONFFILE=codes/matrixMul/matrixmul_16K.conf
#CONFFILE=codes/mmElem/matrixmul_16K.conf
#CONFFILE=codes/mmElem/matrixmul_16K.conf
...
@@ -28,4 +28,4 @@ done
...
@@ -28,4 +28,4 @@ done
echo
"Fault injection finished"
echo
"Fault injection finished"
date
>>
tiempos
date
>>
tiempos
echo
"Fin..."
>>
tiempos
echo
"Fin..."
>>
tiempos
exit
0
exit
test_hotspot.sh
View file @
707781af
...
@@ -4,8 +4,8 @@ set -e
...
@@ -4,8 +4,8 @@ set -e
#uncomment to a more verbose script
#uncomment to a more verbose script
#set -x
#set -x
DIR_RODINIA
=
$HOME
/rodinia_3.1/cuda
DIR_RODINIA
=
codes
FAULTS
=
100
0
FAULTS
=
100
#CONFFILE=codes/matrixMul/matrixmul_16K.conf
#CONFFILE=codes/matrixMul/matrixmul_16K.conf
#CONFFILE=codes/mmElem/matrixmul_16K.conf
#CONFFILE=codes/mmElem/matrixmul_16K.conf
...
...
test_nw.sh
View file @
707781af
...
@@ -4,8 +4,9 @@ set -e
...
@@ -4,8 +4,9 @@ set -e
#uncomment to a more verbose script
#uncomment to a more verbose script
#set -x
#set -x
DIR_RODINIA
=
$HOME
/rodinia_3.1/cuda
#DIR_RODINIA=$HOME/rodinia_3.1/cuda
FAULTS
=
1000
DIR_RODINIA
=
codes
FAULTS
=
100
#CONFFILE=codes/matrixMul/matrixmul_16K.conf
#CONFFILE=codes/matrixMul/matrixmul_16K.conf
#CONFFILE=codes/mmElem/matrixmul_16K.conf
#CONFFILE=codes/mmElem/matrixmul_16K.conf
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment