File: test_bad_mpi_config.py

package info (click to toggle)
python-parsl 2025.01.13%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,072 kB
  • sloc: python: 23,817; makefile: 349; sh: 276; ansic: 45
file content (48 lines) | stat: -rw-r--r-- 1,320 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import pytest

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


@pytest.mark.local
def test_bad_launcher():
    """TypeError if a launcher other than SimpleLauncher is supplied"""

    for launcher in [SrunLauncher(), AprunLauncher()]:
        with pytest.raises(TypeError):
            Config(executors=[
                MPIExecutor(
                    provider=SlurmProvider(launcher=launcher),
                )
            ])


@pytest.mark.local
def test_bad_mpi_launcher():
    """ValueError if an unsupported mpi_launcher is specified"""

    with pytest.raises(ValueError):
        Config(executors=[
            MPIExecutor(
                mpi_launcher="bad_launcher",
                provider=SlurmProvider(launcher=SimpleLauncher()),
            )
        ])


@pytest.mark.local
@pytest.mark.parametrize(
    "mpi_launcher",
    ["srun", "aprun", "mpiexec"]
)
def test_correct_launcher_with_mpi_mode(mpi_launcher: str):
    """Confirm that SimpleLauncher works with mpi_mode"""

    executor = MPIExecutor(
        mpi_launcher=mpi_launcher,
        provider=SlurmProvider(launcher=SimpleLauncher()),
    )

    assert isinstance(executor.provider.launcher, SimpleLauncher)