Version:

salvus.flow.executors.executor_utils

salvus.flow.executors.executor_utils salvus flow executors executor_utils
Shared functionality for some of the sites.

Classes

MPIExecutionConfiguration

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.
SIGNATURE
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,
    ): ...
ARGUMENTS
Required
cores_per_simulation
Type:int
Description:
The number of cores per simulation.
Optional
threads_per_core
Type:int
Default value:1
Description:
The number of threads per core.
Required
mpirun_binary
Type:pathlib.Path
Description:
The mpirun binary to use.
Required
salvus_binary
Type:pathlib.Path
Description:
The Salvus binary to use.
Required
tmp_directory
Type:pathlib.Path
Description:
The temporary directory to use. Best use some local scratch system, e.g. a fast node-local storage.
Required
use_gpus
Type:bool
Description:
Whether to use GPUs.
Optional
environment_variables
Type:dict[str, str] | None
Default value:None
Description:
Optional environment variables to set for the execution.
Optional
run_in_process
Type:bool
Default value:False
Description:
Whether to run Salvus in-process. (WIP right now).
Optional
target_memory_usage_in_percent
Type:float | None
Default value:None
Description:
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.

Class Methods

MPIExecutionConfiguration.from_json()
Recreate the object from a dictionary serialization of its initialization parameters.
SIGNATURE
def from_json(d: builtins.dict) -> Any: ...
ARGUMENTS
Required
d
Type:builtins.dict
Description:
Dictionary containing its init parameters and a few other things.

Methods

MPIExecutionConfiguration.to_json()
Serialize the object to a dictionary that can be written to JSON.
SIGNATURE
def to_json(
    self,
    external_file_hash: types = None,
    timer: types = None,
    log_to_logger: bool = False,
    comm: types = None,
) -> builtins.dict: ...
ARGUMENTS
Optional
external_file_hash
Type:types
Default value:None
Description:
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.
Optional
timer
Type:types
Default value:None
Description:
Execution timer.
Optional
log_to_logger
Type:bool
Default value:False
Description:
Log timings to the logger.
Optional
comm
Type:types
Default value:None
Description:
MPI communicator, if any.

RemoteCommand

Represents a remote command.
Ranks should of course only be set if execute_with_mpi is True.
SIGNATURE
class RemoteCommand(builtins.object):
    def __init__(
        self, command: str, execute_with_mpi: bool, ranks: int | None = None
    ) -> None: ...
ARGUMENTS
Required
command
Type:str
Description:
The command to be executed.,
Required
execute_with_mpi
Type:bool
Description:
True if it should be run with MPI.
Optional
ranks
Type:int | None
Default value:None
Description:
How many ranks to execute with, if run with MPI.

SiteConfig

Utility class to store job parameter for a run.
SIGNATURE
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,
    ): ...
ARGUMENTS
Required
site_name
Type:str
Description:
The site to run on.
Optional
ranks_per_job
Type:salvus._core.types.int_ | None
Default value:None
Description:
The number of ranks to run with. Defaults to the site's configuration value.
Optional
wall_time_in_seconds_per_job
Type:salvus._core.types.float_ | None
Default value:None
Description:
The wall time in seconds if the site requires one.
Optional
memory_per_rank_in_MB
Type:salvus._core.types.float_ | None
Default value:None
Description:
Optional memory settings for the site.
Optional
max_events_per_job_submission
Type:salvus._core.types.int_
Default value:0
Description:
Optional chunkwise job submission. If set to a positive number, simulations will be launched in chunks.
Optional
verbosity
Type:int
Default value:0
Description:
The verbosity level.
Optional
skip_validation
Type:bool
Default value:False
Description:
Skip validation of the site.

Properties

  • ranks_per_job(int)-The number of ranks per job.

Class Methods

SiteConfig.from_json()
Construct object from a JSON-serializable dictionary.
SIGNATURE
def from_json(d: dict) -> SiteConfig: ...
ARGUMENTS
Required
d
Type:dict
Description:
JSON dictionary of the inverse problem.

Methods

SiteConfig.to_json()
Serialize the object to dictionary that can be written to JSON. Optionally overwrite the validation strategy.
SIGNATURE
def to_json(self, skip_validation: bool | None = None) -> dict: ...
ARGUMENTS
Optional
skip_validation
Type:bool | None
Default value:None
Description:
Skip object validation prior to writing.
PAGE CONTENTS