Add plot script and move scripts to util directory
Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
39
util/plot_run_stub_data.py
Normal file
39
util/plot_run_stub_data.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import sys
|
||||
|
||||
vector_width = 8 # 8 doubles per zmm vector
|
||||
|
||||
filename = sys.argv[1]
|
||||
output_file = filename.replace(".txt", ".pdf")
|
||||
fig = plt.figure()
|
||||
ax = plt.axes()
|
||||
plot_data = {}
|
||||
|
||||
with open(filename, 'r') as fp:
|
||||
for line in fp.readlines():
|
||||
steps, unit_cells, atoms_per_unit_cell, total_atoms, total_vol, atoms_vol, neigh_vol, time, atom_upds_per_sec, cy_per_atom, cy_per_neigh = line.split(',')
|
||||
atoms_per_unit_cell = int(atoms_per_unit_cell)
|
||||
vol = float(neigh_vol)
|
||||
cy_per_atom = float(cy_per_atom)
|
||||
|
||||
if atoms_per_unit_cell < 2048:
|
||||
if atoms_per_unit_cell not in plot_data:
|
||||
plot_data[atoms_per_unit_cell] = {}
|
||||
|
||||
cy_per_iter = cy_per_atom * vector_width / atoms_per_unit_cell
|
||||
plot_data[atoms_per_unit_cell][vol] = cy_per_iter if vol not in plot_data[atoms_per_unit_cell] \
|
||||
else min(cy_per_iter, plot_data[atoms_per_unit_cell][vol])
|
||||
|
||||
for atoms_per_unit_cell in plot_data:
|
||||
volumes = list(plot_data[atoms_per_unit_cell].keys())
|
||||
volumes.sort()
|
||||
cycles = [plot_data[atoms_per_unit_cell][vol] for vol in volumes]
|
||||
ax.plot(volumes, cycles, marker='.', label=str(atoms_per_unit_cell))
|
||||
|
||||
ax.vlines([32, 1000, 28000], 0, 1, transform=ax.get_xaxis_transform(), linestyles='dashed', color=['#444444', '#777777', '#aaaaaa'])
|
||||
ax.set(xlabel='Neighbor data volume (kB)', ylabel='Cycles per iteration')
|
||||
ax.set_xscale('log')
|
||||
#ax.set_xticks([32, 1000, 28000])
|
||||
#ax.set_xlim(0, 200000)
|
||||
plt.legend(title="atoms/uc")
|
||||
fig.savefig(output_file, bbox_inches = 'tight', pad_inches = 0)
|
54
util/run_stub.sh
Normal file
54
util/run_stub.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
while getopts "a:f:n:o:r:x:y:z:" flag; do
|
||||
case "${flag}" in
|
||||
a) atoms_per_unit_cell=${OPTARG};;
|
||||
f) frequency=${OPTARG};;
|
||||
n) timesteps=${OPTARG};;
|
||||
o) output_file=${OPTARG};;
|
||||
r) nruns=${OPTARG};;
|
||||
x) nx=${OPTARG};;
|
||||
y) ny=${OPTARG};;
|
||||
z) nz=${OPTARG};;
|
||||
esac
|
||||
done
|
||||
|
||||
EXEC="../MDBench-ICC-stub"
|
||||
ATOMS_PER_UNIT_CELL="${atoms_per_unit_cell:-8}"
|
||||
FREQUENCY="${frequency:-0.0}"
|
||||
TIMESTEPS="${timesteps:-200}"
|
||||
OUTPUT_FILE="${output_file:-run_results.txt}"
|
||||
NRUNS="${nruns:-3}"
|
||||
NX="${nx:-4}"
|
||||
NY="${ny:-4}"
|
||||
NZ="${nz:-2}"
|
||||
|
||||
for timesteps in ${TIMESTEPS}; do
|
||||
for atoms_per_unit_cell in ${ATOMS_PER_UNIT_CELL}; do
|
||||
for nx in ${NX}; do
|
||||
for ny in ${NY}; do
|
||||
for nz in ${NZ}; do
|
||||
best_perf=
|
||||
best_output="invalid"
|
||||
for nruns in ${NRUNS}; do
|
||||
output=$(
|
||||
./${EXEC} -f ${FREQUENCY} -n ${timesteps} -na ${atoms_per_unit_cell} -nx ${nx} -ny ${ny} -nz ${nz} -csv |
|
||||
grep -v steps |
|
||||
grep -iv resize
|
||||
)
|
||||
perf=$(echo $output | cut -d',' -f8)
|
||||
if [ -z "$best_perf" ]; then
|
||||
best_perf="$perf"
|
||||
best_output="$output"
|
||||
elif (( $(echo "$perf > 0.0 && $perf < $best_perf" | bc -l) )); then
|
||||
best_perf="$perf"
|
||||
best_output="$output"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${best_output}" | tee -a "${OUTPUT_FILE}"
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
Reference in New Issue
Block a user