Mondaic

salvus.flow.executors.executor_utils

salvus.flow.executors.executor_utils salvus flow executors executor_utils

Shared functionality for some of the sites.

Classes

MPIExecutionConfiguration

class MPIExecutionConfiguration(
    salvus.flow.utils.serialization_helpers.SerializationMixin
):
    def __init__(
        self,
        cores_per_simulation: int,
        threads_per_core: int = 1,
        mpirun_binary: pathlib.Path,
        salvus_binary: pathlib.Path,
        tmp_directory: pathlib.Path,
        use_gpus: bool,
        environment_variables: dict[str, str] | None = None,
        run_in_process: bool = False,
        target_memory_usage_in_percent: float | None = None,
    ): ...

Keeps track of the initial arguments passed to an objects and can later on serialize them to JSON document.

It will only consider whatever is passed in the init.

MPI execution configuration.

Parameters
  • cores_per_simulation int — The number of cores per simulation.
  • threads_per_core int — The number of threads per core.
  • mpirun_binary pathlib.Path — The mpirun binary to use.
  • salvus_binary pathlib.Path — The Salvus binary to use.
  • tmp_directory pathlib.Path — The temporary directory to use. Best use some local scratch system, e.g. a fast node-local storage.
  • use_gpus bool — Whether to use GPUs.
  • environment_variables dict[str, str] | None — Optional environment variables to set for the execution.
  • run_in_process bool — Whether to run Salvus in-process. (WIP right now).
  • target_memory_usage_in_percent float | None — Optional target memory usage in percent. If set, the memory_per_rank_in_MB will be set to the value that targets this memory usage.
Methods
from_json()
def from_json(d: builtins.dict) -> Any: ...

Recreate the object from a dictionary serialization of its initialization parameters.

Parameters
  • d builtins.dict — Dictionary containing its init parameters and a few other things.
Returns Any
to_json()
def to_json(
    self,
    external_file_hash: types = None,
    timer: types = None,
    log_to_logger: bool = False,
    comm: types = None,
) -> builtins.dict: ...

Serialize the object to a dictionary that can be written to JSON.

Parameters
  • external_file_hash types — Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.
  • timer types — Execution timer.
  • log_to_logger bool — Log timings to the logger.
  • comm types — MPI communicator, if any.
Returns builtins.dict

RemoteCommand

class RemoteCommand(builtins.object):
    def __init__(
        self, command: str, execute_with_mpi: bool, ranks: int | None = None
    ) -> None: ...

Represents a remote command.

Ranks should of course only be set if execute_with_mpi is True.

Parameters
  • command str — The command to be executed.,
  • execute_with_mpi bool — True if it should be run with MPI.
  • ranks int | None — How many ranks to execute with, if run with MPI.

SiteConfig

class SiteConfig(salvus.flow.utils.serialization_helpers.SerializationMixin):
    def __init__(
        self,
        site_name: str,
        ranks_per_job: salvus._core.types.int_ | None = None,
        wall_time_in_seconds_per_job: salvus._core.types.float_ | None = None,
        memory_per_rank_in_MB: salvus._core.types.float_ | None = None,
        max_events_per_job_submission: salvus._core.types.int_ = 0,
        verbosity: int = 0,
        skip_validation: bool = False,
    ): ...

Utility class to store job parameter for a run.

Parameters
  • site_name str — The site to run on.
  • ranks_per_job salvus._core.types.int_ | None — The number of ranks to run with. Defaults to the site’s configuration value.
  • wall_time_in_seconds_per_job salvus._core.types.float_ | None — The wall time in seconds if the site requires one.
  • memory_per_rank_in_MB salvus._core.types.float_ | None — Optional memory settings for the site.
  • max_events_per_job_submission salvus._core.types.int_ — Optional chunkwise job submission. If set to a positive number, simulations will be launched in chunks.
  • verbosity int — The verbosity level.
  • skip_validation bool — Skip validation of the site.
Attributes
ranks_per_job int

The number of ranks per job.

Methods
from_json()
def from_json(d: dict) -> SiteConfig: ...

Construct object from a JSON-serializable dictionary.

Parameters
  • d dict — JSON dictionary of the inverse problem.
Returns SiteConfig
to_json()
def to_json(self, skip_validation: bool | None = None) -> dict: ...

Serialize the object to dictionary that can be written to JSON. Optionally overwrite the validation strategy.

Parameters
  • skip_validation bool | None — Skip object validation prior to writing.
Returns dict

Used in tutorials