diff --git a/docs/flow/unidist/config.rst b/docs/flow/unidist/config.rst index 5b623f52..5992e73f 100644 --- a/docs/flow/unidist/config.rst +++ b/docs/flow/unidist/config.rst @@ -48,7 +48,7 @@ Unidist Configuration Settings List +-------------------------------+-------------------------------------------+--------------------------------------------------------------------------+ | DaskSchedulerAddress | UNIDIST_DASK_SCHEDULER_ADDRESS | Dask Scheduler address to connect to when running in Dask cluster | +-------------------------------+-------------------------------------------+--------------------------------------------------------------------------+ -| IsMpiSpawnWorkers | UNIDIST_IS_MPI_SPAWN_WORKERS | Whether to enable MPI spawn or not | +| MpiSpawn | UNIDIST_MPI_SPAWN | Whether to enable MPI spawn or not | +-------------------------------+-------------------------------------------+--------------------------------------------------------------------------+ | MpiHosts | UNIDIST_MPI_HOSTS | MPI hosts to run unidist on | +-------------------------------+-------------------------------------------+--------------------------------------------------------------------------+ diff --git a/docs/using_unidist/unidist_on_mpi.rst b/docs/using_unidist/unidist_on_mpi.rst index 95840ce6..a37de607 100644 --- a/docs/using_unidist/unidist_on_mpi.rst +++ b/docs/using_unidist/unidist_on_mpi.rst @@ -72,25 +72,25 @@ SPMD model ---------- First of all, to run unidist on MPI in a single node using `SPMD model`_, -you should set the ``UNIDIST_IS_MPI_SPAWN_WORKERS`` environment variable to ``False``: +you should set the ``UNIDIST_MPI_SPAWN`` environment variable to ``False``: .. code-block:: bash - $ export UNIDIST_IS_MPI_SPAWN_WORKERS=False + $ export UNIDIST_MPI_SPAWN=False .. code-block:: python import os - os.environ["UNIDIST_IS_MPI_SPAWN_WORKERS"] = "False" + os.environ["UNIDIST_MPI_SPAWN"] = "False" or set the associated configuration value: .. code-block:: python - from unidist.config import IsMpiSpawnWorkers + from unidist.config import MpiSpawn - IsMpiSpawnWorkers.put(False) + MpiSpawn.put(False) This will enable unidist not to spawn MPI processes dynamically because the user himself spawns the processes. @@ -169,25 +169,25 @@ SPMD model """""""""" First of all, to run unidist on MPI in a cluster using `SPMD model`_, -you should set the ``UNIDIST_IS_MPI_SPAWN_WORKERS`` environment variable to ``False``: +you should set the ``UNIDIST_MPI_SPAWN`` environment variable to ``False``: .. code-block:: bash - $ export UNIDIST_IS_MPI_SPAWN_WORKERS=False + $ export UNIDIST_MPI_SPAWN=False .. code-block:: python import os - os.environ["UNIDIST_IS_MPI_SPAWN_WORKERS"] = "False" + os.environ["UNIDIST_MPI_SPAWN"] = "False" or set the associated configuration value: .. code-block:: python - from unidist.config import IsMpiSpawnWorkers + from unidist.config import MpiSpawn - IsMpiSpawnWorkers.put(False) + MpiSpawn.put(False) This will enable unidist not to spawn MPI processes dynamically because the user himself spawns the processes. diff --git a/unidist/config/__init__.py b/unidist/config/__init__.py index cb6ae4f2..ae055ae3 100644 --- a/unidist/config/__init__.py +++ b/unidist/config/__init__.py @@ -14,7 +14,7 @@ ) from .backends.dask import DaskMemoryLimit, IsDaskCluster, DaskSchedulerAddress from .backends.mpi import ( - IsMpiSpawnWorkers, + MpiSpawn, MpiHosts, MpiPickleThreshold, MpiBackoff, @@ -38,7 +38,7 @@ "DaskMemoryLimit", "IsDaskCluster", "DaskSchedulerAddress", - "IsMpiSpawnWorkers", + "MpiSpawn", "MpiHosts", "ValueSource", "MpiPickleThreshold", diff --git a/unidist/config/backends/mpi/__init__.py b/unidist/config/backends/mpi/__init__.py index 8e42caf7..3cf11ac1 100644 --- a/unidist/config/backends/mpi/__init__.py +++ b/unidist/config/backends/mpi/__init__.py @@ -5,7 +5,7 @@ """Config entities specific for MPI backend which can be used for unidist behavior tuning.""" from .envvars import ( - IsMpiSpawnWorkers, + MpiSpawn, MpiHosts, MpiPickleThreshold, MpiBackoff, @@ -18,7 +18,7 @@ ) __all__ = [ - "IsMpiSpawnWorkers", + "MpiSpawn", "MpiHosts", "MpiPickleThreshold", "MpiBackoff", diff --git a/unidist/config/backends/mpi/envvars.py b/unidist/config/backends/mpi/envvars.py index b5c08fc2..417cfa7e 100644 --- a/unidist/config/backends/mpi/envvars.py +++ b/unidist/config/backends/mpi/envvars.py @@ -7,11 +7,11 @@ from unidist.config.parameter import EnvironmentVariable, ExactStr -class IsMpiSpawnWorkers(EnvironmentVariable, type=bool): +class MpiSpawn(EnvironmentVariable, type=bool): """Whether to enable MPI spawn or not.""" default = True - varname = "UNIDIST_IS_MPI_SPAWN_WORKERS" + varname = "UNIDIST_MPI_SPAWN" class MpiHosts(EnvironmentVariable, type=ExactStr): diff --git a/unidist/core/backends/mpi/core/common.py b/unidist/core/backends/mpi/core/common.py index 40abfa75..2bb8af80 100755 --- a/unidist/core/backends/mpi/core/common.py +++ b/unidist/core/backends/mpi/core/common.py @@ -8,7 +8,7 @@ import inspect import weakref -from unidist.config.backends.mpi.envvars import IsMpiSpawnWorkers +from unidist.config.backends.mpi.envvars import MpiSpawn from unidist.core.backends.mpi.utils import ImmutableDict try: @@ -485,7 +485,7 @@ def is_shared_memory_supported(): # Mpich shared memory does not work with spawned processes prior to version 4.2.0. if ( "MPICH" in MPI.Get_library_version() - and IsMpiSpawnWorkers.get() + and MpiSpawn.get() and not check_mpich_version("4.2.0") ): return False diff --git a/unidist/core/backends/mpi/core/communication.py b/unidist/core/backends/mpi/core/communication.py index 11e48dd5..2ed24c86 100755 --- a/unidist/core/backends/mpi/core/communication.py +++ b/unidist/core/backends/mpi/core/communication.py @@ -23,7 +23,7 @@ deserialize_complex_data, ) import unidist.core.backends.mpi.core.common as common -from unidist.config.backends.mpi.envvars import IsMpiSpawnWorkers, MpiHosts +from unidist.config.backends.mpi.envvars import MpiSpawn, MpiHosts # TODO: Find a way to move this after all imports mpi4py.rc(recv_mprobe=False, initialize=False) @@ -132,7 +132,7 @@ def __init__(self, comm): self.host_by_rank[global_rank] = host mpi_hosts = MpiHosts.get() - if mpi_hosts is not None and IsMpiSpawnWorkers.get(): + if mpi_hosts is not None and MpiSpawn.get(): host_list = mpi_hosts.split(",") host_count = len(host_list) diff --git a/unidist/core/backends/mpi/core/controller/api.py b/unidist/core/backends/mpi/core/controller/api.py index d6518146..e573aafd 100644 --- a/unidist/core/backends/mpi/core/controller/api.py +++ b/unidist/core/backends/mpi/core/controller/api.py @@ -34,7 +34,7 @@ from unidist.core.backends.mpi.core.async_operations import AsyncOperations from unidist.config import ( CpuCount, - IsMpiSpawnWorkers, + MpiSpawn, MpiHosts, ValueSource, MpiPickleThreshold, @@ -145,7 +145,7 @@ def init(): # Path to dynamically spawn MPI processes. # If a requirement is not met, processes have been started with mpiexec -n , where N > 1. - if rank == 0 and parent_comm == MPI.COMM_NULL and IsMpiSpawnWorkers.get(): + if rank == 0 and parent_comm == MPI.COMM_NULL and MpiSpawn.get(): args = _get_py_flags() args += ["-c"] py_str = [ @@ -153,8 +153,8 @@ def init(): "import unidist.config as cfg", "cfg.Backend.put('mpi')", ] - if IsMpiSpawnWorkers.get_value_source() != ValueSource.DEFAULT: - py_str += [f"cfg.IsMpiSpawnWorkers.put({IsMpiSpawnWorkers.get()})"] + if MpiSpawn.get_value_source() != ValueSource.DEFAULT: + py_str += [f"cfg.MpiSpawn.put({MpiSpawn.get()})"] if MpiHosts.get_value_source() != ValueSource.DEFAULT: py_str += [f"cfg.MpiHosts.put('{MpiHosts.get()}')"] if CpuCount.get_value_source() != ValueSource.DEFAULT: @@ -272,7 +272,7 @@ def init(): # If the user executes a program in SPMD mode, # we do not want workers to continue the flow after `unidist.init()` # so just killing them. - if not IsMpiSpawnWorkers.get(): + if not MpiSpawn.get(): sys.exit() return else: @@ -282,7 +282,7 @@ def init(): # If the user executes a program in SPMD mode, # we do not want workers to continue the flow after `unidist.init()` # so just killing them. - if not IsMpiSpawnWorkers.get(): + if not MpiSpawn.get(): sys.exit() return