Skip to content

Commit

Permalink
Replace SingleNodeLauncher with SimpleLauncher for MPI Mode (#3418)
Browse files Browse the repository at this point in the history
Corrects a problem in the MPI mode implementation of HTEx. SingleNodeLauncher creates too many workers when running in MPI mode because it launches multiple copies of the worker pool onto the head node.

We want SimpleLauncher, which (instead) launches a single copy of the worker pool.

Co-authored-by: Ben Clifford <benc@hawaga.org.uk>
  • Loading branch information
WardLT and benclifford committed May 16, 2024
1 parent ccea519 commit 3e4f101
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/userguide/mpi_apps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The broad strokes of a complete solution involves the following components:
2. Specify an MPI Launcher from one of the supported launchers ("aprun", "srun", "mpiexec") for the
:class:`~parsl.executors.high_throughput.executor.HighThroughputExecutor` with: ``mpi_launcher="srun"``
3. Specify the provider that matches your cluster, (eg. user ``SlurmProvider`` for Slurm clusters)
4. Set the non-mpi launcher to :class:`~parsl.launchers.SingleNodeLauncher`
4. Set the non-mpi launcher to :class:`~parsl.launchers.SimpleLauncher`
5. Specify resources required by the application via ``resource_specification`` as shown below:


Expand Down Expand Up @@ -54,7 +54,7 @@ Configuring the Provider

Parsl must be configured to deploy workers on exactly one node per block. This part is
simple. Instead of defining a launcher which will place an executor on each node in the
block, simply use the :class:`~parsl.launchers.SingleNodeLauncher`.
block, simply use the :class:`~parsl.launchers.SimpleLauncher`.
The MPI Launcher that the application will use is to be specified via ``HighThroughputExecutor(mpi_launcher="LAUNCHER")``

It is also necessary to specify the desired number of blocks for the executor.
Expand Down
4 changes: 2 additions & 2 deletions parsl/executors/high_throughput/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ def __init__(self,
assert mpi_launcher in VALID_LAUNCHERS, \
f"mpi_launcher must be set to one of {VALID_LAUNCHERS}"
if self.enable_mpi_mode:
assert isinstance(self.provider.launcher, parsl.launchers.SingleNodeLauncher), \
"mpi_mode requires the provider to be configured to use a SingleNodeLauncher"
assert isinstance(self.provider.launcher, parsl.launchers.SimpleLauncher), \
"mpi_mode requires the provider to be configured to use a SimpleLauncher"

self.mpi_launcher = mpi_launcher

Expand Down
20 changes: 6 additions & 14 deletions parsl/tests/test_mpi_apps/test_bad_mpi_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

from parsl import Config
from parsl.executors import HighThroughputExecutor
from parsl.launchers import SrunLauncher, SingleNodeLauncher, SimpleLauncher, AprunLauncher
from parsl.launchers import SrunLauncher, AprunLauncher, SimpleLauncher
from parsl.providers import SlurmProvider


@pytest.mark.local
def test_bad_launcher_with_mpi_mode():
"""AssertionError if a launcher other than SingleNodeLauncher is supplied"""
"""AssertionError if a launcher other than SimpleLauncher is supplied"""

for launcher in [SrunLauncher(), SimpleLauncher(), AprunLauncher()]:
for launcher in [SrunLauncher(), AprunLauncher()]:
with pytest.raises(AssertionError):
Config(executors=[
HighThroughputExecutor(
Expand All @@ -22,20 +22,12 @@ def test_bad_launcher_with_mpi_mode():

@pytest.mark.local
def test_correct_launcher_with_mpi_mode():
"""Confirm that SingleNodeLauncer works with mpi_mode"""
"""Confirm that SimpleLauncher works with mpi_mode"""

config = Config(executors=[
HighThroughputExecutor(
enable_mpi_mode=True,
provider=SlurmProvider(launcher=SingleNodeLauncher()),
provider=SlurmProvider(launcher=SimpleLauncher()),
)
])
assert isinstance(config.executors[0].provider.launcher, SingleNodeLauncher)

config = Config(executors=[
HighThroughputExecutor(
enable_mpi_mode=True,
provider=SlurmProvider(),
)
])
assert isinstance(config.executors[0].provider.launcher, SingleNodeLauncher)
assert isinstance(config.executors[0].provider.launcher, SimpleLauncher)

0 comments on commit 3e4f101

Please sign in to comment.