Commit 768ada51 authored by Pavel Kus's avatar Pavel Kus

adding scripts for scaling runs and processing

putting scripts on one place in the repository in an attempt to make
running and processing scaling tests more easy and systematic
Scripts will be further improved
parent a23d9eb9
#!/usr/bin/env python
from itertools import product
from scaling import *
output_dir = "out"
template_file = "run_template_hydra.sh"
#elpa_method = ['elpa1', 'elpa2']
elpa_method = ['elpa1', 'elpa2', 'scalapack_all', 'scalapack_part']
#elpa_method = ['scalapack_part']
math_type = ['real', 'complex']
precision = ['single', 'double']
mat_size = [5000, 20000]
proc_eigen = [10,50,100]
block_size = [16]
num_nodes = [1]
#num_nodes.extend([2**i for i in range(2,11)])
num_nodes.extend([2**i for i in range(2,7)])
#num_nodes = [2048]
#===============================================================================================
#===============================================================================================
# the rest of the script should be changed only if something changed (etc. in elpa)
#===============================================================================================
#===============================================================================================
for em, mt, pr, ms, pe, bs, nn in product(elpa_method, math_type, precision, mat_size, proc_eigen, block_size, num_nodes):
tokens = {}
tokens['_BLOCK_SIZE_'] = bs
tokens['_MAT_SIZE_'] = ms·
tokens['_NUM_EIGEN_'] = ms * pe // 100
tokens['_NUM_NODES_'] = nn
variant(output_dir, template_file, tokens, em, mt, pr)
#! /bin/bash
echo nodes total tridiag solve trans_ev
for f in *.txt
do
#echo "processing $f... "
S=`grep " node = " $f | awk '{print $5}'`
TOTAL=`grep "e%eigenvectors()" $f | awk '{print $3}'`
if [[ -z "$TOTAL" ]]; then
continue
fi
S+=" "$TOTAL
S+=" "`grep "|_ tridiag_" $f | awk '{print $3}'`
S+=" "`grep "|_ solve " $f | awk '{print $3}'`
S+=" "`grep "|_ trans_ev" $f | awk '{print $3}'`
echo $S
done
#! /bin/bash
echo nodes total bandred tridiag solve trans_ev_to_band trans_ev_to_full
for f in *.txt
do
#echo "processing $f... "
S=`grep " node = " $f | awk '{print $5}'`
TOTAL=`grep "|_ ELPA_2STAGE_" $f | awk '{print $3}'`
if [[ -z "$TOTAL" ]]; then
continue
fi
S+=" "$TOTAL
S+=" "`grep "|_ bandred " $f | awk '{print $3}'`
S+=" "`grep "|_ tridiag " $f | awk '{print $3}'`
S+=" "`grep "|_ solve " $f | awk '{print $3}'`
S+=" "`grep "|_ trans_ev_to_band " $f | awk '{print $3}'`
S+=" "`grep "|_ trans_ev_to_full " $f | awk '{print $3}'`
echo $S
done
#! /bin/bash
echo nodes total
for f in *.txt
do
#echo "processing $f... "
S=`grep " node = " $f | awk '{print $5}'`
TOTAL=`grep "Time (SYSTEM_CLOCK)" $f | awk '{print $7}'`
if [[ -z "$TOTAL" ]]; then
continue
fi
S+=" "$TOTAL
echo $S
done
import numpy as np
import matplotlib.pyplot as plt
import os
group_colors = [['red', 'firebrick', 'indianred', 'tomato', 'maroon', 'salmon'],
['green', 'darkgreen', 'springgreen', 'darkseagreen', 'lawngreen', 'yellowgreen'],
['blue', 'darkblue', 'cornflowerblue', 'dodgerblue', 'midnightblue', 'lightskyblue'],
['magenta', 'darkviolet', 'mediumvioletred', 'orchid', 'deeppink', 'purple'],
['orange', 'gold', 'navajowhite', 'darkorange', 'goldenrod', 'sandybrown'],
['cyan', 'darkcyan', 'lightseagreen', 'turquoise', 'darkturquoise', 'mediumturquoise']]
group_symbols = ['o', 's', '*', 'D', 'x', 'H']
elpa1_subtimes = ["tridiag", "solve", "trans_ev"]
elpa2_subtimes = ["bandred", "tridiag", "solve", "trans_ev_to_band", "trans_ev_to_full"]
cores_per_node = 20
base_path = "results"
num_type = "real"
prec = "double"
mat_size = 20000
def line(what, mat_size, proc_evec, method, label, color, style):
path = "/".join([base_path,num_type,prec,str(mat_size),str(mat_size*proc_evec//100),method,"tab.txt"])
data = np.genfromtxt(path, names=True)
nodes = data['nodes']
cores = cores_per_node * nodes
plt.plot(cores,data[what], style, label=label, color=color, linewidth=2)
def plot1():
line("total", mat_size, 100, "pdsyevd", "MKL 2017, pdsyevd", "black", "x-")
line("total", mat_size, 100, "pdsyevr", "MKL 2017, pdsyevr, 100% EVs", "blue", "x-")
line("total", mat_size, 50, "pdsyevr", "MKL 2017, pdsyevr, 50% EVs", "green", "x-")
line("total", mat_size, 10, "pdsyevr", "MKL 2017, pdsyevr, 10% EVs", "red", "x-")
line("total", mat_size, 100, "elpa1", "ELPA 1, 100% EVs", "blue", "*--")
line("total", mat_size, 50, "elpa1", "ELPA 1, 50% EVs", "green", "*--")
line("total", mat_size, 10, "elpa1", "ELPA 1, 10% EVs", "red", "*--")
line("total", mat_size, 100, "elpa2", "ELPA 2, 100% EVs", "blue", "o:")
line("total", mat_size, 50, "elpa2", "ELPA 2, 50% EVs", "green", "o:")
line("total", mat_size, 10, "elpa2", "ELPA 2, 10% EVs", "red", "o:")
def details(proc_ev):
for i in range(len(elpa1_subtimes)):
line(elpa1_subtimes[i], mat_size, proc_ev, "elpa1", "ELPA1 - " + elpa1_subtimes[i], group_colors[0][i], group_symbols[2*i] + '-')
for i in range(len(elpa2_subtimes)):
line(elpa2_subtimes[i], mat_size, proc_ev, "elpa2", "ELPA2 - " + elpa2_subtimes[i], group_colors[1][i], group_symbols[i] + '-')
fig = plt.figure(figsize=(15, 10))
ax = fig.add_subplot(111)
ax.tick_params(labelright='on')
plot1()
#details(100)
#plt.title('Num CPUs ' + str(num_cpus) + ' and ' + str(eigenvectors_percent) + '% eigenvectors, ' + numtype)
#plt.title('Num CPUs ')
plt.title("Matrix " + str(mat_size//1000) + "k, " + num_type + ", " + prec)
plt.grid()
plt.legend(loc=1)
plt.xlabel('Number of cores')
plt.ylabel('Execution time [s]')
plt.xscale('log')
plt.yscale('log')
ax.xaxis.grid(b=True, which='major', color='black', linestyle=':')
ax.yaxis.grid(b=True, which='major', color='black', linestyle='--')
ax.yaxis.grid(b=True, which='minor', color='black', linestyle=':')
ticks = [20* 2**i for i in range(0,12)]
ax.xaxis.set_ticks(ticks)
ax.xaxis.set_ticklabels(ticks)
# yticks_major = [1,10,100,1000]
# ax.yaxis.set_ticks(yticks_major)
# ax.yaxis.set_ticklabels(yticks_major)
# yticks_minor = [2, 5, 20, 50, 200, 500]
# ax.yaxis.set_ticks(yticks_minor, minor=True)
# ax.yaxis.set_ticklabels(yticks_minor, minor=True)
#plt.ylim([0.5, 30])
#plt.ylim([0.1, 100])
#plt.ylim([0.03, 20])
#plt.xlim([20, 41000])
plt.savefig('plot.pdf')
#if show:
plt.show()
#plt.close()
#!/bin/bash
column=${1:-2}
read x
echo set terminal dumb
echo set logscale xy
echo plot \"-\" u 1:$column with lines title \""`echo $x | awk '{print $"'"$column"'"}'`"\"
echo "#" $x
while read x;
do echo $x;
done
#! /usr/bin/env python
import os
import subprocess
rootdir = "results"
path = subprocess.check_output('pwd')[:-1] + "/"
for subdir, dirs, files in os.walk(rootdir):
# for file in files:
# print os.path.join(subdir, file)
# print subdir, dirs, files
if(len(files) != 0):
#print subdir, dirs, files
#print("cd " + path + subdir)
os.chdir(path + subdir)
method = subdir.split("/")[-1]
with open("tab.txt", "w") as outfile:
if(method == "elpa1"):
subprocess.call("parse_elpa1", stdout=outfile)
elif(method == "elpa2"):
subprocess.call("parse_elpa2", stdout=outfile)
else:
subprocess.call("parse_mkl", stdout=outfile)
os.chdir(path)
# @ shell=/bin/bash
#
# Sample script for LoadLeveler
#
## @ class = test
# @ task_affinity = core(1)
# @ error = _OUTPUT_DIR_/$(jobid).err
# @ output = _OUTPUT_DIR_/$(jobid).out
# @ job_type = parallel
# @ node_usage= not_shared
# @ node = _NUM_NODES_·
# @ tasks_per_node = 20
# xxx @ first_node_tasks = 20
#### @ resources = ConsumableCpus(1)
##### @ node_resources = ConsumableMemory(2GB)
# @ network.MPI = sn_all,not_shared,us
# @ wall_clock_limit = 00:20:00
# @ notification = never
# @ notify_user = $(user)@rzg.mpg.de
# @ queue·
# run the program
cd ..
OUTPUT_FILE=run/_OUTPUT_DIR_/${LOADL_STEP_ID}.txt
cat $0 | grep "# @" >> ${OUTPUT_FILE}
echo BUILD_DIR= `pwd` >> $OUTPUT_FILE
echo "Modules loaded at config-time" >> $OUTPUT_FILE
cat modules_config.log >> $OUTPUT_FILE
source ./load_modules.sh
echo "Modules loaded at run-time" >> $OUTPUT_FILE
module list >> $OUTPUT_FILE 2>&1
#echo "ulimit -s" >> $OUTPUT_FILE
#ulimit -s >> $OUTPUT_FILE
#echo "List of hosts" >> $OUTPUT_FILE
#cat $LOADL_HOSTFILE >> $OUTPUT_FILE
#echo "Content of config.log" >> $OUTPUT_FILE
#cat config.log >> $OUTPUT_FILE
#echo "Output of configure script" >> $OUTPUT_FILE
#cat config_output.log >> $OUTPUT_FILE
echo _PRE_RUN_ >> $OUTPUT_FILE
_PRE_RUN_
echo "Running elpa command: " >> $OUTPUT_FILE
COMMAND="poe ./_EXECUTABLE_ _MAT_SIZE_ _NUM_EIGEN_ _BLOCK_SIZE_ "
echo $COMMAND >> $OUTPUT_FILE
${COMMAND} >> $OUTPUT_FILE 2>&1
import os
import sys
def substitute(template_file, tokens):
with open("run.sh", "w") as fout:
with open(template_file, "r") as fin:
for line in fin:
for token in tokens.keys():
line = line.replace(token, str(tokens[token]))
fout.write(line)
def variant_path(output_dir, tokens, elpa_method, math_type, precision):
return "/".join([output_dir, math_type, precision,
str(tokens['_MAT_SIZE_']),
str(tokens['_NUM_EIGEN_']),
elpa_method])
def variant(output_dir, template_file, tokens, elpa_method, math_type, precision):
typeprec = math_type + "_" + precision
tokens['_PRE_RUN_'] = ''
if(elpa_method == 'elpa1'):
tokens['_EXECUTABLE_'] = "test_" + typeprec + "_eigenvectors_1stage_analytic"
elif(elpa_method == 'elpa2'):
tokens['_PRE_RUN_'] = 'TEST_KERNEL="ELPA_2STAGE_REAL_AVX_BLOCK2"'
tokens['_EXECUTABLE_'] = "test_" + typeprec + "_eigenvectors_2stage_default_kernel_analytic"
elif(elpa_method == 'scalapack_all'):
tokens['_EXECUTABLE_'] = "test_" + typeprec + "_eigenvectors_scalapack_all_analytic"
elif(elpa_method == 'scalapack_part'):
tokens['_EXECUTABLE_'] = "test_" + typeprec + "_eigenvectors_scalapack_part_analytic"
else:
assert(0)
tokens['_OUTPUT_DIR_'] = variant_path(output_dir, tokens, elpa_method, math_type, precision)
if not os.path.exists(tokens['_OUTPUT_DIR_']):
os.makedirs(tokens['_OUTPUT_DIR_'])
substitute(template_file, tokens)
if(len(sys.argv) == 2 and sys.argv[1] == '--submit'):
os.system('llsubmit run.sh')
else:
os.system('cat run.sh')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment