Parameter scans
Running a scan
Parameter scans can be run using the run_parameter_scan.jl
script. To run from the REPL
$ julia -p 8 --project -O3
julia> include("run_parameter_scan.jl")
julia> run_parameter_scan("path/to/an/input/file.toml")
or to run a single scan from the command line
$ julia -p 8 --project -O3 run_parameter_scan.jl path/to/an/input/file.toml
The -p 8
argument passed to julia in these examples is optional. It indicates that julia should use 8 processes for parallelism. In this case we are not using MPI - each run in the scan is run in serial, but up to 8 (in this example) runs from the scan can be performed simultaneously (using the @distributed
macro).
The runs can use MPI - in this case call julia using mpirun
, etc. as usual but do not pass the -p
argument. Mixing MPI and @distributed
would cause oversubscription and slow everything down. The runs will run one after the other, and each run will be MPI parallelised.
The inputs (see moment_kinetics.parameter_scans.get_scan_inputs
) can be passed to the function in a Dict, or read from a TOML file.
run_parameter_scan
can also be passed a directory (either as an argument to the function or from the command line), in which case it will perform a run for every input file contained in that directory.
Post processing a scan
makie_post_processing.makie_post_process
can be called for each run in a scan. For example to post process the scan in runs/scan_example
from the REPL
$ julia -p 8 --project -O3
julia> include("post_process_parameter_scan.jl")
julia> post_process_parameter_scan("runs/scan_example/")
or to from the command line
$ julia -p 8 --project -O3 post_process_parameter_scan.jl runs/scan_example/
Again the -p 8
argument passed to julia in these examples is optional. It indicates that julia should use 8 processes for parallelism. Each run in the scan is post-processed in serial, but up to 8 (in this example) runs from the scan can be post-processed simultaneously (using the @distributed
macro).
API
moment_kinetics.parameter_scans.generate_scan_input_files
— Functiongenerate_scan_input_files(filename::AbstractString, dirname=nothing)
Read inputs for a scan from a TOML file and call generate_scan_input_files(scan_input::AbstractDict, dirname::AbstractString)
.
By default, dirname
will be set to filename
with the .toml
extension removed.
moment_kinetics.parameter_scans.generate_scan_input_files
— Methodgenerate_scan_input_files(scan_input::AbstractDict, dirname::AbstractString)
Generate individual input files for each run in the scan specified by scan_input
, saving the generated files in dirname
Inputs are generated by calling get_scan_inputs(scan_inputs::AbstractDict)
.
moment_kinetics.parameter_scans.get_scan_inputs
— Methodget_scan_inputs(scan_inputs::AbstractDict)
Make a set of inputs for a parameter scan.
scan_inputs
is like a Dict of inputs for run_moment_kinetics
, except that any value may be an array instead of a scalar. The values passed as arrays will be combined as follows.
A special, extra, setting combine_outer
can be passed, with the names of options to combine using an 'outer product'
By default, inputs are combined with an 'inner product', i.e. inputs a,b,c are combined as (a[1],b[1],c[1]), (a[2],b[2],c[2]), etc. Any inputs named in 'combine_outer' are instead combined with an 'outer product', i.e. an entry is created for every value of those inputs combined with every combination of the other inputs.
Returns a Vector{OrderedDict}
whose entries are the input for a single run in the parameter scan.
moment_kinetics.parameter_scans.get_scan_inputs
— Methodget_scan_inputs(file_or_dir::AbstractString)
If file_or_dir
is a file, read input from it using TOML , and call get_scan_inputs(scan_inputs::AbstractDict)
.
If file_or_dir
is a directory, read input from all the .toml
files in the directory, returning the inputs as a Vector{OrderedDict}
.
moment_kinetics.parameter_scans.get_scan_inputs
— Methodget_scan_inputs()
Get input file name from command line options, and call get_scan_inputs(filename::AbstractString)