commit 326d381b4b03e7221ec609fbe08cb9fdf40aa9a3
parent f3f78b3000479f6010baa99e3a83d9382fe4cbbe
Author: Ivan Gankevich <igankevich@ya.ru>
Date: Tue, 8 Aug 2017 12:25:20 +0300
Add AR dependencies plot.
Diffstat:
2 files changed, 74 insertions(+), 10 deletions(-)
diff --git a/R/common.R b/R/common.R
@@ -119,13 +119,65 @@ arma.plot_ramp_up_interval <- function(label="Ramp-up interval") {
c(0, my, my, 0, 0),
c(0, 0, 0, 0, 0),
pmat=res
- ), col="red", lwd=3)
- text(trans3d(0, my/2, max(zeta$z)*1.5, pmat=res), label, col="red", font=2)
+ ), col="red", lwd=3)
+ text(trans3d(0, my/2, max(zeta$z)*1.5, pmat=res), label, col="red", font=2)
from <- trans3d(0, my/2, max(zeta$z)*1.4, pmat=res)
to <- trans3d(0, my/2, max(zeta$z)*0.05, pmat=res)
arrows(from$x, from$y, to$x, to$y, lwd=2, angle=10, length=0.1, col="red")
}
+arma.cube <- function (x, y, z) {
+ c <- cube3d(alpha=0.2)
+ c$material$lwd <- 4
+# c$material$front <- 'line'
+ c$material$back <- 'line'
+ c$material$col <- '#ffffff'
+ shade3d(translate3d(c, x, y, z))
+}
+
+arma.arrow <- function (x1,x2,ps) {
+ arrow3d(
+ c(x1[1], x1[2], x1[3])*ps,
+ c(x2[1], x2[2], x2[3])*ps,
+ type="rotation", col="grey", s=1/7)
+}
+
+arma.plot_ar_cubes <- function(nx, ny, nz) {
+ library("rgl")
+ part_size <- 2
+ # generate cubes
+# for (i in c(1:nx)) {
+# for (j in c(1:ny)) {
+# for (k in c(1:nz)) {
+# arma.cube(i*part_size, j*part_size, k*part_size)
+# }
+# }
+# }
+ # generate arrows
+ for (i in c(1:nx)) {
+ for (j in c(1:ny)) {
+ for (k in c(1:nz)) {
+ m1 <- min(i+1, nx)
+ m2 <- min(j+1, ny)
+ m3 <- min(k+1, nz)
+ for (l in c(i:m1)) {
+ for (m in c(j:m2)) {
+ for (n in c(k:m3)) {
+ v1 <- c(i,j,k)
+ v2 <- c(l,m,n)
+ if (!(i==l && j==m && k==n)) {
+ arma.arrow(v1, v2, part_size)
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ # rotate the camera
+ view3d(45,30)
+}
+
arma.plot_factory_vs_openmp <- function(...) {
args <- list(...)
perf <- read.csv(file.path("data", "performance", "factory-vs-openmp.csv"))
diff --git a/arma-thesis.org b/arma-thesis.org
@@ -3455,14 +3455,26 @@ AR model's formula main feature is autoregressive dependencies between wavy
surface points along each dimension which prevent computing each surface point
in parallel. Instead the surface is partitioned along each dimension into equal
three-dimensional parts, and for each part information dependencies, which
-define execution order, are established. Figure\nbsp{} shows these dependencies.
-Here arrow denotes dependency of one part on availability of another. Here part
-\(A\) does not have dependencies, parts \(B\) and \(C\) depend on \(A\), and
-part \(D\) depends on \(A\), \(B\) and \(C\). In essence, each part depends only
-on the parts that have previous index along each dimension (if such parts
-exist). The first part does not have any dependencies, and the size of each part
-along each dimension is made greater or equal to the corresponding number of
-coefficient along the dimension to simplify dependency handling.
+define execution order, are established. Figure\nbsp{}[[fig-ar-cubes]] shows these
+dependencies. Here arrow denotes dependency of one part on availability of
+another. Here part \(A\) does not have dependencies, parts \(B\) and \(C\)
+depend on \(A\), and part \(D\) depends on \(A\), \(B\) and \(C\). In essence,
+each part depends only on the parts that have previous index along each
+dimension (if such parts exist). The first part does not have any dependencies,
+and the size of each part along each dimension is made greater or equal to the
+corresponding number of coefficient along the dimension to simplify dependency
+handling.
+
+#+name: fig-ar-cubes
+#+header: :width 5 :height 4
+#+begin_src R :file build/ar-cubes.pdf
+source(file.path("R", "common.R"))
+arma.plot_ar_cubes(3,3,3)
+rgl.postscript("build/ar-cubes.pdf", fmt="pdf")
+#+end_src
+
+#+RESULTS: fig-ar-cubes
+[[file:build/ar-cubes.pdf]]
Each part has an three-dimensional index and a completion status. The algorithm
starts by submitting objects containing this information into a queue. After