Skip to content

Commit

Permalink
update documentation to include module use option
Browse files Browse the repository at this point in the history
  • Loading branch information
Jo Basevi committed Aug 3, 2023
1 parent 8b0c351 commit b9d9454
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
16 changes: 10 additions & 6 deletions docs/source/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,21 @@ Miscellaneous
is generally only used for testing purposes, such as bit reproducibility.

``modules``
Specify a list of environment modules to load at the start of the PBS job,
for example::
Defines options to specify lists of environment modules and/or directories
to load/use at the start of the PBS job, for example::

modules:
- netcdf-c-4.9.0
- parallel-netcdf-1.12.3
- xerces-c-3.2.3
use:
- /path/to/module/dir
load:
- netcdf-c-4.9.0
- parallel-netcdf-1.12.3
- xerces-c-3.2.3

This is seldom needed, because payu is good at automatically determining
the environment modules required by model executables. If the modules
require `module use` inorder to be found, do this prior to `payu run`,
require `module use` inorder to be found, this command can also be run
prior to `payu run` instead specifying the `use` option,
e.g.::

module use /path/to/module/directory
Expand Down
15 changes: 13 additions & 2 deletions test/test_payu.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,19 @@ def test_read_config():

assert(config.pop('collate') == {})
assert(config.pop('control_path') == os.getcwd())
assert(config.pop('modules') == {})
assert(config == {})

# Test transform legacy modules option
with open(config_tmp, 'w') as f:
f.write('modules:\n - test_user_defined_module')

config = payu.fsops.read_config(config_tmp)
modules_config = config.get('modules', {})

assert(modules_config.get('load', []) == ['test_user_defined_module'])
assert(modules_config.get('use', []) == [])

os.remove(config_tmp)


Expand Down Expand Up @@ -222,8 +233,8 @@ def test_parse_ldd_output():
with open(ldd_output_path, 'r') as f:
ldd_output = f.read()
required_libs = payu.fsops.parse_ldd_output(ldd_output)
assert(len(required_libs), 4)
assert(required_libs['libmpi.so.40'], '/apps/openmpi/4.0.2/lib/libmpi.so.40')
assert(len(required_libs) == 4)
assert(required_libs['libmpi.so.40'] == '/apps/openmpi/4.0.2/lib/libmpi.so.40')


def test_lib_update_lib_if_required():
Expand Down

0 comments on commit b9d9454

Please sign in to comment.