-
Notifications
You must be signed in to change notification settings - Fork 0
/
funnel_scale.nf
46 lines (40 loc) · 1.88 KB
/
funnel_scale.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
include { crossProduct; collectCSVs; setupPigeons } from './utils.nf'
params.dryRun = false
def variables = [
scale_idx: (1..20),
seed: (1..30),
model: ["funnel_scale"],
sampler_type: ["SimpleAHMC", "SimpleRWMH", "NUTS", "SliceSampler"],
selector: ["standard", "inverted"],
int_time: ["single_step", "rand"], // single_step gives autoMALA
logstep_jitter: ["none", "fixed", "adapt"]
]
model_string = [
funnel_scale: "Pigeons.stan_funnel(1, scale)",
]
def MAX_RETRIES = params.dryRun ? 0 : 1 // workaround for retry-then-ignore: https://github.com/nextflow-io/nextflow/issues/1090#issuecomment-477964768
def julia_env_dir = file("julia-environment")
def julia_depot_dir = file(".depot")
workflow {
args = crossProduct(variables, params.dryRun)
.filter { it.sampler_type.startsWith("Simple") || it.selector == variables.selector.first() } // selector is only relevant for auto types
.filter { it.sampler_type.startsWith("Simple") || it.logstep_jitter == variables.logstep_jitter.first() } // step jitter only relevant for auto types
.filter { it.sampler_type == "SimpleAHMC" || it.int_time == variables.int_time.first() } // int_time is only relevant for autoHMC
// .view()
julia_env = setupPigeons(julia_depot_dir, julia_env_dir)
agg_path = runSimulation(julia_depot_dir, julia_env, args) | collectCSVs
}
process runSimulation {
memory { params.dryRun ? 4.GB : ( task.attempt * (8.GB * (arg.sampler_type == "NUTS" ? 2 : 1)) ) } // NUTS needs ~ 65M samples for 200 minESS
time { 1.hour * task.attempt * (arg.sampler_type == "NUTS" ? 4 : 1) } // same reason as above
maxRetries { MAX_RETRIES }
errorStrategy { task.attempt <= MAX_RETRIES ? 'retry' : 'ignore' }
input:
env JULIA_DEPOT_PATH
path julia_env
val arg
output:
tuple val(arg), path('csvs')
script:
template 'scale_main.jl'
}