Simulation Controller module

Class diagram

digraph "classes_sim_con" {
rankdir=BT
charset="utf-8"
"DMT.core.data_frame.DataFrame" [color="black", fontcolor="black", label="DataFrame", shape="record", style="solid"];
"DMT.core.DutView" [color="black", fontcolor="black", label="DutView", shape="record", style="solid"];
"scp.SCPClient" [color="black", fontcolor="black", label="SCPClient", shape="record", style="solid"];
"paramiko.client.SSHClient" [color="black", fontcolor="black", label="SSHClient", shape="record", style="solid"];
"DMT.core.SimCon" [color="black", fontcolor="black", label="SimCon", shape="record", style="solid"];
"DMT.core.naming.SpecifierStr" [color="black", fontcolor="black", label="SpecifierStr", shape="record", style="solid"];
"DMT.core.Sweep" [color="black", fontcolor="black", label="Sweep", shape="record", style="solid"];
"DMT.core.sweep.SweepDef" [color="black", fontcolor="black", label="SweepDef", shape="record", style="solid"];
"DMT.core.data_frame.DataFrame" -> "DMT.core.Sweep" [arrowhead="diamond", arrowtail="none", fontcolor="darkgreen", label="df", style="solid"];
"DMT.core.naming.SpecifierStr" -> "DMT.core.sweep.SweepDef" [arrowhead="diamond", arrowtail="none", fontcolor="darkgreen", label="var_name", style="solid"];
"paramiko.client.SSHClient" -> "DMT.core.SimCon" [arrowhead="diamond", arrowtail="none", fontcolor="darkgreen", label="ssh_client", style="solid"];
"scp.SCPClient" -> "DMT.core.SimCon" [arrowhead="diamond", arrowtail="none", fontcolor="darkgreen", label="scp_client", style="solid"];
"DMT.core.sweep.SweepDef"  -> "DMT.core.Sweep" [arrowhead="diamond", arrowtail="none", fontcolor="darkgreen", label="sweepdefs", style="solid", taillabel="0..*"];
"DMT.core.Sweep"  -> "DMT.core.SimCon" [arrowhead="diamond", arrowtail="none", fontcolor="darkgreen", label="sim_list['sweep']", style="solid", taillabel="0..*"];
"DMT.core.DutView"  -> "DMT.core.SimCon" [arrowhead="diamond", arrowtail="none", fontcolor="darkgreen", label="sim_list['dut']", style="solid", taillabel="0..*"];
}

See the DutView documentation for available interfaces.

Sequenz for many simulations in parallel

Sequenz diagram for SimCon

This Sequenz diagram shows how to use SimCon to run many simulations in parallel.

sim_con Module documentation

This module supplies a class to manage all simulations, regardless of the device simulator.

It works together with the DutView class, which is the subclass of all device simulators. Features:

  • Manages all simulations in a unified way, independent of the actual simulation backend.

  • Supports to run simulations on multiple cores in parallel

  • Supports to run simulations on a remote server (including file up- and download)

Author: Mario Krattenmacher | mario.krattenmacher@semimod.de Author: Markus Müller | markus.mueller@semimod.de

class DMT.core.sim_con.SimCon(*args, **kwargs)[source]

Bases: object

Simulation controller class. SINGLETON design pattern.

Parameters:
n_coreint

Number of cores that shall be used for simulations.

t_maxfloat

Timeout for simulations. If a simulation runs longer than t_max in seconds, it is killed.

Attributes:
n_coreint

Number of cores that shall be used for simulations.

t_maxfloat

Timeout for simulations. If a simulation runs longer than t_max in seconds, it is killed.

sim_list[{‘dut’: DutView, ‘sweep’: Sweep}]

A list of dicts containing the queued simulations. Each dict holds a ‘dut’ key value pair and a ‘sweep’ key value pair.

ssh_client

Client to execute SSH commands on a remote server.

scp_client

Client to transfer files to a remote server via SCP.

append_simulation(dut: List[DutView] | DutView | None = None, sweep: List[Sweep] | Sweep | None = None)[source]

Adds DutViews together with Sweeps to the list of simulations sim_list.

This methods adds each dut with a copy of each sweep to the simulation list.

Parameters:
dutDutView or [DutView]

Objected of a subclass of DutView. This object describes the device to be simulated and specifies the backend.

sweepSweep or [Sweep]

Definition of the sweep to be performed on the DUT according to the Sweep class.

clear_sim_list()[source]

Remove everything from the sim_list

close_ssh_client()[source]

Closes the ssh connection again.

copy_from_server(dut, sweep, zip_result=True)[source]

Collects the simulation data from the server.

Parameters:
dutDutView
sweepSweep
zip_resultbool, optional

If True, the result is zipped before transfer, the zip is copied and then unzipped locally.

copy_log_from_server(dut, sweep)[source]

Collects the simulation log file from the server.

Parameters:
dutDutView
sweepSweep
copy_zip_to_server(sims_to_zip)[source]

Copies the simulation data to the server. Before doing this, old simulation data is deleted

Parameters:
sims_to_ziplist[dict]

A list of dictionaries with 2 keys: dut : DutView sweep : Sweep

create_ssh_client()[source]

Creates the clients to communicate with the server.

run_and_read(force=False, remove_simulations=False, parallel_read=False)[source]

Run all queued simulations and load the results into the Duts’ databases.

Parameters:
forcebool, optional

If True, the simulations will be run and saved back. If False, the simulations will only be run if that has not already been done before. This is ensured using the hash system., by default False

remove_simulationsbool, optional

If True, the simulation results will be deleted after read in, by default False. Activate to save disk space.

parallel_readbool, optional

If True, the simulation results are read in using joblib parallel, by default False. Is False because some simulators have issues with this…

Returns:
all_sims_successbool

True, if no simulation failed. This means it is also true if no simulation was run at all.

run_simsbool

True, if any simulation was started. False if all simulations were read from hard disk.

run_simulation_local(dut, sweep)[source]

Starts the simulation

Parameters:
dutDutView
sweepSweep
run_simulation_remote(dut, sweep, pbs=False)[source]

Starts the remote simulation

Parameters:
dutDutView
sweepSweep
pbsBoolean
Returns:
pidint

0 if failed, -1 if running via ssh directly and id of job for PBS simulation.

run_simulations(sim_list)[source]

Runs all given simulations in parallel.

Parameters:
sim_list[{}]

List of dictionaries, each dictionary has a ‘dut’: DutView` and ‘sweep’: Sweep` key value pair.

Returns:
successlist[process]

List of finished processes

DMT.core.sim_con.upload_progress(filename, size, sent)[source]

Callback function for Paramiko SCP Client while uploading files.