cape.cfdx.options.mpiopts: MPI command-line launch options

This module provides a class to access command-line options to explicitly launch MPI, usually using mpiexec or mpirun. It is used to form command prefixes like mpiexec -np 8 and add other options. Generic command-line options can be added using the "flags" entry in this section, which is a dict.

class cape.cfdx.options.mpiopts.MPIOpts(*args, **kw)

Class for MPI command-line settings

Call:
>>> opts = MPIOpts(**kw)
Inputs:
kw: dict

Dictionary of MPI command-line options

Outputs:
opts: MPIOpts

MPI options interface

Versions:
  • 2022-10-14 @ddalle: v1.0

get_mpi_args(j=None, i=None, **kw)

Get value of option “args”

Call:
>>> args = opts.get_mpi_args(j=None, i=None, **kw)
Inputs:
opts: MPIOpts

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
args: {None} | list[str]

value of option “args”

get_mpi_executable(j=None, i=None, **kw)

Get executable to launch MPI

Call:
>>> executable = opts.get_mpi_executable(j=None, i=None, **kw)
Inputs:
opts: MPIOpts

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
executable: {'mpiexec'} | str

executable to launch MPI

get_mpi_flags(j=None, i=None, **kw)

Get options to mpiexec using -flag val format

Call:
>>> flags = opts.get_mpi_flags(j=None, i=None, **kw)
Inputs:
opts: MPIOpts

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
flags: {None} | dict

options to mpiexec using -flag val format

get_mpi_np(j=None, i=None, **kw)

Get explicit number of MPI processes

Call:
>>> np = opts.get_mpi_np(j=None, i=None, **kw)
Inputs:
opts: MPIOpts

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
np: {None} | int

explicit number of MPI processes

get_mpi_perhost(j=None, i=None, **kw)

Get value of option “perhost”

Call:
>>> perhost = opts.get_mpi_perhost(j=None, i=None, **kw)
Inputs:
opts: MPIOpts

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
perhost: {None} | int

value of option “perhost”

set_mpi_args(v, j=None, mode=None)

Get value of option “args”

Call:
>>> opts.set_mpi_args(args, j=None, i=None, **kw)
Inputs:
opts: MPIOpts

options interface

args: {None} | list[str]

value of option “args”

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar

set_mpi_executable(v, j=None, mode=None)

Get executable to launch MPI

Call:
>>> opts.set_mpi_executable(executable, j=None, i=None, **kw)
Inputs:
opts: MPIOpts

options interface

executable: {'mpiexec'} | str

executable to launch MPI

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar

set_mpi_flags(v, j=None, mode=None)

Get options to mpiexec using -flag val format

Call:
>>> opts.set_mpi_flags(flags, j=None, i=None, **kw)
Inputs:
opts: MPIOpts

options interface

flags: {None} | dict

options to mpiexec using -flag val format

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar

set_mpi_np(v, j=None, mode=None)

Get explicit number of MPI processes

Call:
>>> opts.set_mpi_np(np, j=None, i=None, **kw)
Inputs:
opts: MPIOpts

options interface

np: {None} | int

explicit number of MPI processes

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar

set_mpi_perhost(v, j=None, mode=None)

Get value of option “perhost”

Call:
>>> opts.set_mpi_perhost(perhost, j=None, i=None, **kw)
Inputs:
opts: MPIOpts

options interface

perhost: {None} | int

value of option “perhost”

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar