Skip to content

Commit

Permalink
Merge branch 'jgfouca/fix_run_and_cmp' into master (PR #6805)
Browse files Browse the repository at this point in the history
Fix bug in p3/shoc run_and_cmp

The for loop that 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.

This PR should fix the nightly fails for shoc_run_and_cmp.

[BFB]

* origin/jgfouca/fix_run_and_cmp:
  Fix bug in p3/shoc run_and_cmp
  • Loading branch information
jgfouca committed Dec 5, 2024
2 parents 25a9e14 + 79fadbc commit f0aef17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions components/eamxx/src/physics/p3/tests/p3_run_and_cmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions components/eamxx/src/physics/shoc/tests/shoc_run_and_cmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ int main (int argc, char** argv) {
" -i <cols> Number of columns(ncol). Default=8.\n"
" -k <nlev> Number of vertical levels. Default=72.\n"
" -q <num_qtracers> Number of q tracers. Default=3.\n"
" -n <nadv> Number of SHOC loops per timestep. Default=15.\n"
" -l <nadv> Number of SHOC loops per timestep. Default=15.\n"
" -r <repeat> Number of repetitions, implies timing run (generate + no I/O). Default=0.\n";

return 1;
Expand All @@ -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")) {
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit f0aef17

Please sign in to comment.