import os from benchmarker import Benchmarker os.chdir('../..') config_gen_file_64 = os.path.abspath("./tests/performance/conf_gen_64.ini") config_gen_file_128 = os.path.abspath("./tests/performance/conf_gen_128.ini") config_gen_file_256 = os.path.abspath("./tests/performance/conf_gen_256.ini") config_conn_file_64 = os.path.abspath("./tests/performance/conf_conn_64.ini") config_conn_file_128 = os.path.abspath("./tests/performance/conf_conn_128.ini") config_conn_file_256 = os.path.abspath("./tests/performance/conf_conn_256.ini") GEN_CONFIG_FILES = [config_gen_file_64] CONN_CONFIG_FILES = [config_conn_file_64] index_1 = 0 index_8 = 0 with Benchmarker() as bench: for i in range(len(CONN_CONFIG_FILES)): size = 2**(6+i) @bench(f"Connectivity 1 core with size {size}") def _(bm): global index_1 os.system("CONFIG_FILE_PATH="+ GEN_CONFIG_FILES[index_1] + " mpirun -oversubscribe -np 1 python3 -m memory_profiler mpirunner.py") with bm: os.system("CONFIG_FILE_PATH="+ CONN_CONFIG_FILES[index_1] + " mpirun -oversubscribe -np 1 python3 -m memory_profiler mpirunner.py") ## teardown os.system("rm -rf ./tests/performance/tmp_gen_output") index_1 +=1 @bench(f"Connectivity 8 core with size {size}") def _(bm): global index_8 os.system("CONFIG_FILE_PATH="+ GEN_CONFIG_FILES[index_8] + " mpirun -oversubscribe -np 8 python3 -m memory_profiler mpirunner.py") with bm: os.system("CONFIG_FILE_PATH="+ CONN_CONFIG_FILES[index_8] + " mpirun -oversubscribe -np 8 python3 -m memory_profiler mpirunner.py") ## teardown os.system("rm -rf ./tests/performance/tmp_gen_output") index_8 +=1