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