From bea64b75da3a2b7a832b3fc7ec88560af5fb50d5 Mon Sep 17 00:00:00 2001 From: chortas Date: Sun, 28 Nov 2021 12:40:26 -0300 Subject: [PATCH] Add connectivity perf test --- Makefile | 3 +- tests/performance/conf_conn_128.ini | 44 +++++++++++++++++++++++++ tests/performance/conf_conn_256.ini | 44 +++++++++++++++++++++++++ tests/performance/conf_conn_512.ini | 44 +++++++++++++++++++++++++ tests/performance/conf_conn_64.ini | 44 +++++++++++++++++++++++++ tests/performance/connectivity.py | 51 +++++++++++++++++++++++++++++ 6 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 tests/performance/conf_conn_128.ini create mode 100644 tests/performance/conf_conn_256.ini create mode 100644 tests/performance/conf_conn_512.ini create mode 100644 tests/performance/conf_conn_64.ini create mode 100644 tests/performance/connectivity.py diff --git a/Makefile b/Makefile index 4dbc27f..bf17567 100644 --- a/Makefile +++ b/Makefile @@ -15,4 +15,5 @@ test: binaries cd tests/integration && python3 -m unittest test.py perf: binaries - cd tests/performance && python3 generation.py \ No newline at end of file + cd tests/performance && python3 generation.py + cd tests/performance && python3 connectivity.py \ No newline at end of file diff --git a/tests/performance/conf_conn_128.ini b/tests/performance/conf_conn_128.ini new file mode 100644 index 0000000..f1a4233 --- /dev/null +++ b/tests/performance/conf_conn_128.ini @@ -0,0 +1,44 @@ +[General] +simDir=tests/performance/tmp_gen_output +startJob=0 +[Iterables] +p=[10,39,15] +seeds=[5462,2] +lc=[4] +connectivity=[1,2,3] +variances=[1] + +[Generation] +Nx = 128 +Ny = 128 +Nz = 128 +variogram_type=1 +binary = no +kh = 100 +kl = 0.01 +compute_lc = no +lcBin=no +genera=no + + +[Connectivity] +keep_aspect=yes +block_size = 4 +indicators_MinBlockSize =4 +Max_sample_size = 12 +compGconec= 1 +conec=yes + + +[Solver] +num_of_cores = 1 +ref = 2 +solve = no +rtol = 1e-4 + +[K-Postprocess] +MinBlockSize =1 +Max_sample_size = 4 +kperm=no +postprocess=no +SaveVfield=no \ No newline at end of file diff --git a/tests/performance/conf_conn_256.ini b/tests/performance/conf_conn_256.ini new file mode 100644 index 0000000..f1a4233 --- /dev/null +++ b/tests/performance/conf_conn_256.ini @@ -0,0 +1,44 @@ +[General] +simDir=tests/performance/tmp_gen_output +startJob=0 +[Iterables] +p=[10,39,15] +seeds=[5462,2] +lc=[4] +connectivity=[1,2,3] +variances=[1] + +[Generation] +Nx = 128 +Ny = 128 +Nz = 128 +variogram_type=1 +binary = no +kh = 100 +kl = 0.01 +compute_lc = no +lcBin=no +genera=no + + +[Connectivity] +keep_aspect=yes +block_size = 4 +indicators_MinBlockSize =4 +Max_sample_size = 12 +compGconec= 1 +conec=yes + + +[Solver] +num_of_cores = 1 +ref = 2 +solve = no +rtol = 1e-4 + +[K-Postprocess] +MinBlockSize =1 +Max_sample_size = 4 +kperm=no +postprocess=no +SaveVfield=no \ No newline at end of file diff --git a/tests/performance/conf_conn_512.ini b/tests/performance/conf_conn_512.ini new file mode 100644 index 0000000..ba15232 --- /dev/null +++ b/tests/performance/conf_conn_512.ini @@ -0,0 +1,44 @@ +[General] +simDir=tests/performance/tmp_gen_output +startJob=0 +[Iterables] +p=[10,39,15] +seeds=[5462,2] +lc=[4] +connectivity=[1,2,3] +variances=[1] + +[Generation] +Nx = 512 +Ny = 512 +Nz = 512 +variogram_type=1 +binary = no +kh = 100 +kl = 0.01 +compute_lc = no +lcBin=no +genera=no + + +[Connectivity] +keep_aspect= yes +block_size = 4 +indicators_MinBlockSize =4 +Max_sample_size = 12 +compGconec= 1 +conec=yes + + +[Solver] +num_of_cores = 1 +ref = 2 +solve = no +rtol = 1e-4 + +[K-Postprocess] +MinBlockSize =1 +Max_sample_size = 4 +kperm=no +postprocess=no +SaveVfield=no \ No newline at end of file diff --git a/tests/performance/conf_conn_64.ini b/tests/performance/conf_conn_64.ini new file mode 100644 index 0000000..23fea9c --- /dev/null +++ b/tests/performance/conf_conn_64.ini @@ -0,0 +1,44 @@ +[General] +simDir=tests/performance/tmp_gen_output +startJob=0 +[Iterables] +p=[10,39,15] +seeds=[5462,2] +lc=[4] +connectivity=[1,2,3] +variances=[1] + +[Generation] +Nx = 64 +Ny = 64 +Nz = 64 +variogram_type=1 +binary = no +kh = 100 +kl = 0.01 +compute_lc = no +lcBin=no +genera=no + + +[Connectivity] +keep_aspect= yes +block_size = 4 +indicators_MinBlockSize =4 +Max_sample_size = 12 +compGconec= 1 +conec=yes + + +[Solver] +num_of_cores = 1 +ref = 2 +solve = no +rtol = 1e-4 + +[K-Postprocess] +MinBlockSize =1 +Max_sample_size = 4 +kperm=no +postprocess=no +SaveVfield=no \ No newline at end of file diff --git a/tests/performance/connectivity.py b/tests/performance/connectivity.py new file mode 100644 index 0000000..a7245a6 --- /dev/null +++ b/tests/performance/connectivity.py @@ -0,0 +1,51 @@ +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 + print(f"Running generation for {GEN_CONFIG_FILES[index_1]}") + os.system("CONFIG_FILE_PATH="+ GEN_CONFIG_FILES[index_1] + " mpirun -oversubscribe -np 1 python3 mpirunner.py") + print(f"End of generation for {GEN_CONFIG_FILES[index_1]}") + with bm: + os.system("CONFIG_FILE_PATH="+ CONN_CONFIG_FILES[index_1] + " mpirun -oversubscribe -np 1 python3 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 + print(f"Running generation for {GEN_CONFIG_FILES[index_8]}") + os.system("CONFIG_FILE_PATH="+ GEN_CONFIG_FILES[index_8] + " mpirun -oversubscribe -np 8 python3 mpirunner.py") + print(f"End of generation for {GEN_CONFIG_FILES[index_8]}") + with bm: + os.system("CONFIG_FILE_PATH="+ CONN_CONFIG_FILES[index_8] + " mpirun -oversubscribe -np 8 python3 mpirunner.py") + + ## teardown + os.system("rm -rf ./tests/performance/tmp_gen_output") + index_8 +=1 +