From 79fadbc439876e4118b6c8d946d85b966ed0a84e Mon Sep 17 00:00:00 2001 From: James Foucar Date: Thu, 5 Dec 2024 14:10:35 -0700 Subject: [PATCH] Fix bug in p3/shoc run_and_cmp The for loop the processes options was stopping too soon. I think maybe someone assumed that every option would have a value after it, but that is no longer true. Also, the -n (no-baseline) option conflicted with the nadv option for shoc, so I changed that to -l --- components/eamxx/src/physics/p3/tests/p3_run_and_cmp.cpp | 5 +---- .../eamxx/src/physics/shoc/tests/shoc_run_and_cmp.cpp | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/components/eamxx/src/physics/p3/tests/p3_run_and_cmp.cpp b/components/eamxx/src/physics/p3/tests/p3_run_and_cmp.cpp index 1f28173df8ee..a6bd3013ad1f 100644 --- a/components/eamxx/src/physics/p3/tests/p3_run_and_cmp.cpp +++ b/components/eamxx/src/physics/p3/tests/p3_run_and_cmp.cpp @@ -260,7 +260,7 @@ int main (int argc, char** argv) { std::string predict_nc = "both"; std::string prescribed_ccn = "both"; std::string baseline_fn; - for (int i = 1; i < argc-1; ++i) { + for (int i = 1; i < argc; ++i) { if (ekat::argv_matches(argv[i], "-g", "--generate")) { generate = true; no_baseline = false; } if (ekat::argv_matches(argv[i], "-c", "--compare")) { no_baseline = false; } if (ekat::argv_matches(argv[i], "-b", "--baseline-file")) { @@ -301,9 +301,6 @@ int main (int argc, char** argv) { expect_another_arg(i, argc); ++i; repeat = std::atoi(argv[i]); - if (repeat > 0) { - generate = true; - } } if (ekat::argv_matches(argv[i], "-pn", "--predict-nc")) { expect_another_arg(i, argc); diff --git a/components/eamxx/src/physics/shoc/tests/shoc_run_and_cmp.cpp b/components/eamxx/src/physics/shoc/tests/shoc_run_and_cmp.cpp index e055c0d34d9f..8c2313082e54 100644 --- a/components/eamxx/src/physics/shoc/tests/shoc_run_and_cmp.cpp +++ b/components/eamxx/src/physics/shoc/tests/shoc_run_and_cmp.cpp @@ -214,7 +214,7 @@ int main (int argc, char** argv) { " -i Number of columns(ncol). Default=8.\n" " -k Number of vertical levels. Default=72.\n" " -q Number of q tracers. Default=3.\n" - " -n Number of SHOC loops per timestep. Default=15.\n" + " -l Number of SHOC loops per timestep. Default=15.\n" " -r Number of repetitions, implies timing run (generate + no I/O). Default=0.\n"; return 1; @@ -231,7 +231,7 @@ int main (int argc, char** argv) { Int repeat = 0; std::string baseline_fn; std::string device; - for (int i = 1; i < argc-1; ++i) { + for (int i = 1; i < argc; ++i) { if (ekat::argv_matches(argv[i], "-g", "--generate")) { generate = true; no_baseline = false; } if (ekat::argv_matches(argv[i], "-c", "--compare")) { no_baseline = false; } if (ekat::argv_matches(argv[i], "-b", "--baseline-file")) { @@ -269,7 +269,7 @@ int main (int argc, char** argv) { ++i; num_qtracers = std::atoi(argv[i]); } - if (ekat::argv_matches(argv[i], "-n", "--nadv")) { + if (ekat::argv_matches(argv[i], "-l", "--nadv")) { expect_another_arg(i, argc); ++i; nadv = std::atoi(argv[i]);