-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make perf config work without arguments
- Loading branch information
1 parent
d5bcde4
commit a1305a1
Showing
2 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using Test | ||
import ClimaAtmos as CA | ||
|
||
@testset "AtmosCoveragePerfConfig" begin | ||
# Just default config overridden by `default_perf.yml` | ||
config = CA.AtmosCoveragePerfConfig() | ||
# Test defaults overridden by `default_perf` | ||
@test config.parsed_args["dt"] == "1secs" | ||
# Test defaults not overridden by `default_perf` | ||
@test config.parsed_args["y_elem"] == 6 | ||
|
||
# Test with `target_job` | ||
config = CA.AtmosCoveragePerfConfig(; | ||
config_dict = Dict("target_job" => "sphere_baroclinic_wave_rhoe"), | ||
) | ||
# Target job config overridden by `default_perf` | ||
@test config.parsed_args["dt"] == "1secs" | ||
# Target job config not overridden by `default_perf` | ||
@test config.parsed_args["regression_test"] == true | ||
|
||
# Test that config_file overrides `default_perf` | ||
yaml_path = joinpath( | ||
@__DIR__, | ||
"..", | ||
"config", | ||
"model_configs", | ||
"edmf_soares_jfnk_imex.yml", | ||
) | ||
args_str = "--config_file " * yaml_path | ||
empty!(ARGS) | ||
append!(ARGS, split(args_str, " ")) | ||
config = CA.AtmosCoveragePerfConfig() | ||
@test config.parsed_args["dt"] == "50secs" | ||
@test config.parsed_args["turbconv_case"] == "Soares" | ||
|
||
empty!(ARGS) | ||
# Test that config_dict overrides `default_perf` | ||
config_dict = Dict("dt" => "50secs", "turbconv_case" => "GABLS") | ||
config = CA.AtmosCoveragePerfConfig(; config_dict) | ||
@test config.parsed_args["dt"] == "50secs" | ||
@test config.parsed_args["turbconv_case"] == "GABLS" | ||
|
||
# Test that `default_perf` overrides `target_job` | ||
config = CA.AtmosCoveragePerfConfig(; | ||
config_dict = Dict( | ||
"target_job" => "sphere_baroclinic_wave_rhoe", | ||
"turbconv_case" => "GABLS", | ||
), | ||
) | ||
# config_dict | ||
@test config.parsed_args["turbconv_case"] == "GABLS" | ||
# default_perf | ||
@test config.parsed_args["dt"] == "1secs" | ||
# target_job | ||
@test config.parsed_args["regression_test"] == true | ||
# defaults | ||
@test config.parsed_args["y_elem"] == 6 | ||
end |