@@ -10,7 +10,7 @@ def init_cmd_args():
10
10
parser .add_argument (
11
11
"--running-type" ,
12
12
required = True ,
13
- choices = ["threads" , "processes" ],
13
+ choices = ["threads" , "processes" , "performance" ],
14
14
help = "Specify the execution mode. Choose 'threads' for multithreading or 'processes' for multiprocessing."
15
15
)
16
16
parser .add_argument (
@@ -31,7 +31,8 @@ def __init__(self):
31
31
self .ocv_script_name = "setup_vars_opencv4.sh"
32
32
self .ocv_script_path = "build/ppc_opencv/install/bin/" + self .ocv_script_name
33
33
34
- def __get_project_path (self ):
34
+ @staticmethod
35
+ def __get_project_path ():
35
36
script_path = Path (__file__ ).resolve () # Absolute path of the script
36
37
script_dir = script_path .parent # Directory containing the script
37
38
return script_dir .parent
@@ -105,16 +106,35 @@ def run_processes(self, additional_mpi_args):
105
106
self .__run_exec (f"{ mpi_running } { self .work_dir / 'all_func_tests' } { self .__get_gtest_settings (10 )} " )
106
107
self .__run_exec (f"{ mpi_running } { self .work_dir / 'mpi_func_tests' } { self .__get_gtest_settings (10 )} " )
107
108
109
+ def run_performance (self ):
110
+ if not os .environ .get ("ASAN_RUN" ):
111
+ mpi_running = ""
112
+ if platform .system () == "Linux" :
113
+ mpi_running = "mpirun -np 4"
114
+ elif platform .system () == "Darwin" :
115
+ mpi_running = "mpirun -np 2"
116
+ self .__run_exec (f"{ mpi_running } { self .work_dir / 'all_perf_tests' } { self .__get_gtest_settings (1 )} " )
117
+ self .__run_exec (f"{ mpi_running } { self .work_dir / 'mpi_perf_tests' } { self .__get_gtest_settings (1 )} " )
118
+ self .__run_exec (f"{ self .work_dir / 'omp_perf_tests' } { self .__get_gtest_settings (1 )} " )
119
+ self .__run_exec (f"{ self .work_dir / 'seq_perf_tests' } { self .__get_gtest_settings (1 )} " )
120
+ self .__run_exec (f"{ self .work_dir / 'stl_perf_tests' } { self .__get_gtest_settings (1 )} " )
121
+ self .__run_exec (f"{ self .work_dir / 'tbb_perf_tests' } { self .__get_gtest_settings (1 )} " )
122
+
108
123
109
124
if __name__ == "__main__" :
110
125
args_dict = init_cmd_args ()
111
126
112
127
ppc_runner = PPCRunner ()
113
128
ppc_runner .setup_env ()
114
- ppc_runner .run_core ()
129
+
130
+ if args_dict ["running_type" ] in ["threads" , "processes" ]:
131
+ ppc_runner .run_core ()
132
+
115
133
if args_dict ["running_type" ] == "threads" :
116
134
ppc_runner .run_threads ()
117
135
elif args_dict ["running_type" ] == "processes" :
118
136
ppc_runner .run_processes (args_dict ["additional_mpi_args" ])
137
+ elif args_dict ["running_type" ] == "performance" :
138
+ ppc_runner .run_performance ()
119
139
else :
120
140
raise Exception ("running-type is wrong!" )
0 commit comments