Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document and scripts relating to CPS experiments with CEK machine #434

Merged
merged 3 commits into from
Dec 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/fomega/cek-cps-experiments/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
This directory contains a document about the performance of various
versions of the CEK machine. The results are essentially negative,
but it seemed worth reporting them anyway. The scripts used to run the
experiments and plot the results are also included for completeness.

The contents of this directory are as follows:

* `results.pdf`: a PDF containing graphs of the results and some
discussion. This is all that most people will want to read.

<br/>

* `run-all`: a bash script which builds the different versions of the
program and runs each of them with a sequence of inputs.

* `src/`: the source code for the various machines.

* `tex/`: tex source for `results.pdf`

* `testprogs/`: the test programs

* `results/`: the results of the experiments

* `r/`: R scripts for generating graphs from the test results.

7 changes: 7 additions & 0 deletions docs/fomega/cek-cps-experiments/RUNNING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To run the tests, type `run-all`. This will build and
run the tests, saving the results in the current directory.

To plot the graphs, type `R --no-save < r/draw-all.r` assuming you
have R installed); this will read the files produced by the `run-all`
script and produce PDFs containing graphs. These can be included in
tex documents (as in `results.tex`).
33 changes: 33 additions & 0 deletions docs/fomega/cek-cps-experiments/r/Fac-mem-plot.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
title <- "Fac (memory)"

masterdata <- read.table("master-times-Fac", header=T)
recdata <- read.table("recursive-times-Fac", header=T)
cpsdata <- read.table("cps-times-Fac", header=T)
origdata <- read.table("orig-times-Fac", header=T)

allmem <- c(masterdata$mem, recdata$mem, cpsdata$mem, origdata$mem)
ylim <- c(min(allmem)/1024, max(allmem/1024))


start <- function(fr,col) { # Just to make it easier to plot biggest thing first by Trial and error
plot (fr$n,fr$mem/1024, col=col, pch=20, main=title, xlab = "n", ylab ="Memory (MB)", xlim = c(0,max(masterdata$n)), ylim=ylim)
lines (fr$n,fr$mem/1024, col=col, pch=20)
}

draw <- function(fr,col) {
points (fr$n,fr$mem/1024, col=col, pch=20)
lines (fr$n,fr$mem/1024, col=col, pch=20)
}

mastercol="gold"
reccol="darkolivegreen3"
cpscol="blue"
origcol="darkmagenta"

start (origdata, origcol)
draw (masterdata,mastercol)
draw (recdata,reccol)
draw (cpsdata, cpscol)


legend(x="topleft", inset=.05, legend=c("master","recursive", "CPS", "Original CEK machine"), col=c(mastercol, reccol, cpscol, origcol), lty=1, lw=2)
35 changes: 35 additions & 0 deletions docs/fomega/cek-cps-experiments/r/Fac-plot.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
title = "Fac (time)"

masterdata <- read.table("master-times-Fac", header=T)
recdata <- read.table("recursive-times-Fac", header=T)
cpsdata <- read.table("cps-times-Fac", header=T)
origdata <- read.table("orig-times-Fac", header=T)



all <- c(masterdata$usr+masterdata$sys, recdata$usr+recdata$sys, cpsdata$usr+cpsdata$sys, origdata$usr+origdata$sys)
ylim <- c(min(all), max(all))

start <- function(fr,col) {
plot (fr$n,fr$usr+fr$sys, col=col, pch=20, main=title, xlab = "n", ylab = "Time (s)", ylim=ylim)
lines (fr$n,fr$usr+fr$sys, col=col, pch=20)
}

draw <- function(fr,col) {
points (fr$n,fr$usr+fr$sys, col=col, pch=20)
lines (fr$n,fr$usr+fr$sys, col=col, pch=20)
}

mastercol="gold"
reccol="darkolivegreen3"
cpscol="blue"
origcol="darkmagenta"


start (recdata,reccol)
draw (origdata, origcol)
draw (masterdata,mastercol)
draw (cpsdata, cpscol)


legend(x="topleft", inset=.05, legend=c("master","recursive", "CPS", "Original CEK machine"), col=c(mastercol, reccol, cpscol, origcol), lty=1, lw=2)
32 changes: 32 additions & 0 deletions docs/fomega/cek-cps-experiments/r/Fib-mem-plot.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
title <- "Fib (memory)"

masterdata <- read.table("master-times-Fib", header=T)
recdata <- read.table("recursive-times-Fib", header=T)
cpsdata <- read.table("cps-times-Fib", header=T)
origdata <- read.table("orig-times-Fib", header=T)

allmem <- c(masterdata$mem, recdata$mem, cpsdata$mem, origdata$mem)
ylim <- c(min(allmem)/1024, max(allmem/1024)+10)

start <- function(fr,col) { # Just to make it easier to plot biggest thing first by Trial and error
plot (fr$n,fr$mem/1024, col=col, pch=20, main=title, xlab = "n", ylab ="Memory (MB)", ylim=ylim)
lines (fr$n,fr$mem/1024, col=col, pch=20)
}

draw <- function(fr,col) {
points (fr$n,fr$mem/1024, col=col, pch=20)
lines (fr$n,fr$mem/1024, col=col, pch=20)
}

mastercol="gold"
reccol="darkolivegreen3"
cpscol="blue"
origcol="darkmagenta"

start (cpsdata, cpscol)
draw (masterdata,mastercol)
draw (recdata,reccol)
draw (origdata, origcol)


legend(x="topleft", inset=.05, legend=c("master","recursive", "CPS", "Original CEK machine"), col=c(mastercol, reccol, cpscol, origcol), lty=1, lw=2)
33 changes: 33 additions & 0 deletions docs/fomega/cek-cps-experiments/r/Fib-plot.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
title <- "Fib (time)"

masterdata <- read.table("master-times-Fib", header=T)
recdata <- read.table("recursive-times-Fib", header=T)
cpsdata <- read.table("cps-times-Fib", header=T)
origdata <- read.table("orig-times-Fib", header=T)

all <- c(masterdata$usr+masterdata$sys, recdata$usr+recdata$sys, cpsdata$usr+cpsdata$sys, origdata$usr+origdata$sys)
ylim <- c(min(all), max(all))

start <- function(fr,col) {
plot (fr$n,fr$usr+fr$sys, col=col, pch=20, main=title, xlab = "n", ylab ="Time (s)", ylim=ylim)
lines (fr$n,fr$usr+fr$sys, col=col, pch=20)
}


draw <- function(fr,col) {
points (fr$n,fr$usr+fr$sys, col=col, pch=20)
lines (fr$n,fr$usr+fr$sys, col=col, pch=20)
}

mastercol="gold"
reccol="darkolivegreen3"
cpscol="blue"
origcol="darkmagenta"


start (masterdata,mastercol)
draw (cpsdata, cpscol)
draw (recdata,reccol)
draw (origdata, origcol)

legend(x="topleft", inset=.05, legend=c("master","recursive", "CPS", "Original CEK machine"), col=c(mastercol, reccol, cpscol, origcol), lty=1, lw=2)
32 changes: 32 additions & 0 deletions docs/fomega/cek-cps-experiments/r/Loop-mem-plot.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
title <- "Loop (memory)"

masterdata <- read.table("master-times-Loop", header=T)
recdata <- read.table("recursive-times-Loop", header=T)
cpsdata <- read.table("cps-times-Loop", header=T)
origdata <- read.table("orig-times-Loop", header=T)

allmem <- c(masterdata$mem, recdata$mem, cpsdata$mem, origdata$mem)
ylim <- c(min(allmem)/1024, max(allmem/1024))

start <- function(fr,col) { # Just to make it easier to plot biggest thing first by Trial and error
plot (fr$n,fr$mem/1024, col=col, pch=20, main=title, xlab = "n", ylab ="Memory (MB)", ylim=ylim)
lines (fr$n,fr$mem/1024, col=col, pch=20)
}

draw <- function(fr,col) {
points (fr$n,fr$mem/1024, col=col, pch=20)
lines (fr$n,fr$mem/1024, col=col, pch=20)
}

mastercol="gold"
reccol="darkolivegreen3"
cpscol="blue"
origcol="darkmagenta"

start (masterdata, mastercol)
draw (recdata,reccol)
draw (cpsdata, cpscol)
draw (origdata,origcol)


legend(x="topleft", inset=.05, legend=c("master","recursive", "CPS", "Original CEK machine"), col=c(mastercol, reccol, cpscol, origcol), lty=1, lw=2)
32 changes: 32 additions & 0 deletions docs/fomega/cek-cps-experiments/r/Loop-plot.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
title <- "Loop (time)"

masterdata <- read.table("master-times-Loop", header=T)
recdata <- read.table("recursive-times-Loop", header=T)
cpsdata <- read.table("cps-times-Loop", header=T)
origdata <- read.table("orig-times-Loop", header=T)

all <- c(masterdata$usr+masterdata$sys, recdata$usr+recdata$sys, cpsdata$usr+cpsdata$sys, origdata$usr+origdata$sys)
ylim <- c(min(all), max(all))

start <- function(fr,col) {
plot (fr$n,fr$usr+fr$sys, col=col, pch=20, main=title, xlab = "n", ylab = "Time (s)", ylim=ylim)
lines (fr$n,fr$usr+fr$sys, col=col, pch=20)
}

draw <- function(fr,col) {
points (fr$n,fr$usr+fr$sys, col=col, pch=20)
lines (fr$n,fr$usr+fr$sys, col=col, pch=20)
}

mastercol="gold"
reccol="darkolivegreen3"
cpscol="blue"
origcol="darkmagenta"

start (masterdata, mastercol)
draw (recdata, reccol)
draw (cpsdata, cpscol)
draw (origdata, origcol)


legend(x="topleft", inset=.05, legend=c("master","recursive", "CPS", "Original CEK machine"), col=c(mastercol, reccol, cpscol, origcol), lty=1, lw=2)
32 changes: 32 additions & 0 deletions docs/fomega/cek-cps-experiments/r/Tri-mem-plot.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
title <- "Tri (memory)"

masterdata <- read.table("master-times-Tri", header=T)
recdata <- read.table("recursive-times-Tri", header=T)
cpsdata <- read.table("cps-times-Tri", header=T)
origdata <- read.table("orig-times-Tri", header=T)

allmem <- c(masterdata$mem, recdata$mem, cpsdata$mem, origdata$mem)
ylim <- c(min(allmem)/1024, max(allmem/1024))

start <- function(fr,col) { # Just to make it easier to plot biggest thing first by Trial and error
plot (fr$n,fr$mem/1024, col=col, pch=20, main=title, xlab = "n", ylab ="Memory (MB)", ylim=ylim)
lines (fr$n,fr$mem/1024, col=col, pch=20)
}

draw <- function(fr,col) {
points (fr$n,fr$mem/1024, col=col, pch=20)
lines (fr$n,fr$mem/1024, col=col, pch=20)
}

mastercol="gold"
reccol="darkolivegreen3"
cpscol="blue"
origcol="darkmagenta"

start (origdata, origcol)
draw (masterdata, mastercol)
draw (recdata,reccol)
draw (cpsdata, cpscol)


legend(x="topleft", inset=.05, legend=c("master","recursive", "CPS", "Original CEK machine"), col=c(mastercol, reccol, cpscol, origcol), lty=1, lw=2)
34 changes: 34 additions & 0 deletions docs/fomega/cek-cps-experiments/r/Tri-plot.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
title <- "Tri (time)"


masterdata <- read.table("master-times-Tri", header=T)
origdata <- read.table("recursive-times-Tri", header=T)
cpsdata <- read.table("cps-times-Tri", header=T)
recdata <- read.table("orig-times-Tri", header=T)

all <- c(masterdata$usr+masterdata$sys, recdata$usr+recdata$sys, cpsdata$usr+cpsdata$sys, origdata$usr+origdata$sys)
ylim <- c(min(all), max(all))

start <- function(fr,col) {
plot (fr$n,fr$usr+fr$sys, col=col, pch=20, main=title, xlab = "n", ylab = "Time (s)", ylim=ylim)
lines (fr$n,fr$usr+fr$sys, col=col, pch=20)
}


draw <- function(fr,col) {
points (fr$n,fr$usr+fr$sys, col=col, pch=20)
lines (fr$n,fr$usr+fr$sys, col=col, pch=20)
}

mastercol="gold"
reccol="darkolivegreen3"
cpscol="blue"
origcol="darkmagenta"


start (masterdata, mastercol)
draw (recdata, reccol)
draw (cpsdata, cpscol)
draw (origdata, origcol)

legend(x="topleft", inset=.05, legend=c("master","recursive", "CPS", "Original CEK machine"), col=c(mastercol, reccol, cpscol, origcol), lty=1, lw=2)
33 changes: 33 additions & 0 deletions docs/fomega/cek-cps-experiments/r/draw-all.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
pdf ("Loop-times.pdf")
source ("r/Loop-plot.r")
dev.off()

pdf ("Loop-mem.pdf")
source ("r/Loop-mem-plot.r")
dev.off()

pdf ("Tri-times.pdf")
source ("r/Tri-plot.r")
dev.off()

pdf ("Tri-mem.pdf")
source ("r/Tri-mem-plot.r")
dev.off()

pdf ("Fib-times.pdf")
source ("r/Fib-plot.r")
dev.off()

pdf ("Fib-mem.pdf")
source ("r/Fib-mem-plot.r")
dev.off()

pdf ("Fac-times.pdf")
source ("r/Fac-plot.r")
dev.off()

pdf ("Fac-mem.pdf")
source ("r/Fac-mem-plot.r")
dev.off()


Binary file added docs/fomega/cek-cps-experiments/results.pdf
Binary file not shown.
22 changes: 22 additions & 0 deletions docs/fomega/cek-cps-experiments/results/cps-times-Fac
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
n usr sys mem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to check in the results?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you did, maybe we can generate the graphs during the build instead of checking them in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just thought I'd save the results since there's more information in there than appears in the graphs. The graphs are generated using R (see RUNNING.md), and putting that into nix might be a bit heavyweight just to draw some graphs.This isn't a terribly important document anyway, so I don't know if it's worth complicating the build.

0 0.17 0.01 42728
5000 0.30 0.01 48484
10000 0.40 0.01 52360
15000 0.53 0.01 60072
20000 0.65 0.01 61316
25000 0.79 0.04 68044
30000 0.90 0.05 74416
35000 1.05 0.04 76452
40000 1.20 0.05 78248
45000 1.38 0.03 80140
50000 1.53 0.05 89560
55000 1.69 0.06 98700
60000 1.86 0.07 108932
65000 2.06 0.07 110188
70000 2.26 0.05 110264
75000 2.40 0.09 110004
80000 2.61 0.08 109860
85000 2.95 0.07 108104
90000 3.07 0.08 115192
95000 3.27 0.09 127324
100000 3.57 0.06 137452
32 changes: 32 additions & 0 deletions docs/fomega/cek-cps-experiments/results/cps-times-Fib
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
n usr sys mem
1 0.18 0.01 41480
2 0.18 0.01 41784
3 0.18 0.01 41728
4 0.17 0.01 41840
5 0.18 0.01 41636
6 0.17 0.01 42020
7 0.18 0.01 41904
8 0.18 0.01 41952
9 0.17 0.01 42024
10 0.19 0.01 42228
11 0.18 0.01 42540
12 0.17 0.02 42264
13 0.18 0.02 42156
14 0.16 0.02 42088
15 0.17 0.01 42584
16 0.19 0.01 42148
17 0.17 0.01 42572
18 0.19 0.01 42688
19 0.18 0.02 42472
20 0.21 0.00 42264
21 0.23 0.00 42444
22 0.26 0.02 42804
23 0.31 0.02 42572
24 0.39 0.01 43060
25 0.56 0.01 42912
26 0.81 0.00 43244
27 1.12 0.02 43744
28 1.74 0.02 44124
29 2.73 0.02 44232
30 4.35 0.04 44044
31 6.80 0.06 44160
Loading