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
31d82b8c
Commit
31d82b8c
authored
Jan 11, 2021
by
German Leon
Browse files
Mas refinado, parece que version definitiva
parent
663c6b9c
Changes
8
Hide whitespace changes
Inline
Side-by-side
app_profiler.py
View file @
31d82b8c
...
@@ -67,7 +67,7 @@ def profiler_caller(gdb_exec, kernels, benchmark_binary, benchmark_args,device,s
...
@@ -67,7 +67,7 @@ def profiler_caller(gdb_exec, kernels, benchmark_binary, benchmark_args,device,s
for
i
in
range
(
0
,
cp
.
MAX_TIMES_TO_PROFILE
):
for
i
in
range
(
0
,
cp
.
MAX_TIMES_TO_PROFILE
):
start
=
time
.
time
()
start
=
time
.
time
()
os
.
system
(
profiler_cmd
)
#
os.system(profiler_cmd)
end
=
time
.
time
()
end
=
time
.
time
()
ret_profiler
=
cf
.
load_config_file
(
"tmpxxx_return_profiler.conf"
)
ret_profiler
=
cf
.
load_config_file
(
"tmpxxx_return_profiler.conf"
)
acc_time_profiler
+=
float
(
ret_profiler
.
get
(
'DEFAULT'
,
'Tiempo'
))
acc_time_profiler
+=
float
(
ret_profiler
.
get
(
'DEFAULT'
,
'Tiempo'
))
...
...
classes/BitFlip.py
View file @
31d82b8c
...
@@ -34,6 +34,42 @@ class BitFlip:
...
@@ -34,6 +34,42 @@ class BitFlip:
exc_type
,
exc_obj
,
exc_tb
=
sys
.
exc_info
()
exc_type
,
exc_obj
,
exc_tb
=
sys
.
exc_info
()
return
"Exception type {} at line {}"
.
format
(
exc_type
,
exc_tb
.
tb_lineno
)
return
"Exception type {} at line {}"
.
format
(
exc_type
,
exc_tb
.
tb_lineno
)
@
staticmethod
def
numreg
(
kernel
):
try
:
disassemble_array
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
"disassemble {}"
.
format
(
kernel
))
print
(
"kenel={}"
.
format
(
kernel
))
except
:
print
(
"SIN NOmbre"
)
disassemble_array
=
cf
.
execute_command
(
gdb
=
gdb
,
to_execute
=
"disassemble"
)
listareg
=
set
()
listaregdst
=
set
()
listaregcond
=
set
()
for
i
in
range
(
0
,
len
(
disassemble_array
)
-
1
):
line
=
disassemble_array
[
i
]
m
=
re
.
match
(
r
".*:\t(\S+) .*"
,
line
)
todacadena
=
"ASSM_LINE:{}"
.
format
(
line
)
#print(todacadena)
lista
=
re
.
findall
(
r
"R(\d+)"
,
line
)
if
(
len
(
lista
)
>
0
):
listareg
.
update
(
lista
)
#print (listareg)
#listaregdst.add (lista[0])
#print (listaregdst)
lista
=
re
.
findall
(
r
" P(\d+)"
,
line
)
if
(
len
(
lista
)
>
0
):
#print (listaregcond)
listaregcond
.
update
(
lista
)
# if m and m.group(1) != '0':
# Print ("Encontrado"
print
(
"Registros Visibles ({})"
.
format
(
len
(
listareg
)))
print
(
listareg
)
print
(
"Registros destino ({})"
.
format
(
len
(
listaregdst
)))
print
(
listaregdst
)
print
(
"Registros condicionales ({})"
.
format
(
len
(
listaregcond
)))
print
(
listaregcond
)
return
(
listareg
)
"""
"""
TODO: Describe the method
TODO: Describe the method
"""
"""
...
...
common_parameters.py
View file @
31d82b8c
...
@@ -22,7 +22,7 @@ INJ_ERR_PATH = LOGS_PATH + '/tmp/carol_fi_inj_bench_err_{}.txt'
...
@@ -22,7 +22,7 @@ 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
_new
.py'
PROFILER_SCRIPT
=
'profiler.py'
# Temporary difference logs
# Temporary difference logs
DIFF_LOG
=
LOGS_PATH
+
'/tmp/diff_{}.log'
DIFF_LOG
=
LOGS_PATH
+
'/tmp/diff_{}.log'
...
...
fault_injector.py
View file @
31d82b8c
...
@@ -647,7 +647,7 @@ def main():
...
@@ -647,7 +647,7 @@ def main():
global
kill_strings
,
current_path
,
gpus_threads
,
lock
,
syncro
,
wait_finish
global
kill_strings
,
current_path
,
gpus_threads
,
lock
,
syncro
,
wait_finish
signal
.
signal
(
signal
.
SIGUSR1
,
receiveSignal
);
signal
.
signal
(
signal
.
SIGUSR1
,
receiveSignal
);
signal
.
signal
(
signal
.
SIG
USR2
,
receiveEnd
);
signal
.
signal
(
signal
.
SIG
RTMIN
,
receiveEnd
);
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
(
'-i'
,
'--iter'
,
dest
=
"iterations"
,
parser
.
add_argument
(
'-i'
,
'--iter'
,
dest
=
"iterations"
,
...
...
flip_value.py
View file @
31d82b8c
import
os
import
os
,
signal
import
gdb
import
gdb
import
time
import
time
from
classes.BitFlip
import
BitFlip
from
classes.BitFlip
import
BitFlip
...
@@ -12,9 +12,10 @@ Handler attached to exit event
...
@@ -12,9 +12,10 @@ Handler attached to exit event
def
exit_handler
(
event
):
def
exit_handler
(
event
):
global
global_logging
global
global_logging
os
.
system
(
"kill -s SIGRTMIN "
+
str
(
pid
))
global_logging
.
info
(
str
(
"event type: exit"
))
global_logging
.
info
(
str
(
"event type: exit"
))
print
(
"llego el final"
)
print
(
"llego el final"
)
os
.
system
(
"kill -s USR2 "
+
str
(
pid
))
try
:
try
:
global_logging
.
info
(
"exit code: {}"
.
format
(
str
(
event
.
exit_code
)))
global_logging
.
info
(
"exit code: {}"
.
format
(
str
(
event
.
exit_code
)))
except
Exception
as
err
:
except
Exception
as
err
:
...
...
profiler.py
View file @
31d82b8c
import
gdb
import
gdb
import
time
import
re
import
sys
import
common_functions
as
cf
from
classes.BitFlip
import
BitFlip
def
exit_handler
(
event
):
global
nosalir
nosalir
=
False
print
(
str
(
"event type: exit"
))
try
:
print
(
"exit code: {}"
.
format
(
str
(
event
.
exit_code
)))
except
Exception
as
err
:
err_str
=
"ERROR: {}"
.
format
(
str
(
err
))
print
(
err_str
)
"""
Handler that will put a breakpoint on the kernel after
signal
"""
def
set_event
(
event
):
global
trun
,
ocurrencias
,
t
,
primera
print
(
"Es mi primera vez"
+
str
(
primera
)
+
" "
+
str
(
ocurrencias
))
if
(
isinstance
(
event
,
gdb
.
BreakpointEvent
)):
if
(
primera
):
t
=
time
.
time
()
print
(
"Tomo tiempo "
+
str
(
t
))
ocurrencias
=
ocurrencias
+
1
else
:
print
(
"Para tiempo "
+
str
(
time
.
time
()))
trun
=
(
time
.
time
()
-
t
)
primera
=
not
primera
# else:
# trun=(time.clock()-t)
"""
"""
Main function
Main function
"""
"""
def
main
():
global
ocurrencias
,
t
,
nosalir
,
trun
,
primera
primera
=
True
;
ocurrencias
=
0
;
# Initialize GDB to run the app
gdb
.
execute
(
"set confirm off"
)
gdb
.
execute
(
"set pagination off"
)
gdb
.
execute
(
"set target-async off"
)
gdb
.
execute
(
"set non-stop off"
)
# Initialize GDB to run the app
# Connecting to a exit handler event
gdb
.
execute
(
"set confirm off"
)
gdb
.
events
.
exited
.
connect
(
exit_handler
)
gdb
.
execute
(
"set pagination off"
)
gdb
.
execute
(
"set target-async off"
)
gdb
.
execute
(
"set non-stop off"
)
# gdb_init_strings = str(os.environ["CAROL_FI_INFO"])
# Connecting to a stop signal event
gdb
_init_strings
=
arg0
gdb
.
events
.
stop
.
connect
(
set_event
)
for
init_str
in
gdb_init_strings
.
split
(
";"
):
# gdb_init_strings = str(os.environ["CAROL_FI_INFO"])
gdb_init_strings
=
arg0
cadena
=
gdb_init_strings
.
split
(
";"
,
3
)
print
>>
sys
.
stderr
,
(
cadena
[
0
])
#,"-",cadena[0],"-",cadena[1],"-", cadena[2],"#". cadena[3])
section
=
cadena
[
0
]
==
"True"
onlycount
=
cadena
[
1
]
==
"True"
#print ("B "+section+"ke "+kernel_end+" ....")
#print (cadena[2].split(";"))
for
init_str
in
cadena
[
3
].
split
(
";"
):
gdb
.
execute
(
init_str
)
gdb
.
execute
(
init_str
)
maxi
=
0.
gdb
.
execute
(
"r"
)
if
(
onlycount
):
ks
=
cadena
[
2
].
split
(
","
)
print
(
ks
)
listreg
=
set
()
for
x
in
ks
:
listreg
.
update
(
BitFlip
.
numreg
(
x
)
)
print
(
listreg
)
maxi
=
len
(
listreg
)
print
(
"Maximo..."
+
str
(
maxi
)
+
" o "
+
str
(
max
([
int
(
x
)
for
x
in
listreg
]
)
))
else
:
if
(
section
):
gdb
.
execute
(
"c"
)
else
:
gdb
.
execute
(
"finish"
)
f
=
open
(
"tmpxxx_return_profiler.conf"
,
"w"
)
f
.
write
(
"[DEFAULT]
\n
Ocurrencias = "
+
str
(
ocurrencias
)
+
"
\n
Tiempo = "
+
str
(
trun
)
+
"
\n
"
)
f
.
close
()
sys
.
exit
(
maxi
)
gdb
.
execute
(
"r"
)
main
(
)
test.sh
View file @
31d82b8c
...
@@ -13,6 +13,8 @@ CONFFILE=codes/lavaMD/lavaMD.conf
...
@@ -13,6 +13,8 @@ CONFFILE=codes/lavaMD/lavaMD.conf
echo
"Step 1 - Profiling the application for fault injection"
echo
"Step 1 - Profiling the application for fault injection"
./app_profiler.py
-c
${
CONFFILE
}
$*
./app_profiler.py
-c
${
CONFFILE
}
$*
echo
"Comienzo.."
>>
tiempos
date
>>
tiempos
echo
"Step 2 - Running
${
FAULTS
}
on
${
CONFFILE
}
"
echo
"Step 2 - Running
${
FAULTS
}
on
${
CONFFILE
}
"
./fault_injector.py
-i
${
FAULTS
}
-c
${
CONFFILE
}
-n
1
$*
./fault_injector.py
-i
${
FAULTS
}
-c
${
CONFFILE
}
-n
1
$*
...
@@ -24,5 +26,6 @@ echo "==============================="
...
@@ -24,5 +26,6 @@ echo "==============================="
done
done
echo
"Fault injection finished"
echo
"Fault injection finished"
date
>>
tiempos
echo
"Fin..."
>>
tiempos
exit
0
exit
0
test_hotspot.sh
View file @
31d82b8c
...
@@ -13,12 +13,21 @@ FAULTS=1000
...
@@ -13,12 +13,21 @@ FAULTS=1000
CONFFILE
=
$DIR_RODINIA
/hotspot/hotspot.conf
CONFFILE
=
$DIR_RODINIA
/hotspot/hotspot.conf
echo
"Step 1 - Profiling the application for fault injection"
echo
"Step 1 - Profiling the application for fault injection"
./app_profiler.py
-c
${
CONFFILE
}
$*
./app_profiler.py
-c
${
CONFFILE
}
$*
date
>>
comienzo
echo
"Comienzo.."
>>
tiempos
date
>>
tiempos
echo
"Step 2 - Running
${
FAULTS
}
on
${
CONFFILE
}
"
echo
"Step 2 - Running
${
FAULTS
}
on
${
CONFFILE
}
"
./fault_injector.py
-i
${
FAULTS
}
-c
${
CONFFILE
}
-n
1
$*
./fault_injector.py
-i
${
FAULTS
}
-c
${
CONFFILE
}
-n
1
$*
while
test
-f
"tmpxxx_num_rounds.conf"
do
cat
tmpxxx_num_rounds.conf
>>
tandas
./fault_injector.py
-i
${
FAULTS
}
-c
${
CONFFILE
}
-n
1
$*
echo
"==============================="
done
date
>>
final
echo
"Fault injection finished"
date
>>
tiempos
echo
"Fault injection finished"
echo
"Fault injection finished"
exit
0
exit
0
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