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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
import logging
import pytest
from parsl.executors.high_throughput.mpi_prefix_composer import (
compose_all,
compose_aprun_launch_cmd,
compose_mpiexec_launch_cmd,
compose_srun_launch_cmd,
)
from parsl.executors.high_throughput.mpi_resource_management import Scheduler
resource_spec = {"num_nodes": 2,
"num_ranks": 8,
"ranks_per_node": 4}
@pytest.mark.local
def test_srun_launch_cmd():
prefix_name, composed_prefix = compose_srun_launch_cmd(
resource_spec=resource_spec, node_hostnames=["node1", "node2"]
)
assert prefix_name == "PARSL_SRUN_PREFIX"
logging.warning(composed_prefix)
assert "None" not in composed_prefix
@pytest.mark.local
def test_aprun_launch_cmd():
prefix_name, composed_prefix = compose_aprun_launch_cmd(
resource_spec=resource_spec, node_hostnames=["node1", "node2"]
)
logging.warning(composed_prefix)
assert prefix_name == "PARSL_APRUN_PREFIX"
assert "None" not in composed_prefix
@pytest.mark.local
def test_mpiexec_launch_cmd():
prefix_name, composed_prefix = compose_mpiexec_launch_cmd(
resource_spec=resource_spec, node_hostnames=["node1", "node2"]
)
logging.warning(composed_prefix)
assert prefix_name == "PARSL_MPIEXEC_PREFIX"
assert "None" not in composed_prefix
@pytest.mark.local
def test_slurm_launch_cmd():
table = compose_all(
mpi_launcher="srun",
resource_spec=resource_spec,
node_hostnames=["NODE001", "NODE002"],
)
assert "PARSL_MPI_PREFIX" in table
assert "PARSL_SRUN_PREFIX" in table
@pytest.mark.local
def test_default_launch_cmd():
table = compose_all(
mpi_launcher="srun",
resource_spec=resource_spec,
node_hostnames=["NODE001", "NODE002"],
)
assert "PARSL_MPI_PREFIX" in table
assert "PARSL_SRUN_PREFIX" in table
assert table["PARSL_MPI_PREFIX"] == table["PARSL_SRUN_PREFIX"]
|