Skip to content

Commit

Permalink
remove mvapich run option as its no longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
Jo Basevi committed Jul 30, 2023
1 parent 9f15fd0 commit adba4bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ MANIFEST
/docs/_build
.coverage
.ipynb_checkpoints
.vscode
9 changes: 3 additions & 6 deletions payu/envmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,12 @@ def lib_update(bin_path, lib_name):
slibs = ldd_output.split('\n')

for lib_entry in slibs:
if lib_name in lib_entry:
if lib_name in lib_entry and 'spack' not in lib_entry:
# Only load enviroment modules available - assuming spack built libs includes 'spack' in full path of library
lib_path = lib_entry.split()[2]

# pylint: disable=unbalanced-tuple-unpacking
mod_name, mod_version = fsops.splitpath(lib_path)[2:4]

module('unload', mod_name)
module('load', os.path.join(mod_name, mod_version))
return '{0}/{1}'.format(mod_name, mod_version)

# If there are no libraries, return an empty string
return ''
module('load', os.path.join(mod_name, mod_version))
29 changes: 6 additions & 23 deletions payu/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,24 +514,18 @@ def run(self, *user_flags):
# Update MPI library module (if not explicitly set)
# TODO: Check for MPI library mismatch across multiple binaries
if mpi_module is None:
mpi_module = envmod.lib_update(
envmod.lib_update(
model.exec_path_local,
'libmpi.so'
)

model_prog = []

# Our MVAPICH wrapper does not support working directories
if mpi_module is not None and mpi_module.startswith('mvapich'):
curdir = os.getcwd()
os.chdir(self.work_path)
else:
curdir = None
wdir_arg = '-wdir'
if self.config.get('scheduler') == 'slurm':
# Slurm's launcher controls the working directory
wdir_arg = '--chdir'
model_prog.append(f'{wdir_arg} {model.work_path}')
wdir_arg = '-wdir'
if self.config.get('scheduler') == 'slurm':
# Slurm's launcher controls the working directory
wdir_arg = '--chdir'
model_prog.append(f'{wdir_arg} {model.work_path}')

# Append any model-specific MPI flags
model_flags = model.config.get('mpiflags', [])
Expand Down Expand Up @@ -595,13 +589,6 @@ def run(self, *user_flags):
if self.config.get('coredump', False):
enable_core_dump()

# Our MVAPICH wrapper does not support working directories
if mpi_module.startswith('mvapich'):
curdir = os.getcwd()
os.chdir(self.work_path)
else:
curdir = None

# Dump out environment
with open(self.env_fname, 'w') as file:
file.write(yaml.dump(dict(os.environ), default_flow_style=False))
Expand All @@ -622,10 +609,6 @@ def run(self, *user_flags):
else:
rc = sp.call(shlex.split(cmd), stdout=f_out, stderr=f_err)

# Return to control directory
if curdir:
os.chdir(curdir)

f_out.close()
f_err.close()

Expand Down

0 comments on commit adba4bd

Please sign in to comment.