common_parameters.py 4.18 KB
Newer Older
German Leon's avatar
German Leon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Max size of register
SINGLE_MAX_SIZE_REGISTER = 32

# Times to profile
# this will be the max number of executions
# to profiler application
MAX_TIMES_TO_PROFILE = 2

# Log path to store all injections info
LOGS_PATH = 'logs'


# Internal python scripts
FLIP_SCRIPT = 'flip_value.py'
15
PROFILER_SCRIPT = 'profiler.py'
German Leon's avatar
German Leon committed
16
17
18
19
20
21
22
23
24
25
26
27
28


# Debug env vars
# Debug FI process
DEBUG = True
# Debug profiler process
DEBUG_PROFILER = True


# Num of sleep time divisor
NUM_DIVISION_TIMES = 100.0

# Common body of log filename
German Leon's avatar
German Leon committed
29

German Leon's avatar
German Leon committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97


# MAX INT 32 bits
MAX_INT_32 = 4294967295

# Most of the benchmarks we cannot wait until the end of the processing
# Considering most of 90% of the time
MAX_SIGNAL_BEFORE_ENDING = 0.9

# termination, program, alarm, asynchronous, job, operation error, miscellaneous, signal interruption
# 'SIGINT' must not be here, since I used it to send an interruption to app
SIGNALS = ['SIGKILL', 'SIGTERM', 'SIGQUIT', 'SIGHUP',  # termination codes
           'SIGFPE', 'SIGILL', 'SIGSEGV', 'SIGBUS', 'SIGABRT', 'SIGIOT', 'SIGTRAP', 'SIGEMT', 'SIGSYS',  # program codes
           'SIGALRM', 'SIGVTALRM', 'SIGPROF',  # alarm codes
           'SIGIO', 'SIGURG', 'SIGPOLL',  # asynchronous codes
           'SIGCHLD', 'SIGCLD', 'SIGCONT', 'SIGSTOP', 'SIGTSTP', 'SIGTTIN', 'SIGTTOU',  # job control
           'SIGPIPE', 'SIGLOST', 'SIGXCPU', 'SIGXFSZ',  # operation codes
           'SIGUSR1', 'SIGUSR2', 'SIGWINCH', 'SIGINFO',  # miscellaneous codes
           'strsignal', 'psignal',  # signal messages
           # cuda signals
           'CUDA_EXCEPTION_0', 'CUDA_EXCEPTION_1', 'CUDA_EXCEPTION_2', 'CUDA_EXCEPTION_3', 'CUDA_EXCEPTION_4',
           'CUDA_EXCEPTION_5',
           'CUDA_EXCEPTION_6', 'CUDA_EXCEPTION_7', 'CUDA_EXCEPTION_8', 'CUDA_EXCEPTION_9', 'CUDA_EXCEPTION_10',
           'CUDA_EXCEPTION_11',
           'CUDA_EXCEPTION_12', 'CUDA_EXCEPTION_13', 'CUDA_EXCEPTION_14', 'CUDA_EXCEPTION_15']

# All trash produced by GDB must be add here in this list
# Using the Regular Expression format (python re)

POSSIBLE_USELESS_GDB_OUTPUT_PATTERNS = [
        r'.*Thread.*received signal SIGINT, Interrupt.*',  # Thread SIGINT message
        r'.*New Thread.*',  # New GDB Thread creation
        r'.*Thread debugging using.*enabled.*',  # Lib thread enabled
        r'.*Using host.*library.*',  # Using host library
        r'.*Switching focus to CUDA kernel.*',  # Switching focus to CUDA kernel message
        r'.*0x.*in.*<<<.*>>>.*',  # Kernel interruption message
        r'.*Inferior.*\(process.*\) exited normally.*',  # GDB exited normally message
        r'.*Thread 0x.*exited.*',  # Thread exited
        r'.*0x.* in cu.* () from /usr/lib/.*libcuda.*',  # Cuda lib calls
        r'.*0x.*in.*\[clone.*\].*\(\).*',  # OMP calls
        r'.*0x.*in.*',  # General API call
        r'.*Inferior.*\(process.*\).*',  # General inferior process
    ]


# Injection sites
RF = 0
INST_OUT = 1
INST_ADD = 2

INJECTION_SITES = {
    'RF': RF,
    'INST_OUT': INST_OUT,
    'INST_ADD': INST_ADD
}

# Which fault model to use, 0 -> single; 1 -> double;
# 2 -> random; 3 -> zeros; 4 -> least 16 significant bits (LSB);
# 5 -> least 8 significant bits (LSB)
FLIP_SINGLE_BIT = 0
FLIP_TWO_BITS = 1
RANDOM_VALUE = 2
ZERO_VALUE = 3
LEAST_16_BITS = 4
LEAST_8_BITS = 5

# Focus error string
FOCUS_ERROR_STRING = "Focus not set on any active CUDA kernel."
German Leon's avatar
German Leon committed
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

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'