salvus.flow.executors.executor_utils
salvus.flow.executors.executor_utils salvus flow executors executor_utils Shared functionality for some of the sites.
Classes
MPIExecutionConfiguration
MPIExecutionConfigurationclass 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_simulationint — The number of cores per simulation.threads_per_coreint — The number of threads per core.mpirun_binarypathlib.Path — The mpirun binary to use.salvus_binarypathlib.Path — The Salvus binary to use.tmp_directorypathlib.Path — The temporary directory to use. Best use some local scratch system, e.g. a fast node-local storage.use_gpusbool — Whether to use GPUs.environment_variablesdict[str, str] | None — Optional environment variables to set for the execution.run_in_processbool — Whether to run Salvus in-process. (WIP right now).target_memory_usage_in_percentfloat | 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()
from_json()def from_json(d: builtins.dict) -> Any: ...Recreate the object from a dictionary serialization of its initialization parameters.
Parameters
dbuiltins.dict — Dictionary containing its init parameters and a few other things.
Returns Any
to_json()
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_hashtypes — 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.timertypes — Execution timer.log_to_loggerbool — Log timings to the logger.commtypes — MPI communicator, if any.
Returns builtins.dict
RemoteCommand
RemoteCommandclass 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
commandstr — The command to be executed.,execute_with_mpibool — True if it should be run with MPI.ranksint | None — How many ranks to execute with, if run with MPI.
SiteConfig
SiteConfigclass 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_namestr — The site to run on.ranks_per_jobsalvus._core.types.int_ | None — The number of ranks to run with. Defaults to the site’s configuration value.wall_time_in_seconds_per_jobsalvus._core.types.float_ | None — The wall time in seconds if the site requires one.memory_per_rank_in_MBsalvus._core.types.float_ | None — Optional memory settings for the site.max_events_per_job_submissionsalvus._core.types.int_ — Optional chunkwise job submission. If set to a positive number, simulations will be launched in chunks.verbosityint — The verbosity level.skip_validationbool — Skip validation of the site.
Attributes
ranks_per_job int
ranks_per_job intThe number of ranks per job.
Methods
from_json()
from_json()def from_json(d: dict) -> SiteConfig: ...Construct object from a JSON-serializable dictionary.
Parameters
ddict — JSON dictionary of the inverse problem.
Returns SiteConfig
to_json()
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_validationbool | None — Skip object validation prior to writing.
Returns dict