Summary
On Gadi HPC, uw.Params does not apply CLI overrides (e.g. -uw_cellsize 1/16) even though arguments are correctly passed via sys.argv. This occurs because CLI options are not loaded into the PETSc options database (uw.options) before Params(...) is constructed. As a result, parameters silently fall back to defaults.
Repro
Run: python script.py -uw_cellsize 1/16
Code:
params = uw.Params(uw_cellsize=uw.Param("1/8", type=uw.ParamType.STRING))
print(params.uw_cellsize) → returns 1/8 (default, incorrect)
Observations
• sys.argv contains CLI arguments correctly
• uw.options.hasName("cellsize") == False on Gadi
• CLI values are ignored during Params initialization
• After calling uw.parse_cmd_line_options(), CLI values are correctly applied
• Behaviour differs from macOS where it works without explicit parsing
Root cause
Params reads CLI values from uw.options (PETSc options DB), not directly from sys.argv.
On Gadi, this database is not populated automatically before Params(...) is created, leading to missed overrides.
Fix / Workaround
Call uw.parse_cmd_line_options() before creating Params:
uw.parse_cmd_line_options()
params = uw.Params(...)
Impact
• Silent fallback to defaults (no warning)
• Incorrect results in batch/PBS workflows
• Hard-to-debug, environment-dependent behaviour
Suggested improvement
Automatically parse CLI options before Params(...), or clearly document this requirement.
Summary
On Gadi HPC,
uw.Paramsdoes not apply CLI overrides (e.g. -uw_cellsize 1/16) even though arguments are correctly passed viasys.argv. This occurs because CLI options are not loaded into the PETSc options database (uw.options) beforeParams(...)is constructed. As a result, parameters silently fall back to defaults.Repro
Run:
python script.py -uw_cellsize 1/16Code:
Observations
• sys.argv contains CLI arguments correctly
• uw.options.hasName("cellsize") == False on Gadi
• CLI values are ignored during Params initialization
• After calling uw.parse_cmd_line_options(), CLI values are correctly applied
• Behaviour differs from macOS where it works without explicit parsing
Root cause
Params reads CLI values from uw.options (PETSc options DB), not directly from sys.argv.
On Gadi, this database is not populated automatically before Params(...) is created, leading to missed overrides.
Fix / Workaround
Call uw.parse_cmd_line_options() before creating Params:
Impact
• Silent fallback to defaults (no warning)
• Incorrect results in batch/PBS workflows
• Hard-to-debug, environment-dependent behaviour
Suggested improvement
Automatically parse CLI options before Params(...), or clearly document this requirement.