diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aaa12efb8..eb65a8838 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1020,6 +1020,9 @@ jobs: - name: Run perf count checker run: | python3 scripts/run_perf_counter.py --required-tests-number=2 + env: + OMP_NUM_THREADS: 2 + PROC_COUNT: 2 - name: Run perf tests run: | bash -e scripts/generate_perf_results.sh diff --git a/scripts/create_perf_table.py b/scripts/create_perf_table.py index 627f2a8fb..b59d78621 100644 --- a/scripts/create_perf_table.py +++ b/scripts/create_perf_table.py @@ -2,7 +2,6 @@ import os import re import xlsxwriter -import multiprocessing parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', help='Input file path (logs of perf tests, .txt)', required=True) @@ -50,7 +49,10 @@ worksheet.set_column('A:Z', 23) right_bold_border = workbook.add_format({'bold': True, 'right': 2, 'bottom': 2}) bottom_bold_border = workbook.add_format({'bold': True, 'bottom': 2}) - cpu_num = multiprocessing.cpu_count() + cpu_num = os.environ.get("PROC_COUNT") + if cpu_num is None: + raise EnvironmentError("Required environment variable 'PROC_COUNT' is not set.") + cpu_num = int(cpu_num) worksheet.write(0, 0, "cpu_num = " + str(cpu_num), right_bold_border) it = 1 diff --git a/scripts/run_tests.py b/scripts/run_tests.py index 443eb3db7..a65d2a923 100644 --- a/scripts/run_tests.py +++ b/scripts/run_tests.py @@ -87,11 +87,10 @@ def run_processes(self, additional_mpi_args): def run_performance(self): if not os.environ.get("ASAN_RUN"): - mpi_running = "" - if platform.system() in ("Linux", "Windows"): - mpi_running = f"{self.mpi_exec} -np 4" - elif platform.system() == "Darwin": - mpi_running = f"{self.mpi_exec} -np 2" + proc_count = os.environ.get("PROC_COUNT") + if proc_count is None: + raise EnvironmentError("Required environment variable 'PROC_COUNT' is not set.") + mpi_running = f"{self.mpi_exec} -np {proc_count}" self.__run_exec(f"{mpi_running} {self.work_dir / 'all_perf_tests'} {self.__get_gtest_settings(1)}") self.__run_exec(f"{mpi_running} {self.work_dir / 'mpi_perf_tests'} {self.__get_gtest_settings(1)}")