From 021fec40b4d7d863f3001ae6dd79067589b8d755 Mon Sep 17 00:00:00 2001 From: mthevenet Date: Wed, 31 Jan 2018 08:16:05 -0800 Subject: Set of automated performance tests, meant to run every week or so --- Tools/performance_tests/run_alltests_1node.py | 273 ++++++++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 Tools/performance_tests/run_alltests_1node.py (limited to 'Tools/performance_tests/run_alltests_1node.py') diff --git a/Tools/performance_tests/run_alltests_1node.py b/Tools/performance_tests/run_alltests_1node.py new file mode 100644 index 000000000..55635a9dc --- /dev/null +++ b/Tools/performance_tests/run_alltests_1node.py @@ -0,0 +1,273 @@ +import os, sys, shutil +import argparse, re, time +from functions_perftest import * + +# This script runs automated performance tests for WarpX. +# It runs tests in list test_list defined below, and write +# results in file performance_log.txt in warpx/performance_tests/ + +# ---- User's manual ---- +# Before running performance tests, make sure you have the latest version +# of performance_log.txt +# A typical execution reads: +# python run_alltests_1node.py --no-recompile --compiler=intel --architecture=knl --mode=run --input_file=uniform_plasma --n_node=1 --log_file='my_performance_log.txt' +# These are default values, and will give the same result as +# > python run_alltests.py +# To add a new test item, extent the test_list with a line like +# test_list.extend([['my_input_file', n_node, n_mpi, n_omp]]*3) +# - my_input_file must be in warpx/performance_tests +# - the test will run 3 times, to have some statistics +# - the test must take <1h or it will timeout + +# ---- Developer's manual ---- +# This script can run in two modes: +# - 'run' mode: for each test item, a batch job is executed. +# create folder '$SCRATCH/performance_warpx/' +# recompile the code if option --recompile is used +# loop over test_list and submit one batch script per item +# Submit a batch job that executes the script in read mode +# This last job runs once all others are completed +# - 'read' mode: Get performance data from all test items +# create performance log file if does not exist +# loop over test_file +# read initialization time and step time +# write data into the performance log file +# push file performance_log.txt on the repo + +# Read command-line arguments +# --------------------------- +# Create parser and read arguments +parser = argparse.ArgumentParser( + description='Run performance tests and write results in files') +parser.add_argument('--recompile', dest='recompile', action='store_true', default=False) +parser.add_argument('--no-recompile', dest='recompile', action='store_false', default=False) +parser.add_argument('--commit', dest='commit', action='store_true', default=False) +parser.add_argument( '--compiler', choices=['gnu', 'intel'], default='intel', + help='which compiler to use') +parser.add_argument( '--architecture', choices=['cpu', 'knl'], default='knl', + help='which architecture to cross-compile for NERSC machines') +parser.add_argument( '--mode', choices=['run', 'read'], default='run', + help='whether to run perftests or read their perf output. run calls read') +parser.add_argument( '--log_file', dest = 'log_file', default='my_performance_log.txt', + help='name of log file where data will be written. ignored if option --commit is used') +parser.add_argument('--n_node', dest='n_node', default=1, help='nomber of nodes for the runs') +parser.add_argument('--input_file', dest='input_file', default='input_file.pixr', + type=str, help='input file to run') +parser.add_argument('--automated', dest='automated', action='store_true', default=False, + help='Use to run the automated test list') + +args = parser.parse_args() +log_file = args.log_file +do_commit = args.commit +run_name = args.input_file + +# list of tests to run and analyse. +# Note: This is overwritten if is_automated +# each element of test_list contains +# [str input_file, int n_node, int n_mpi PER NODE, int n_omp] +test_list = [] +n_repeat = 2 +filename1 = args.input_file +test_list.extend([[filename1, 1, 128, 1]]*n_repeat) +test_list.extend([[filename1, 1, 64, 2]]*n_repeat) +# test_list.extend([[filename1, 1, 32, 4]]*n_repeat) +# test_list.extend([[filename1, 1, 16, 8]]*n_repeat) +# test_list.extend([[filename1, 1, 8, 16]]*n_repeat) +# test_list.extend([[filename1, 1, 4, 32]]*n_repeat) +# test_list.extend([[filename1, 1, 2, 64]]*n_repeat) +# test_list.extend([[filename1, 1, 1, 128]]*n_repeat) + +# Nothing should be changed after this line +# if flag --automated is used, test_list and do_commit are +# overwritten + +if args.automated == True: + test_list = [] + n_repeat = 4 + test_list.extend([['automated_test_1_uniform_rest_32ppc', 1, 16, 8]]*n_repeat) + test_list.extend([['automated_test_2_uniform_rest_1ppc', 1, 16, 8]]*n_repeat) + test_list.extend([['automated_test_2_uniform_rest_1ppc', 1, 16, 8]]*n_repeat) + test_list.extend([['automated_test_3_uniform_drift_4ppc', 1, 16, 8]]*n_repeat) + test_list.extend([['automated_test_4_labdiags_2ppc', 1, 16, 8]]*n_repeat) + test_list.extend([['automated_test_5_loadimbalance', 1, 16, 8]]*n_repeat) + test_list.extend([['automated_test_6_output_2ppc', 1, 16, 8]]*n_repeat) + do_commit = True + run_name = 'automated_tests' + +n_tests = len(test_list) +if do_commit == True: + log_file = 'performance_log.txt' + +# Dictionaries +# compiler names. Used for WarpX executable name +compiler_name = {'intel': 'intel', 'gnu': 'gcc'} +# architecture. Used for WarpX executable name +module_name = {'cpu': 'haswell', 'knl': 'mic-knl'} +# architecture. Used in batch scripts +module_Cname = {'cpu': 'haswell', 'knl': 'knl,quad,cache'} +# Define environment variables +cwd = os.getcwd() + '/' +res_dir_base = os.environ['SCRATCH'] + '/performance_warpx/' +bin_dir = cwd + 'Bin/' +bin_name = 'perf_tests3d.' + args.compiler + '.' + module_name[args.architecture] + '.TPROF.MPI.OMP.ex' +log_dir = cwd + +day = time.strftime('%d') +month = time.strftime('%m') +year = time.strftime('%Y') +n_node = int(args.n_node) + +# Initialize tests +# ---------------- +if args.mode == 'run': +# Set default options for compilation and execution + config_command = '' + config_command += 'module unload darshan;' + config_command += 'module load craype-hugepages4M;' + if args.architecture == 'knl': + if args.compiler == 'intel': + config_command += 'module unload PrgEnv-gnu;' + config_command += 'module load PrgEnv-intel;' + elif args.compiler == 'gnu': + config_command += 'module unload PrgEnv-intel;' + config_command += 'module load PrgEnv-gnu;' + config_command += 'module unload craype-haswell;' + config_command += 'module load craype-mic-knl;' + elif args.architecture == 'cpu': + if args.compiler == 'intel': + config_command += 'module unload PrgEnv-gnu;' + config_command += 'module load PrgEnv-intel;' + elif args.compiler == 'gnu': + config_command += 'module unload PrgEnv-intel;' + config_command += 'module load PrgEnv-gnu;' + config_command += 'module unload craype-mic-knl;' + config_command += 'module load craype-haswell;' + # Create main result directory if does not exist + if not os.path.exists(res_dir_base): + os.mkdir(res_dir_base) + +# Recompile if requested +if args.recompile == True: + with open(cwd + 'GNUmakefile_perftest') as makefile_handler: + makefile_text = makefile_handler.read() + makefile_text = re.sub('\nCOMP.*', '\nCOMP=%s' %compiler_name[args.compiler], makefile_text) + with open(cwd + 'GNUmakefile_perftest', 'w') as makefile_handler: + makefile_handler.write( makefile_text ) + os.system(config_command + " make -f GNUmakefile_perftest realclean ; " + " rm -r tmp_build_dir *.mod; make -j 8 -f GNUmakefile_perftest") + +# This function runs a batch script with dependencies to perform the analysis +# when performance runs are done. +def process_analysis(): + dependencies = '' + f_log = open(cwd + 'log_jobids_tmp.txt','r') + line = f_log.readline() + print(line) + dependencies += line.split()[3] + ':' + batch_string = '' + batch_string += '#!/bin/bash\n' + batch_string += '#SBATCH --job-name=warpx_1node_read\n' + batch_string += '#SBATCH --time=00:05:00\n' + batch_string += '#SBATCH -C haswell\n' + batch_string += '#SBATCH -N 1\n' + batch_string += '#SBATCH -S 4\n' + batch_string += '#SBATCH -q regular\n' + batch_string += '#SBATCH -e read_error.txt\n' + batch_string += '#SBATCH -o read_output.txt\n' + batch_string += '#SBATCH --mail-type=end\n' + batch_string += '#SBATCH --account=m2852\n' + batch_string += 'python ' + __file__ + ' --no-recompile --compiler=' + \ + args.compiler + ' --architecture=' + args.architecture + \ + ' --mode=read' + ' --log_file=' + log_file + \ + ' --input_file=' + args.input_file + if do_commit == True: + batch_string += ' --commit' + if args.automated == True: + batch_string += ' --automated' + batch_string += '\n' + batch_file = 'slurm_perfread' + f_exe = open(batch_file,'w') + f_exe.write(batch_string) + f_exe.close() + os.system('chmod 700 ' + batch_file) + os.system('sbatch --dependency afterok:' + dependencies[0:-1] + ' ' + batch_file) + return 0 + +# Loop over the tests and return run time + details +# ------------------------------------------------- +if args.mode == 'run': + # Remove file log_jobids_tmp.txt if exists. + # This file contains the jobid of every perf test + # It is used to manage the analysis script dependencies + if os.path.isfile(cwd + 'log_jobids_tmp.txt'): + os.remove(cwd + 'log_jobids_tmp.txt') + res_dir = res_dir_base + res_dir += '_'.join([run_name, args.compiler,\ + args.architecture, str(n_node)]) + '/' + # Run the simulation. + run_batch_nnode(test_list, res_dir, bin_name, config_command,\ + architecture=args.architecture, Cname=module_Cname[args.architecture], \ + n_node=n_node) + os.chdir(cwd) + process_analysis() + +if args.mode == 'read': + # Create log_file for performance tests if does not exist + if not os.path.isfile(log_dir + log_file): + log_line = '## year month day input_file compiler architecture n_node n_mpi ' +\ + 'n_omp time_initialization time_one_iteration Redistribute '+\ + 'FillBoundary ParallelCopy CurrentDeposition FieldGather '+\ + 'ParthiclePush Copy EvolveEM Checkpoint '+\ + 'WriteParticles Write_FabArray '+\ + 'WriteMultiLevelPlotfile(unit: second) '+\ + 'RedistributeMPI\n' + f_log = open(log_dir + log_file, 'a') + f_log.write(log_line) + f_log.close() + for count, current_run in enumerate(test_list): + # Results folder + print('read ' + str(current_run)) + input_file = current_run[0] + # Do not read n_node = current_run[1], it is an external parameter + n_mpi = current_run[2] + n_omp = current_run[3] + n_steps = get_nsteps(cwd + input_file) + print('n_steps = ' + str(n_steps)) + res_dir = res_dir_base + res_dir += '_'.join([run_name, args.compiler,\ + args.architecture, str(n_node)]) + '/' + # Read performance data from the output file + output_filename = 'out_' + '_'.join([input_file, str(n_node), str(n_mpi), str(n_omp), str(count)]) + '.txt' + timing_list = read_run_perf(res_dir + output_filename, n_steps) + # Write performance data to the performance log file + log_line = ' '.join([year, month, day, input_file, args.compiler,\ + args.architecture, str(n_node), str(n_mpi),\ + str(n_omp)] + timing_list + ['\n']) + write_perf_logfile(log_dir + log_file, log_line) + + # Store test parameters fot record + dir_record_base = './perf_warpx_record/' + if not os.path.exists(dir_record_base): + os.mkdir(dir_record_base) + count = 0 + dir_record = dir_record_base + '_'.join([year, month, day]) + '_0' + while os.path.exists(dir_record): + count += 1 + dir_record = dir_record[:-1] + str(count) + os.mkdir(dir_record) + shutil.copy(__file__, dir_record) + shutil.copy(log_dir + log_file, dir_record) + for count, current_run in enumerate(test_list): + shutil.copy(current_run[0], dir_record) + + # Rename directory with precise date for archive purpose + res_dir_arch = res_dir_base + res_dir_arch += '_'.join([year, month, day, run_name, args.compiler,\ + args.architecture, str(n_node)]) + '/' + os.rename(res_dir, res_dir_arch) + + # Commit results to the Repo + if do_commit == True: + os.system('git add ' + log_dir + log_file + ';'\ + 'git commit -m "performance tests";'\ + 'git push -u origin master') + -- cgit v1.2.3 From c15d75e1a55a83d4ecb37ecabaa82a6a2783969b Mon Sep 17 00:00:00 2001 From: mthevenet Date: Thu, 1 Feb 2018 13:18:43 -0800 Subject: Final version for automated performance tests. Last thing to do: run them every week. --- .../performance_tests/automated_test_6_output_2ppc | 6 +- Tools/performance_tests/functions_perftest.py | 5 +- Tools/performance_tests/performance_log.txt | 48 ------------- Tools/performance_tests/run_alltests_1node.py | 84 ++++++++++++++++++---- 4 files changed, 79 insertions(+), 64 deletions(-) (limited to 'Tools/performance_tests/run_alltests_1node.py') diff --git a/Tools/performance_tests/automated_test_6_output_2ppc b/Tools/performance_tests/automated_test_6_output_2ppc index 0696c8bb1..a1c4172fe 100644 --- a/Tools/performance_tests/automated_test_6_output_2ppc +++ b/Tools/performance_tests/automated_test_6_output_2ppc @@ -1,10 +1,10 @@ # Maximum number of time steps -max_step = 100 +max_step = 10 # number of grid points -amr.n_cell = 256 256 256 +amr.n_cell = 128 128 128 -amr.plot_int = 5 # How often to write plotfiles. +amr.plot_int = 2 # How often to write plotfiles. # Maximum allowable size of each subdomain in the problem domain; # this is used to decompose the domain for parallel calculations. diff --git a/Tools/performance_tests/functions_perftest.py b/Tools/performance_tests/functions_perftest.py index b12f7d0b9..f60da15f0 100644 --- a/Tools/performance_tests/functions_perftest.py +++ b/Tools/performance_tests/functions_perftest.py @@ -20,6 +20,7 @@ def run_batch_nnode(test_list, res_dir, bin_name, config_command, architecture=' batch_string += '#SBATCH -C ' + Cname + '\n' batch_string += '#SBATCH -N ' + str(n_node) + '\n' batch_string += '#SBATCH -q regular\n' + batch_string += '#SBATCH --mail-type=end\n' batch_string += '#SBATCH -e error.txt\n' batch_string += '#SBATCH --account=m2852\n' @@ -46,7 +47,9 @@ def run_batch_nnode(test_list, res_dir, bin_name, config_command, architecture=' ' ' + input_file + \ ' > ' + output_filename + '\n' batch_string += srun_string - batch_string += 'rm -r plt* chk* lab_frame_data' + batch_string += 'rm -rf plt*\n' + batch_string += 'rm -rf chk*\n' + batch_string += 'rm -rf lab_frame_data\n' batch_file = 'slurm' f_exe = open(batch_file,'w') f_exe.write(batch_string) diff --git a/Tools/performance_tests/performance_log.txt b/Tools/performance_tests/performance_log.txt index 330de7756..543d257a0 100644 --- a/Tools/performance_tests/performance_log.txt +++ b/Tools/performance_tests/performance_log.txt @@ -1,52 +1,4 @@ ## year month day run_name compiler architecture n_node n_mpi n_omp time_initialization time_one_iteration Redistribute FillBoundary ParallelCopy CurrentDeposition FieldGather ParthiclePush Copy EvolveEM Checkpoint WriteParticles Write_FabArray WriteMultiLevelPlotfile(unit: second) RedistributeMPI -2018 01 31 automated_test_1_uniform_rest_32ppc intel knl 1 16 8 2.89 0.3941 0.1708 0.01722 0.01598 0.06932 0.03612 0.01871 0.01916 0.003316 0 0 0 0 0.006788 -2018 01 31 automated_test_1_uniform_rest_32ppc intel knl 1 16 8 2.88 0.3956 0.1706 0.01787 0.01806 0.06907 0.03605 0.01869 0.01909 0.003086 0 0 0 0 0.006877 -2018 01 31 automated_test_1_uniform_rest_32ppc intel knl 1 16 8 3.15 0.3979 0.1708 0.01795 0.0188 0.0695 0.03616 0.01869 0.01916 0.003206 0 0 0 0 0.007259 -2018 01 31 automated_test_1_uniform_rest_32ppc intel knl 1 16 8 3.32 0.3996 0.1711 0.01796 0.01894 0.06977 0.03665 0.01881 0.01919 0.003161 0 0 0 0 0.00756 -2018 01 31 automated_test_2_uniform_rest_1ppc intel knl 1 16 8 0.88 0.4752 0.04437 0.1133 0.0906 0.1073 0.01252 0.003654 0.004123 0.01252 0 0 0 0 0.002832 -2018 01 31 automated_test_2_uniform_rest_1ppc intel knl 1 16 8 0.97 0.4777 0.04432 0.1148 0.0903 0.1073 0.01278 0.003706 0.00415 0.01251 0 0 0 0 0.003051 -2018 01 31 automated_test_2_uniform_rest_1ppc intel knl 1 16 8 1.22 0.4828 0.04471 0.117 0.09294 0.1075 0.01277 0.003697 0.004156 0.01261 0 0 0 0 0.002947 -2018 01 31 automated_test_2_uniform_rest_1ppc intel knl 1 16 8 1.18 0.4717 0.0445 0.1109 0.08908 0.1072 0.01262 0.003681 0.004161 0.01253 0 0 0 0 0.003035 -2018 01 31 automated_test_3_uniform_drift_4ppc intel knl 1 16 8 0.68 0.1279 0.0308 0.01708 0.01739 0.02001 0.005004 0.003534 0.002822 0.003061 0 0 0 0 0.007921 -2018 01 31 automated_test_3_uniform_drift_4ppc intel knl 1 16 8 0.78 0.1272 0.03082 0.01688 0.01721 0.0199 0.004966 0.003509 0.002834 0.003165 0 0 0 0 0.007421 -2018 01 31 automated_test_3_uniform_drift_4ppc intel knl 1 16 8 0.65 0.1288 0.03081 0.01707 0.0174 0.02037 0.005359 0.003607 0.002865 0.003093 0 0 0 0 0.007584 -2018 01 31 automated_test_3_uniform_drift_4ppc intel knl 1 16 8 0.47 0.1285 0.03057 0.01704 0.01737 0.01986 0.004963 0.003541 0.002774 0.00298 0 0 0 0 0.009253 -2018 01 31 automated_test_4_labdiags_2ppc intel knl 1 16 8 1.19 0.3035 0.03852 0.06449 0.07505 0.003524 0.003004 0.0001529 0.0001788 0.008249 0 0 0 0.0005316 0.03852 -2018 01 31 automated_test_4_labdiags_2ppc intel knl 1 16 8 1.93 0.2903 0.03855 0.0644 0.07497 0.003491 0.003002 0.0001525 0.0001778 0.008146 0 0 0 0.001185 0.03855 -2018 01 31 automated_test_4_labdiags_2ppc intel knl 1 16 8 1.46 0.2926 0.03901 0.06493 0.07521 0.003504 0.003029 0.0001543 0.0001773 0.008053 0 0 0 0.0005591 0.03901 -2018 01 31 automated_test_4_labdiags_2ppc intel knl 1 16 8 1.52 0.2942 0.03873 0.06463 0.07506 0.003474 0.003009 0.0001519 0.0001748 0.008223 0 0 0 0.000749 0.03873 -2018 01 31 automated_test_5_loadimbalance intel knl 1 16 8 9.1 0.379 0.08335 0.1011 0.1317 0 0 0 0 0.01243 0 0 0 0 0.08335 -2018 01 31 automated_test_5_loadimbalance intel knl 1 16 8 8.71 0.4016 0.08558 0.1132 0.1394 0 0 0 0 0.0123 0 0 0 0 0.08558 -2018 01 31 automated_test_5_loadimbalance intel knl 1 16 8 8.72 0.4026 0.08542 0.1145 0.1394 0 0 0 0 0.0122 0 0 0 0 0.08542 -2018 01 31 automated_test_5_loadimbalance intel knl 1 16 8 9.45 0.4045 0.08679 0.1139 0.1398 0 0 0 0 0.01235 0 0 0 0 0.08679 -2018 01 31 automated_test_6_output_2ppc intel knl 1 16 8 3.7 1.083 0.09037 0.1341 0.09628 0.1359 0.02727 0.009255 0.01001 0.02158 0 0 0 0.005835 0.005577 -2018 01 31 automated_test_6_output_2ppc intel knl 1 16 8 4.1 1.158 0.09151 0.1383 0.09691 0.1385 0.02939 0.009634 0.01047 0.02449 0 0 0 0.03136 0.008183 -2018 01 31 automated_test_6_output_2ppc intel knl 1 16 8 4.6 1.125 0.09089 0.1447 0.1015 0.136 0.02796 0.009181 0.009982 0.02134 0 0 0 0.03513 0.00643 -2018 01 31 automated_test_6_output_2ppc intel knl 1 16 8 4.3 2.161 0.09089 0.139 0.09462 0.1397 0.02942 0.009833 0.01048 0.02534 0 0 0 0.002898 0.007857 -2018 01 31 automated_test_1_uniform_rest_32ppc intel knl 1 16 8 3.14 0.3986 0.1713 0.01719 0.01615 0.06987 0.03636 0.01901 0.01999 0.003602 0 0 0 0 0.007262 -2018 01 31 automated_test_1_uniform_rest_32ppc intel knl 1 16 8 3.39 0.4009 0.1712 0.01676 0.01583 0.07061 0.03684 0.01926 0.02011 0.003687 0 0 0 0 0.007841 -2018 01 31 automated_test_1_uniform_rest_32ppc intel knl 1 16 8 2.91 0.4024 0.1716 0.01826 0.01918 0.0703 0.0363 0.01912 0.01989 0.003017 0 0 0 0 0.007256 -2018 01 31 automated_test_1_uniform_rest_32ppc intel knl 1 16 8 3.21 0.3997 0.1717 0.01706 0.0162 0.07026 0.03655 0.01928 0.01999 0.003687 0 0 0 0 0.006799 -2018 01 31 automated_test_2_uniform_rest_1ppc intel knl 1 16 8 0.89 0.4779 0.04441 0.1143 0.09117 0.1072 0.01254 0.003702 0.004217 0.01247 0 0 0 0 0.003441 -2018 01 31 automated_test_2_uniform_rest_1ppc intel knl 1 16 8 1.33 0.4813 0.04476 0.1143 0.09043 0.108 0.01365 0.003931 0.00426 0.01378 0 0 0 0 0.002913 -2018 01 31 automated_test_2_uniform_rest_1ppc intel knl 1 16 8 1.26 0.5096 0.04494 0.133 0.1033 0.1074 0.01247 0.003781 0.004333 0.0128 0 0 0 0 0.002968 -2018 01 31 automated_test_2_uniform_rest_1ppc intel knl 1 16 8 1.32 0.4645 0.04441 0.1053 0.08565 0.1079 0.01307 0.003789 0.004237 0.01269 0 0 0 0 0.002675 -2018 01 31 automated_test_3_uniform_drift_4ppc intel knl 1 16 8 0.72 0.1223 0.0309 0.01493 0.01332 0.02019 0.005077 0.003806 0.002812 0.003526 0 0 0 0 0.007072 -2018 01 31 automated_test_3_uniform_drift_4ppc intel knl 1 16 8 0.5 0.1241 0.03063 0.0153 0.01366 0.02064 0.005438 0.003966 0.002745 0.003411 0 0 0 0 0.007488 -2018 01 31 automated_test_3_uniform_drift_4ppc intel knl 1 16 8 0.6 0.1257 0.0306 0.01596 0.01432 0.02056 0.005598 0.004134 0.002743 0.003329 0 0 0 0 0.00732 -2018 01 31 automated_test_3_uniform_drift_4ppc intel knl 1 16 8 0.53 0.128 0.03062 0.01695 0.0174 0.02008 0.005402 0.003621 0.002808 0.00296 0 0 0 0 0.007562 -2018 01 31 automated_test_4_labdiags_2ppc intel knl 1 16 8 1.06 0.2996 0.03996 0.06474 0.07516 0.003495 0.002986 0.0001529 0.0001777 0.008056 0.03764 0.001542 0 0.006604 0.03996 -2018 01 31 automated_test_4_labdiags_2ppc intel knl 1 16 8 1.27 0.2921 0.03979 0.06439 0.07494 0.003489 0.003004 0.0001512 0.0001767 0.0083 0.03747 0.001567 0 0.0005017 0.03979 -2018 01 31 automated_test_4_labdiags_2ppc intel knl 1 16 8 1.38 0.2845 0.03763 0.0628 0.07183 0.003505 0.002981 0.0001538 0.0001797 0.008738 0.03636 0.001559 0 0.0003998 0.03763 -2018 01 31 automated_test_4_labdiags_2ppc intel knl 1 16 8 0.91 0.2897 0.03867 0.0644 0.07499 0.003516 0.002995 0.0001527 0.00018 0.008797 0.03593 0.001542 0 0.0004542 0.03867 -2018 01 31 automated_test_5_loadimbalance intel knl 1 16 8 9.39 0.404 0.08675 0.1135 0.1394 0 0 0 0 0.01241 0 0 0 0 0.08675 -2018 01 31 automated_test_5_loadimbalance intel knl 1 16 8 9.15 0.3993 0.08439 0.1125 0.1387 0 0 0 0 0.01188 0 0 0 0 0.08439 -2018 01 31 automated_test_5_loadimbalance intel knl 1 16 8 9.13 0.3998 0.08468 0.1116 0.1382 0 0 0 0 0.01239 0 0 0 0 0.08468 -2018 01 31 automated_test_5_loadimbalance intel knl 1 16 8 9.28 0.405 0.08601 0.1142 0.14 0 0 0 0 0.0125 0 0 0 0 0.08601 -2018 01 31 automated_test_6_output_2ppc intel knl 1 16 8 4.0 1.084 0.09053 0.13 0.09324 0.1378 0.02747 0.009309 0.01008 0.02333 0.06676 0.04985 0 0.001683 0.007208 -2018 01 31 automated_test_6_output_2ppc intel knl 1 16 8 3.6 1.064 0.08987 0.1301 0.09356 0.1356 0.02736 0.009306 0.01015 0.0225 0.05925 0.05244 0 0.0008205 0.005574 -2018 01 31 automated_test_6_output_2ppc intel knl 1 16 8 4.2 1.116 0.09026 0.1345 0.09613 0.1364 0.02789 0.009283 0.01019 0.02335 0.09327 0.0508 0 0.0009409 0.005977 -2018 01 31 automated_test_6_output_2ppc intel knl 1 16 8 4.7 1.091 0.09019 0.1365 0.09802 0.1354 0.02804 0.009118 0.009933 0.02029 0.08396 0.04825 0 0.0009181 0.00505 2018 01 31 automated_test_1_uniform_rest_32ppc intel knl 1 16 8 3.14 0.3986 0.1713 0.01719 0.01615 0.06987 0.03636 0.01901 0.01999 0.003602 0 0 0 0 0.007262 2018 01 31 automated_test_1_uniform_rest_32ppc intel knl 1 16 8 3.39 0.4009 0.1712 0.01676 0.01583 0.07061 0.03684 0.01926 0.02011 0.003687 0 0 0 0 0.007841 2018 01 31 automated_test_1_uniform_rest_32ppc intel knl 1 16 8 2.91 0.4024 0.1716 0.01826 0.01918 0.0703 0.0363 0.01912 0.01989 0.003017 0 0 0 0 0.007256 diff --git a/Tools/performance_tests/run_alltests_1node.py b/Tools/performance_tests/run_alltests_1node.py index 55635a9dc..4c6849c3b 100644 --- a/Tools/performance_tests/run_alltests_1node.py +++ b/Tools/performance_tests/run_alltests_1node.py @@ -9,15 +9,21 @@ from functions_perftest import * # ---- User's manual ---- # Before running performance tests, make sure you have the latest version # of performance_log.txt -# A typical execution reads: -# python run_alltests_1node.py --no-recompile --compiler=intel --architecture=knl --mode=run --input_file=uniform_plasma --n_node=1 --log_file='my_performance_log.txt' -# These are default values, and will give the same result as -# > python run_alltests.py + +# ---- Running a custom set of performance tests ---- +# > python run_alltests_1node.py --no-recompile --compiler=intel +# > --architecture=knl --mode=run --input_file=uniform_plasma +# > --n_node=1 --log_file='my_performance_log.txt' + +# ---- Running the pre-drefined automated tests ---- +# Compile and run: +# > python run_alltests_1node.py --automated --recompile +# Just run: +# > python run_alltests_1node.py --automated + # To add a new test item, extent the test_list with a line like -# test_list.extend([['my_input_file', n_node, n_mpi, n_omp]]*3) +# test_list.extend([['my_input_file', n_node, n_mpi, n_omp]]*n_repeat) # - my_input_file must be in warpx/performance_tests -# - the test will run 3 times, to have some statistics -# - the test must take <1h or it will timeout # ---- Developer's manual ---- # This script can run in two modes: @@ -86,12 +92,11 @@ if args.automated == True: n_repeat = 4 test_list.extend([['automated_test_1_uniform_rest_32ppc', 1, 16, 8]]*n_repeat) test_list.extend([['automated_test_2_uniform_rest_1ppc', 1, 16, 8]]*n_repeat) - test_list.extend([['automated_test_2_uniform_rest_1ppc', 1, 16, 8]]*n_repeat) test_list.extend([['automated_test_3_uniform_drift_4ppc', 1, 16, 8]]*n_repeat) - test_list.extend([['automated_test_4_labdiags_2ppc', 1, 16, 8]]*n_repeat) - test_list.extend([['automated_test_5_loadimbalance', 1, 16, 8]]*n_repeat) - test_list.extend([['automated_test_6_output_2ppc', 1, 16, 8]]*n_repeat) - do_commit = True + test_list.extend([['automated_test_4_labdiags_2ppc', 1, 16, 8]]*n_repeat) + test_list.extend([['automated_test_5_loadimbalance', 1, 16, 8]]*n_repeat) + test_list.extend([['automated_test_6_output_2ppc', 1, 16, 8]]*n_repeat) + do_commit = False run_name = 'automated_tests' n_tests = len(test_list) @@ -271,3 +276,58 @@ if args.mode == 'read': 'git commit -m "performance tests";'\ 'git push -u origin master') + # Plot file + import numpy as np + import matplotlib + matplotlib.use('Agg') + import matplotlib.pyplot as plt + filename0 = 'performance_log' + filename = filename0 + '.txt' + fontsize = 14 + matplotlib.rcParams.update({'font.size': fontsize}) + nsteps = 100. + nrepeat = 4 + legends = [ 'n_node', 'n_mpi', 'n_omp', 'time_initialization', 'time_one_iteration', \ + 'Redistribute', 'FillBoundary', 'ParallelCopy', 'CurrentDeposition', \ + 'FieldGather', 'ParthiclePush', 'Copy', 'EvolveEM', 'Checkpoint', \ + 'WriteParticles', 'Write_FabArray', 'WriteMultiLevelPlotfile', \ + 'RedistributeMPI'] + date = np.loadtxt( filename, usecols = np.arange(0, 3 )) + data = np.loadtxt( filename, usecols = np.arange(6, 6+len(legends)) ) + # Read run name + with open(filename) as f: + namelist_tmp = zip(*[line.split() for line in f])[3] + # Remove first line = comments + namelist = list(namelist_tmp[1:]) + selector_list = ['automated_test_1_uniform_rest_32ppc',\ + 'automated_test_2_uniform_rest_1ppc',\ + 'automated_test_3_uniform_drift_4ppc',\ + 'automated_test_4_labdiags_2ppc',\ + 'automated_test_5_loadimbalance',\ + 'automated_test_6_output_2ppc'] + selector_string = selector_list[0] + selector = [idx for idx in range(len(namelist)) if selector_string in namelist[idx]] + lin_date = date[:,0]+date[:,1]/12.+date[:,2]/366. + unique_lin_date = np.unique(lin_date) + my_xticks = unique_lin_date +# cmap = plt.get_cmap("tab20") + cycle = plt.rcParams['axes.prop_cycle'].by_key()['color'] + for selector_string in selector_list: + selector = [idx for idx in range(len(namelist)) if selector_string in namelist[idx]] + plt.figure(num=0, figsize=(8,4)) + plt.clf() + plt.title('warpx ' + selector_string) + for i in np.arange(data.shape[1]): + icolors = i-3 + if i>3 and (data[selector,i] > 5./100*data[selector,4]).any(): + plt.plot(lin_date[selector], data[selector,i],'+', ms=6, \ + mew=2, label=legends[i] ) + # plt.plot(lin_date[selector], data[selector,i],'+', ms=6, \ + # mew=2, label=legends[i], color=cmap(i) ) + plt.xlabel('date') + plt.ylabel('time/step (s)') + plt.grid() + plt.legend(loc='best') + plt.legend(bbox_to_anchor=(1.1, 1.05)) + plt.savefig( selector_string + '.pdf', bbox_inches='tight') + plt.savefig( selector_string + '.png', bbox_inches='tight') -- cgit v1.2.3