Commit c741fc1d authored by Taddeüs Kroes's avatar Taddeüs Kroes

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

parents 0a09169c 3bc5644d
......@@ -11,8 +11,7 @@ int test_stride = 1; // Items per task
int test_current_item = 0; // Position in item list
double test_list[LIST_SIZE]; // List containing all test items
int main(int argc, char **argv)
{
int main(int argc, char **argv) {
int role;
// Create list of zero values.
......
......@@ -2,14 +2,14 @@
#include "main.h"
#include "master.h"
int master_init(void) {
int master_init(void) {
// Find out how many processes there are in the default communicator
int ntasks;
MPI_Comm_size(MPI_COMM_WORLD, &ntasks);
return ntasks;
}
void master_run(int ntasks, int items_per_task) {
void master_run(int ntasks, int items_per_task) {
int rank;
unit_work_t *work;
unit_result_t result;
......@@ -57,7 +57,7 @@
}
}
void master_destroy(int ntasks) {
void master_destroy(int ntasks) {
// Tell all slaves to exit by sending an empty message with the DIE_TAG.
for (int rank = 1; rank < ntasks; ++rank) {
MPI_Send(0, 0, MPI_DOUBLE, rank, DIE_TAG, MPI_COMM_WORLD);
......
#!/bin/sh
NUM_PROCESSES=4
HOSTS=localhost
HOSTS=ow130,ow131
PROGRAM_EXEC=main
mpirun -np $NUM_PROCESSES -H $HOSTS $PROGRAM_EXEC
CFLAGS +=-std=c99 -Wall -Wextra -g -O2 -pthread
LDFLAGS+=-pthread -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic \
-lnsl -lutil -lm -ldl
MAIN = main
OFILES = $($(wildcard *.c):.c=.o)
$(MAIN): $(OFILES)
clean:
rm -vf $(MAIN) $(OFILES)
check-syntax:
$(CXX) $(CXXFLAGS) -fsyntax-only ${CHK_SOURCES}
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#define GRID_LENGTH 64
double Y[GRID_LENGTH][3];
int t_next, t_prev, t_cur;
void init_sinus(char **argv) {
double amp;
int h_phases;
sscanf(argv[2], "%lf", &amp);
sscanf(argv[3], "%i", &h_phases);
for( int i = 0; i < GRID_LENGTH; i++ ) {
Y[i][t] = amp * sin(M_PI * (i(double)/(double)GRID_LENGTH) * h_phases);
}
}
void init_pluck(char **argv) {
double amp, position;
int ipos, i;
sscanf(argv[2], "%lf", &amp);
sscanf(argv[3], "%i", &position);
ipos = position / dx * GRID_LENGTH;
for( i = 0; i < ipos; i++ ) {
Y[i][t] = i * dx / position * amp;
}
for(;i < GRID_LENGTH; i++ ) {
Y[i][t] = ((GRID_LENGTH - i) * dx) / (GRID_LENGTH - ipos) * amp;
}
}
void iterate(double C, int t_prev, int t_cur, int t_next) {
for( int i = 1; i < GRID_LENGTH; i++ ) {
Y[i][t_next] = C * (Y[i-1][t_cur] - 2*Y[i][t_cur] + Y[i+1][t_cur])
- Y[i][t_prev]
+ 2 * Y[i][t_cur];
}
}
#define SWAP(a, b) \
a ^= b; \
b ^= a; \
a ^= b;
void plot(int col) {
printf("%f", Y[0][col]);
for( int i = 1; i < GRID_LENGTH; i++ )
printf(",%f", Y[i][col]);
printf("\n");
}
int main(int argc, char**argv) {
if(argc < 4) {
fprintf(stderr, "Usage: %s <p amplitude position |s amplitude phases", argv[0]);
return 1;
}
switch(*argv[1]) {
case 'p': init_pluck(argv); break;
case 's': init_sinus(argv); break;
default:
fprintf(stderr, "Does this look like a 'p' or 's' to you?\n");
return 1;
}
double c = .04, dt = .1, dx = .02,
C = c * c * (dt/dx) * (dt/dx);
// TODO: implement iterations
int t_prev = 0, t_cur = 1, t_next = 2,
T = 10;
for( int i = 0; i < T; i++ ) {
iterate(C, t_prev, t_cur, t_next);
SWAP(t_cur, t_next);
SWAP(t_prev, t_next);
plot(t_cur);
}
return 0;
}
from pyplot import show, fig
......@@ -230,6 +230,10 @@
\frame { \frametitle{Eerdere trace uitbreiden met nieuw pad}
\begin{columns}[t]
\column{.6\textwidth}
\begin{itemize}
\item Afwijking trace $\rightarrow$ start interpreter.
\item Indien pad in loop, compile nieuw pad.
......@@ -237,6 +241,10 @@
\includegraphics[width=6cm]{images/trace-expansion.pdf}
\end{itemize}
\column{.4\textwidth}
\end{columns}
}
\frame { \frametitle{Eerdere trace uitbreiden met nieuw pad}
......@@ -280,14 +288,19 @@
\subsection{Toekomst van trace trees}
\frame { \frametitle{Toekomst: Static single assignment en traces}
\frame[containsverbatim] { \frametitle{Toekomst: Static single assignment en traces}
\emph{Hier komt voorbeeld van SSA.}
\emph{Een voorbeeld van SSA.}
\vskip6em
\begin{verbatim}
y := 1 y_1 := 1
y := 2 => y_2 := 2
x := y x_1 := y
\end{verbatim}
\begin{itemize}
\item Zorgt voor meer/betere mogelijkheden tot optimalisaties:
\item Reaching definition analysis.
\item Enabling optimalisatie:
\begin{itemize}
\item Constant propagation.
\item Dead code elimination.
......@@ -300,9 +313,30 @@
\section{Conclusie}
\frame { \frametitle{Conclusie en benchmarks}
\frame[containsverbatim] { \frametitle{Conclusie en benchmarks}
\textbf{Benchmarks}
\begin{verbatim}
$ ./js sunspider/3d-morph.js
243
$ ./js -m sunspider/3d-morph.js
57
$ ./js -j sunspider/3d-morph.js
38
$ ./js -jm sunspider/3d-morph.js
37
$ ./shell sunspider/3d-morph.js # v8
64
\end{verbatim}
\emph{TODO}
\textbf{Conclusie}
\begin{itemize}
\item Trace compilation zorgt voor betere runtime performance.
\item Incremental recompilation zorgt snellere compilation.
\item Runtime is namelijk afhankelijk van execution- en compilation time.
\end{itemize}
}
......
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