Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

ClimateMachine.init() should not parse process ARGS by default? #1167

@jakebolewski

Description

@jakebolewski

Description

Currently ClimateMachine parses command line arguments by default upon initialization: https://github.com/CliMA/ClimateMachine.jl/blob/master/src/Driver/Driver.jl#L212.

This has the side effect of exclusively claiming process global ARGS, which doesn't compose well when invoked in a programmatic / sub-procedure context (ex. it makes creating an alternative CLI program that invokes ClimateMachine awkward to write). One example of this behaviour is that it breaks running a subset of tests with the current test harness:

julia --project=@. -e 'using Pkg; Pkg.test(test_args=["Numerics"])

Starting tests for Numerics
Starting tests for Mesh
┌ Warning: Incompatibility detected between CUDA and LLVM 8.0+; disabling debug info emission for CUDA kernels
└ @ CUDAnative ~/.julia/packages/CUDAnative/hfulr/src/CUDAnative.jl:114
too many arguments
usage: <PROGRAM> [--disable-gpu] [--show-updates <interval>]
                 [--diagnostics <interval>] [--vtk <interval>]
                 [--monitor-timestep-duration <interval>]
                 [--monitor-courant-numbers <interval>]
                 [--checkpoint <interval>] [--checkpoint-keep-all]
                 [--checkpoint-at-end] [--checkpoint-dir <path>]
                 [--restart-from-num <number>] [--fix-rng-seed]
                 [--log-level <level>] [--output-dir <path>]
                 [--integration-testing]
ERROR: Package ClimateMachine errored during testing

Proposal

ClimateMachine.int() should be configured through keyword arguments and the public API should not depend on passing ArgParse data structures. Methods with overloads for simple cases like passing a dictionary of values could be added (ex. json / TOML processing). ClimateMachine.cli() would exhibit the current behaviour of parsing process ARGS and then internally invoking ClimateMachine.init().

For CLIMA Developers

  • This feature can be added (if it cannot be, explain why in a comment below -- lack of technical expertise, not relevant to the scope of this project, too ambitious)
  • There is a timeline for when this feature can be implemented
  • The feature has been (or will be) implemented (Please link the PR)

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions