Skip to content

Commit

Permalink
Fix #2 and add Rproj
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Aug 11, 2018
1 parent 1f79b92 commit 2a84100
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
15 changes: 15 additions & 0 deletions drake-examples.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

BuildType: Makefile
4 changes: 3 additions & 1 deletion overhead/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
This example is explicitly designed to support profiling studies to make `drake` faster and more efficient. The workflow has `2n` targets, each with `n` dependencies. Increasing `n` up to 1000 puts heavy strain on the internals and dramatically increases runtime and cache size. Going forward, we want to make `drake` fast for this sort of task.
This workflow is designed to maximize overhead and stress-test drake. The goal is to improve drake's internals so this example runs fast.

Let n be the number of targets. There are n * (n - 1) / 2 non-file dependency connections among all the targets, which is the maximum possible. For i = 2, ..., n, target i depends on targets 1 through i - 1.
22 changes: 15 additions & 7 deletions overhead/make.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# There are 2n targets, each with n dependencies.
# You can increase n to put heavy strain on drake's internals for profiling.
# This workflow is designed to maximize overhead and stress-test drake.
# The goal is to improve drake's internals so this example runs fast.
#
# Let n be the number of targets.
# There are n * (n - 1) / 2 non-file dependency connections
# among all the targets, which is the maximum possible.
# For i = 2, ..., n, target i depends on targets 1 through i - 1.

n <- 4

library(drake)
library(magrittr)
x <- drake_plan(x = sqrt(y__)) %>%
evaluate_plan(rules = list(y__ = seq_len(n)))
y <- gather_plan(x, target = "y") %>%
expand_plan(values = seq_len(n))
plan <- rbind(x, y)
plan <- drake_plan(target_1 = 1)
for (i in seq_len(n - 1) + 1){
target <- paste0("target_", i)
dependencies <- paste0("target_", seq_len(i - 1))
command <- paste0("max(", paste0(dependencies, collapse = ", "), ")")
plan <- rbind(plan, data.frame(target = target, command = command))
}
make(plan)

0 comments on commit 2a84100

Please sign in to comment.