Skip to content

Commit 8856207

Browse files
committed
add perf
1 parent 3a259f3 commit 8856207

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed

scripts/generate_perf_results.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
mkdir -p build/perf_stat_dir
2-
source scripts/run_perf_collector.sh | tee build/perf_stat_dir/perf_log.txt
2+
python3 scripts/run_tests.py --running-type="performance" | tee build/perf_stat_dir/perf_log.txt
33
python3 scripts/create_perf_table.py --input build/perf_stat_dir/perf_log.txt --output build/perf_stat_dir

scripts/run_perf_collector.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

scripts/run_tests.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def init_cmd_args():
1010
parser.add_argument(
1111
"--running-type",
1212
required=True,
13-
choices=["threads", "processes"],
13+
choices=["threads", "processes", "performance"],
1414
help="Specify the execution mode. Choose 'threads' for multithreading or 'processes' for multiprocessing."
1515
)
1616
parser.add_argument(
@@ -31,7 +31,8 @@ def __init__(self):
3131
self.ocv_script_name = "setup_vars_opencv4.sh"
3232
self.ocv_script_path = "build/ppc_opencv/install/bin/" + self.ocv_script_name
3333

34-
def __get_project_path(self):
34+
@staticmethod
35+
def __get_project_path():
3536
script_path = Path(__file__).resolve() # Absolute path of the script
3637
script_dir = script_path.parent # Directory containing the script
3738
return script_dir.parent
@@ -105,16 +106,35 @@ def run_processes(self, additional_mpi_args):
105106
self.__run_exec(f"{mpi_running} {self.work_dir / 'all_func_tests'} {self.__get_gtest_settings(10)}")
106107
self.__run_exec(f"{mpi_running} {self.work_dir / 'mpi_func_tests'} {self.__get_gtest_settings(10)}")
107108

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+
108123

109124
if __name__ == "__main__":
110125
args_dict = init_cmd_args()
111126

112127
ppc_runner = PPCRunner()
113128
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+
115133
if args_dict["running_type"] == "threads":
116134
ppc_runner.run_threads()
117135
elif args_dict["running_type"] == "processes":
118136
ppc_runner.run_processes(args_dict["additional_mpi_args"])
137+
elif args_dict["running_type"] == "performance":
138+
ppc_runner.run_performance()
119139
else:
120140
raise Exception("running-type is wrong!")

0 commit comments

Comments
 (0)