Internal API of Output#

See also

Documentation on fluidsim:fluidsim_core.output.OutputCore which is the base class for snek5000.output.base.Output.

classmethod Output._complete_info_solver(info_solver)[source]#

Complete the info_solver instance with child class details (module and class names).

classmethod Output._set_info_solver_classes(classes)[source]#

Set the the classes for info_solver.classes.Output

static Output._complete_params_with_default(params, info_solver)[source]#

This static method is used to complete the params container.

Output._init_sim_repr_maker()[source]#

Adds mesh description to name of the simulation. Called by the _init_name_run method

Output._get_resources(package=None)[source]#

Get a generator of resources (files) in a package, excluding directories (subpackages).

Returns

generator

Output._get_subpackages()[source]#

Get a dictionary of subpackages with values generated by _get_resources().

Returns

dict

Output._save_info_solver_params_xml(replace=False)[source]#

Saves the par file, along with params_simul.xml and info_solver.xml

Class _Nek5000Make#

snek5000.output.base.Output.build_nek5000() relies on:

class snek5000.make._Nek5000Make[source]#

Snakemake interface to build Nek5000 tools and other dependencies. This class would prevent unnecessary rebuild of Nek5000 if there is no change in the compiler configuration.

path_run#

NEK_SOURCE_ROOT is the working directory

file#

The nek5000.smk Snakemake file from snek5000.resources is used here

lock#

A file lock nek5000_make_config.yml.lock used to prevent race conditions

config_cache#

A YAML file nek5000_make_config.yml to record compiler configuration

targets#

List of files to build

has_to_build(compiler_config)[source]#
build(config)[source]#

Build Nek5000 tools and third party libraries essential for a simulation.

Parameters

config (dict) – Snakemake configuration

Returns

True if workflow execution was successful.

Return type

bool

exec(*rules, set_resources=None, dryrun=False, keep_incomplete=True, nproc=None, **kwargs)#

Execute snakemake rules in sequence.

Parameters
  • rules (iterable of str, positional-only) – Snakemake rules to be executed. Default rule is “run”

  • set_resources (dict[str, int]) – Resources to override (see example below).

  • dryrun (bool) – Dry run snakemake rules without executing

  • keep_incomplete (bool) – Keep incomplete output files of failed jobs

  • nproc (Optional[int]) – Number of MPI processes

Notes

For more on available keyword arguments refer to Snakemake API documentation.

Returns

True if workflow execution was successful.

Return type

bool

Examples

>>> sim.make.exec('mesh', 'SESSION.NAME')
>>> sim.make.exec('compile')
>>> sim.make.exec('run', set_resources={'nproc': 4})
>>> sim.make.exec('run_fg', nproc=2)

It is also possible to do the same directly from command line by changing to the simulation directory and executing:

snek-make -h
snek-make compile
snakemake -j1 compile
snakemake -j1 --set-resources='run:nproc=4' run

The flag -j is short for --jobs and sets the number of threads available for snakemake rules to execute.

The list of the available target rules can be obtained with:

>>> sim.make.list()

or from command line with:

snek-make -l
snakemake --list-target-rules

See also

Useful Snakemake command line arguments

list(**kwargs)#

List rules.

Equivalent to:

snakemake --list-target-rules