NVIDIA / AMGX

Distributed multigrid linear solver library on GPU
501 stars 143 forks source link

Cleaning up output from config parsing. #311

Closed marsaev closed 5 months ago

marsaev commented 5 months ago

Minor QOL improvement - clarifying error reports from config parsing output. Main cases: 1) File read error, will print an error like:

Error parsing config file: Error: Cannot read config file: file_not_exists.json

1) Config is parsable JSON. but error in configuration - stops trying to parse further, prints error like:

Variable 'srength_threshold' not registered
Error parsing config file: Error: Cannot import config from JSON file: bad_json.json

2) Config cannot be parsed as JSON, tries to parse as a legacy config. In case it errors out, it will print an error like:

Error parsing parameter string: Incorrect config entry (number of equal signs is not 1) :  "config_version": 2
Error parsing config file: Error: Can't parse either JSON or legacy config from file: bad_cfg.json
mattmartineau commented 5 months ago

Nice QoL, thank you! I tested on a few cases and LGTM