Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #120 from keisukefukuda/fix-119-assert-fails-if-mp…
Browse files Browse the repository at this point in the history
…iexec-not-exist

Fix #119
  • Loading branch information
keisukefukuda committed Apr 27, 2019
2 parents 8d777b7 + 4f5e95d commit 12ab07f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion mpienv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ def add(self, target, name=None):
# target seems to be prefix
target = os.path.join(target, 'bin', 'mpiexec')

mpi = self.get_mpi_from_mpiexec(target)
try:
mpi = self.get_mpi_from_mpiexec(target)
except RuntimeError as e:
sys.stderr.write("Error: {}\n".format(e))
exit(1)

if isinstance(mpi, BrokenMPI):
sys.stderr.write("Cannot find MPI from {}. "
Expand Down
2 changes: 1 addition & 1 deletion mpienv/mpibase.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def lib_files(self):
def libexec_files(self):
assert False, "Must be overriden"

def _generate_exec_script(self, file_name, cmds, keep: bool):
def _generate_exec_script(self, file_name, cmds, keep):
with open(file_name, 'w') as f:
for shell in ['/bin/bash', '/bin/ash', '/bin/sh']:
if os.path.exists(shell):
Expand Down
5 changes: 4 additions & 1 deletion mpienv/openmpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ class OpenMPI(mpibase.MpiBase):
def __init__(self, mpiexec, conf, name=None):
# `mpiexec` might be 'mpiexec' or 'mpiexec.ompi'
mpicc = re.sub('mpiexec', 'mpicc', mpiexec)
assert os.path.exists(mpicc)

if not os.path.exists(mpicc):
raise RuntimeError("mpicc not found: {}".format(mpicc))

prefix = os.path.abspath(
os.path.join(os.path.dirname(mpiexec), os.path.pardir))
ompi_info = os.path.join(prefix, 'bin', 'ompi_info')
Expand Down

0 comments on commit 12ab07f

Please sign in to comment.