aboutsummaryrefslogtreecommitdiff
path: root/Tools/performance_tests/functions_perftest.py
diff options
context:
space:
mode:
authorGravatar mthevenet <mthevenet@lbl.gov> 2018-10-16 17:31:08 -0700
committerGravatar mthevenet <mthevenet@lbl.gov> 2018-10-16 17:31:08 -0700
commit06c2474ac88b7bf4e16d6ce7bec5802f9e063c55 (patch)
treee227f35e3db180b2bf6d2469c1aa87c038871c9e /Tools/performance_tests/functions_perftest.py
parent0cfcdf169fa7e915b8225c9f3c6c4060f69f7ea5 (diff)
downloadWarpX-06c2474ac88b7bf4e16d6ce7bec5802f9e063c55.tar.gz
WarpX-06c2474ac88b7bf4e16d6ce7bec5802f9e063c55.tar.zst
WarpX-06c2474ac88b7bf4e16d6ce7bec5802f9e063c55.zip
clean automated test script and add comments
Diffstat (limited to 'Tools/performance_tests/functions_perftest.py')
-rw-r--r--Tools/performance_tests/functions_perftest.py37
1 files changed, 19 insertions, 18 deletions
diff --git a/Tools/performance_tests/functions_perftest.py b/Tools/performance_tests/functions_perftest.py
index 427954ed5..0156cbfd0 100644
--- a/Tools/performance_tests/functions_perftest.py
+++ b/Tools/performance_tests/functions_perftest.py
@@ -3,7 +3,7 @@ import pandas as pd
import numpy as np
import git
-def scale_ncell(ncell, n_node):
+def scale_n_cell(ncell, n_node):
ncell_scaled = ncell[:]
index_dim = 0
while n_node > 1:
@@ -32,16 +32,16 @@ def run_batch_nnode(test_list, res_dir, bin_name, config_command, architecture='
shutil.rmtree(res_dir, ignore_errors=True)
os.makedirs(res_dir)
# Copy files to res_dir
- cwd = os.environ['WARPX'] + '/Tools/performance_tests/'
+ cwd = os.environ['AUTOMATED_PERF_TESTS'] + '/WarpX/Tools/performance_tests/'
bin_dir = cwd + 'Bin/'
shutil.copy(bin_dir + bin_name, res_dir)
os.chdir(res_dir)
# Calculate simulation time. Take 5 min + 2 min / simulation
- job_time_min = 5. + len(test_list)*3.
+ job_time_min = 5. + len(test_list)*5.
job_time_str = str(int(job_time_min/60)) + ':' + str(int(job_time_min%60)) + ':00'
batch_string = ''
batch_string += '#!/bin/bash\n'
- batch_string += '#SBATCH --job-name=' + test_list[0][0] + '\n'
+ batch_string += '#SBATCH --job-name=' + test_list[0].input_file + '\n'
batch_string += '#SBATCH --time=' + job_time_str + '\n'
batch_string += '#SBATCH -C ' + Cname + '\n'
batch_string += '#SBATCH -N ' + str(n_node) + '\n'
@@ -49,27 +49,21 @@ def run_batch_nnode(test_list, res_dir, bin_name, config_command, architecture='
batch_string += '#SBATCH -e error.txt\n'
batch_string += '#SBATCH --account=m2852\n'
- for count, test_item in enumerate(test_list):
- # test_item reads [input_file, int n_mpi, int n_omp]
- input_file = test_item[0];
- shutil.copy(cwd + input_file, res_dir)
- # test_item[1] is not read since it contain the number of node, which is an
- # global parameter. However, we keep it for compatibility with run_alltests.py
- n_mpi = test_item[2]
- n_omp = test_item[3]
+ for count, current_test in enumerate(test_list):
+ shutil.copy(cwd + current_test.input_file, res_dir)
srun_string = ''
- srun_string += 'export OMP_NUM_THREADS=' + str(n_omp) + '\n'
+ srun_string += 'export OMP_NUM_THREADS=' + str(current_test.n_omp) + '\n'
# number of logical cores per MPI process
if architecture == 'cpu':
- cflag_value = max(1, int(32/n_mpi) * 2) # Follow NERSC directives
+ cflag_value = max(1, int(32/current_test.n_mpi_per_node) * 2) # Follow NERSC directives
elif architecture == 'knl':
- cflag_value = max(1, int(64/n_mpi) * 4) # Follow NERSC directives
- output_filename = 'out_' + '_'.join([input_file, str(n_node), str(n_mpi), str(n_omp), str(count)]) + '.txt'
+ cflag_value = max(1, int(64/current_test.n_mpi_per_node) * 4) # Follow NERSC directives
+ output_filename = 'out_' + '_'.join([current_test.input_file, str(n_node), str(current_test.n_mpi_per_node), str(current_test.n_omp), str(count)]) + '.txt'
srun_string += 'srun --cpu_bind=cores '+ \
- ' -n ' + str(n_node*n_mpi) + \
+ ' -n ' + str(n_node*current_test.n_mpi_per_node) + \
' -c ' + str(cflag_value) + \
' ./' + bin_name + \
- ' ' + input_file + \
+ ' ' + current_test.input_file + \
runtime_param_list[ count ] + \
' > ' + output_filename + '\n'
batch_string += srun_string
@@ -195,6 +189,12 @@ def extract_dataframe(filename, n_steps):
search_area = output_text.partition(partition_limit_start)[2]
line_match_looptime = re.search('\nWarpX::Evolve().*', search_area)
time_wo_initialization = float(line_match_looptime.group(0).split()[3])
+ # New, might break something
+ line_match_WritePlotFile = re.search('\nWarpX::WritePlotFile().*', search_area)
+ if line_match_WritePlotFile is not None:
+ time_WritePlotFile = float(line_match_WritePlotFile.group(0).split()[3])
+ else:
+ time_WritePlotFile = 0.
# Get timers for all routines
# Where to start and stop in the output_file
partition_limit_start = 'NCalls Excl. Min Excl. Avg Excl. Max Max %'
@@ -215,6 +215,7 @@ def extract_dataframe(filename, n_steps):
df.loc[0] = time_array
df['time_initialization'] = total_time - time_wo_initialization
df['time_running'] = time_wo_initialization
+ df['time_WritePlotFile'] = time_WritePlotFile
# df['string_output'] = partition_limit_start + '\n' + search_area
return df