-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixed_round.nf
40 lines (36 loc) · 1.92 KB
/
fixed_round.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
include { crossProduct; collectCSVs; setupPigeons } from './utils.nf'
params.dryRun = false
def variables = [
seed: (1..30),
model: ["horseshoe_logit", "mRNA", "banana(4,0.3)", "funnel(4,0.3)", "funnel(4,1)", "banana(4,1)"],
sampler_type: ["HMC0.25", "MALA0.25", "RWMH0.25", "HMC0.1", "MALA0.1", "RWMH0.1", "HMC10.0", "MALA10.0", "RWMH10.0",
"HMC4.0", "MALA4.0", "RWMH4.0","HMC", "MALA", "RWMH", "SimpleAHMC", "SimpleRWMH"],
selector: ["inverted"],
int_time: ["single_step", "rand"],
logstep_jitter: ["adapt"]
]
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
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" ? 4 : 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 'fixed_round_main.jl'
}