-
Notifications
You must be signed in to change notification settings - Fork 4
/
run_parameter_scan.jl
38 lines (29 loc) · 1.08 KB
/
run_parameter_scan.jl
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
using Pkg
Pkg.activate(".")
using Distributed
@everywhere using moment_kinetics
using moment_kinetics.parameter_scans: get_scan_inputs
"""
run_parameter_scan(args...)
Run a parameter scan, getting the inputs for each run from
[`moment_kinetics.parameter_scans.get_scan_inputs`](@ref).
If MPI is not used (i.e. each run should be run in serial), then `@distributed`
parallelism can be used to launch several runs at the same time. To do this, start julia
using the `-p` option to set the number of distributed processes, for example
```shell
\$ julia --project -p 8 run_parameter_scan.jl examples/something/scan_foobar.toml
```
When MPI is used, do not pass the `-p` flag to julia. Each run will run in parallel using
MPI, and the different runs in the scan will be started one after the other.
"""
function run_parameter_scan(args...)
scan_inputs = get_scan_inputs(args...)
@sync @distributed for s ∈ scan_inputs
println("running ", s["run_name"])
run_moment_kinetics(s)
end
return nothing
end
if abspath(PROGRAM_FILE) == @__FILE__
run_parameter_scan()
end