From 559ccaf78d9afd38b23c102e0638723582290657 Mon Sep 17 00:00:00 2001 From: wlandau Date: Sun, 14 Jul 2019 09:53:04 -0400 Subject: [PATCH] Document https://github.com/ropensci/drake/issues/942 cc @joelnitta --- hpc.Rmd | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/hpc.Rmd b/hpc.Rmd index 0e7ffc933..e40c73f1a 100644 --- a/hpc.Rmd +++ b/hpc.Rmd @@ -249,16 +249,26 @@ plan <- drake_plan( ) ``` -The `model` needs a GPU and multiple CPU cores, and the `data` only needs the bare minimum resources. Declare these requirements in a new list column of the `plan`. Here, each element is a named list for the `resources` argument of `future::future()`. +The `model` needs a GPU and multiple CPU cores, and the `data` only needs the bare minimum resources. Declare these requirements with `target()`, as below. This is equivalent to adding a new list column to the `plan`, where each element is a named list for the `resources` argument of `future::future()`. ```{r planresources} -plan$resources <- list( - list(cores = 1, gpus = 0), - list(cores = 4, gpus = 1) +plan <- drake_plan( + data = target( + download_data(), + resources = list(cores = 1, gpus = 0) + ), + model = target( + big_machine_learning_model(data), + resources = list(cores = 4, gpus = 1) + ) ) + +plan + +str(plan$resources) ``` -Next, plug your resources into the [`brew`](https://CRAN.R-project.org/package=brew) patterns of your [`batchtools`](https://github.com/mllg/batchtools) template file. The following `sge_batchtools.tmpl` file shows how to do it, but the file itself probably requires modification before it will work with your own machine. +Next, plug the names of your resources into the [`brew`](https://CRAN.R-project.org/package=brew) patterns of your [`batchtools`](https://github.com/mllg/batchtools) template file. The following `sge_batchtools.tmpl` file shows how to do it, but the file itself probably requires modification before it will work with your own machine. ``` #!/bin/bash