Commit 03a8c9e4 authored by Sander Mathijs van Veen's avatar Sander Mathijs van Veen

Merge branch 'master' of vo20.nl:/git/uva

parents 62d0f0a8 cf1d3eef
#!/usr/bin/env python
from sys import argv, stdin
from pylab import array, matrix, ones, dot, plot, legend, show, savefig
from pylab import plot, xlabel, ylabel, legend, show, savefig
from scipy import polyfit, polyval
# Collect data
data = []
x = []
y = []
for line in stdin.readlines():
data.append(map(float, line.split(',', 1)))
s, t = map(float, line.split(',', 1))
x.append(s)
y.append(t)
# Least squares data fit
A = matrix(ones((len(data), 2)))
data = array(data)
A.T[1] = data.T[0]
b = data.T[1].T
start, slope = tuple(list(dot((A.T * A).I * A.T, b).tolist()[0]))
c = tuple(polyfit(x, y, 1).tolist())
fit = polyval(c, [0, x[-1]])
# Plot and optionally save data
data = data.T
plot(data[0], data[1], 'x', label='original data')
plot([0, data[0][-1]], [start, data[0][-1] * slope + start], '-',
label='linear fit y = %ex + %e' % (slope, start))
plot(x, y, 'x', label='metingen')
plot([0, x[-1]], fit, '-', label='Least Squares fit (y = %ex + %e)' % c)
legend()
xlabel('Pakketgrootte')
ylabel('Tijd (s)')
if len(argv) == 2:
savefig(argv[1])
show()
......@@ -3,9 +3,9 @@
#include <math.h>
#include <mpi.h>
#define DEBUG
//#define DEBUG
#define LOOP 1 // Number of different message sizes
#define LOOP 100 // Number of different message sizes
#define STRIDE 10000 // Difference between the message sizes
#define REPEAT 7 // Number of times to repeat aREPEAT measurement
......
#!/bin/bash
if [ $# -lt 3 ]; then
echo "Usage: bash $0 MAX STEP STRING_STEPS"
if [ $# -lt 1 ]; then
echo "Usage: bash $0 STRING_STEPS"
exit 1
fi
REPEAT=4
FILE=bench.txt
dx=`echo "1/$3" | bc -l`
dx=`echo "1/$1" | bc -l`
args="sinus 10000 1 $dx 1 2"
# Execute sequential program
/usr/bin/time -f "%e" -o $FILE ./seq $args
# Clear results file
#echo "" > $FILE
/usr/bin/time -f "1 %e" -o $FILE ./seq $args
for i in `seq 2 $REPEAT`; do
/usr/bin/time -f "1 %e" -ao $FILE ./seq $args
done
# Execute parallel program for different numbers of nodes
for (( i=2; i <= $1; i += $2 )); do
for i in `seq 2 13`; do
for j in `seq $REPEAT`; do
/usr/bin/time -f "$i %e" -ao $FILE ./par.sh $i $args
done
......
......@@ -3,8 +3,15 @@ if [ $# -lt 7 ]; then
echo "Usage: bash $0 NUM_PROCESSES INIT_METHOD TIME_STEPS LENGTH DX TAU N|XP"
exit 1
fi
mpirun -np ${1-4} ./par ${@:2:$#}
#mpirun -np ${1-4} \
# --hostfile ~/.mpirun.machines ./par ${@:2:$#}
#mpirun -np ${1-4} --mca pls_rsh_agent rsa \
# --hostfile ~/.mpirun.machines ./par ${@:2:$#}
# Build hosts string
START=16
cur=`expr $START + 1`
hosts="edu0$START,edu0$cur"
for i in `seq 3 $1`; do
cur=`expr $cur + 1`
hosts="$hosts,edu0$cur"
done
mpirun -mca plm_rsh_agent /usr/bin/rsh -n $1 -host $hosts ./par ${@:2:$#}
#mpirun -np ${1-4} ./par ${@:2:$#}
#!/usr/bin/env python
from sys import argv
from pylab import plot, show, savefig
from pylab import plot, xlabel, ylabel, show, savefig
from scipy import polyfit, polyval
# Collect data
x = []
y = []
results = open('bench.txt')
for line in results.readlines()[1:]:
for line in results.readlines():
n, t = line[:-1].split(' ')
# Use the minimum of all measurements
if len(x) and x[-1] is int(n) and y[-1] > float(t):
if len(x) and x[-1] == int(n):
if y[-1] > float(t):
y[-1] = float(t)
continue
x.append(int(n))
y.append(float(t))
# Plot data
plot(x, y, 'o-')
seq = [x[0], y[0]]
x = x[1:]
y = y[1:]
# Least squares data fit
c = tuple(polyfit(x, y, 2).tolist())
fit = polyval(c, x)
# Plot and optionally save data
plot(x, y, 'x')
plot(x, fit, '-')
plot(seq[0], seq[1], 'x')
xlabel('Aantal processen')
ylabel('Tijd (s)')
if len(argv) > 1:
savefig(argv[1])
show()
19.48
2 11.45
2 10.19
2 10.23
2 10.20
3 14.76
3 14.86
3 14.90
3 14.78
4 11.72
4 11.82
4 11.72
4 11.86
5 13.82
5 13.85
5 13.97
5 13.83
6 12.17
6 12.21
6 12.00
6 12.01
7 13.69
7 13.73
7 13.67
7 13.77
8 12.63
8 12.44
8 12.68
8 12.64
9 13.74
9 13.80
9 13.84
9 13.89
10 12.70
10 12.81
10 12.79
10 12.75
1 9.69
1 9.69
1 9.69
1 10.84
2 5.83
2 5.81
2 5.78
2 5.78
3 4.38
3 4.35
3 4.38
3 4.37
4 4.00
4 3.67
4 3.65
4 3.68
5 3.60
5 3.24
5 3.46
5 3.24
6 4.10
6 3.55
6 3.18
6 3.44
7 3.09
7 2.99
7 3.18
7 3.18
8 3.73
8 3.00
8 2.67
8 2.85
9 3.25
9 2.76
9 2.76
9 2.56
10 2.74
10 3.51
10 2.88
10 3.68
11 3.05
11 3.65
11 3.43
11 3.03
12 3.66
12 2.58
12 3.19
12 2.57
13 3.47
13 3.94
13 2.36
13 3.54
......@@ -366,10 +366,15 @@ geconcludeerd dat ook het parallelle programma correct is geïmplementeerd..
\begin{figure}[H]
\includegraphics[width=10cm]{benchmark.pdf}
\caption{Runtime met parameters \texttt{sinus 10000 1 .00002 1 2}.}
\end{figure}
\pagebreak
\appendix
\section{Uitvoer testts}
\section{Uitvoer tests}
\subsection{Test 1}
\label{app:test-1}
......
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