Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling when no MPI found. #1514

Merged
merged 2 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions libensemble/executors/mpi_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,32 @@
information using the ``custom_info`` argument. This takes
a dictionary of values.

The allowable fields are::
The allowable fields are:

'mpi_runner' [string]:
Select runner: 'mpich', 'openmpi', 'aprun', 'srun', 'jsrun', 'custom'
All except 'custom' relate to runner classes in libEnsemble.
.. parsed-literal::

**'mpi_runner'** [string]:
Select runner: `'mpich'`, `'openmpi'`, `'aprun'`, `'srun'`, `'jsrun'`, `'custom'`
All except `'custom'` relate to runner classes in libEnsemble.
Custom allows user to define their own run-lines but without parsing
arguments or making use of auto-resources.
'runner_name' [string]:
Runner name: Replaces run command if present. All runners have a default
except for 'custom'.
'subgroup_launch' [bool]:
**'runner_name'** [string]:
The literal string that appears at the front of the run command.
This is typically 'mpirun', 'srun', etc., and can be a full path.
Defaults exist for all runners except 'custom'.
**'subgroup_launch'** [bool]:
Whether MPI runs should be initiated in a new process group. This needs
to be correct for kills to work correctly. Use the standalone test at
libensemble/tests/standalone_tests/kill_test to determine correct value
`libensemble/tests/standalone_tests/kill_test` to determine correct value
for a system.

For example::
For example::

customizer = {'mpi_runner': 'mpich',
'runner_name': 'wrapper -x mpich'}
customizer = {'mpi_runner': 'mpich',
'runner_name': 'wrapper -x mpich'}

from libensemble.executors.mpi_executor import MPIExecutor
exctr = MPIExecutor(custom_info=customizer)
from libensemble.executors.mpi_executor import MPIExecutor
exctr = MPIExecutor(custom_info=customizer)


"""
Expand Down Expand Up @@ -336,6 +339,9 @@
else:
mpi_runner_obj = self.mpi_runner_obj or self._create_mpi_runner_from_attr()

if env_script is None and mpi_runner_obj is None:
raise ExecutorException("No valid MPI runner was found")

Check warning on line 343 in libensemble/executors/mpi_executor.py

View check run for this annotation

Codecov / codecov/patch

libensemble/executors/mpi_executor.py#L343

Added line #L343 was not covered by tests

mpi_specs = mpi_runner_obj.get_mpi_specs(
task,
num_procs,
Expand Down
12 changes: 7 additions & 5 deletions libensemble/executors/mpi_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ def get_runner(mpi_runner_type, runner_name=None, platform_info=None):
"msmpi": MSMPI_MPIRunner,
"custom": MPIRunner,
}
mpi_runner = mpi_runners[mpi_runner_type]
if runner_name is not None:
runner = mpi_runner(run_command=runner_name, platform_info=platform_info)
else:
runner = mpi_runner(platform_info=platform_info)
runner = None
if mpi_runner_type is not None:
mpi_runner = mpi_runners[mpi_runner_type]
if runner_name is not None:
runner = mpi_runner(run_command=runner_name, platform_info=platform_info)
else:
runner = mpi_runner(platform_info=platform_info)
return runner

def __init__(self, run_command="mpiexec", platform_info=None):
Expand Down
Loading