From 2f7a375ce21aeee3eb7042ab0f5adbffe653c0cf Mon Sep 17 00:00:00 2001 From: Maciej Waruszewski Date: Thu, 5 Dec 2024 12:26:49 -0700 Subject: [PATCH 1/5] Change NVertLevels in time stepper test config --- .../test/timeStepping/TimeStepperTest.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/components/omega/test/timeStepping/TimeStepperTest.cpp b/components/omega/test/timeStepping/TimeStepperTest.cpp index ad2ba27a2357..7b8bc1ca1517 100644 --- a/components/omega/test/timeStepping/TimeStepperTest.cpp +++ b/components/omega/test/timeStepping/TimeStepperTest.cpp @@ -151,13 +151,27 @@ int initTimeStepperTest(const std::string &mesh) { initLogging(DefEnv); // Open config file - OMEGA::Config("Omega"); - Err = OMEGA::Config::readAll("omega.yml"); + Config("Omega"); + Err = Config::readAll("omega.yml"); if (Err != 0) { LOG_CRITICAL("TimeStepperTest: Error reading config file"); return Err; } + // Reset NVertLevels to 1 regardless of config value + Config *OmegaConfig = Config::getOmegaConfig(); + Config DimConfig("Dimension"); + Err = OmegaConfig->get(DimConfig); + if (Err != 0) { + LOG_CRITICAL("TimeStepperTest: Dimension group not found in Config"); + return Err; + } + Err = DimConfig.set("NVertLevels", NVertLevels); + if (Err != 0) { + LOG_CRITICAL("TimeStepperTest: Unable to reset NVertLevels in Config"); + return Err; + } + // Note that the default time stepper is not used in subsequent tests // but is initialized here because the number of time levels is needed // to initialize the Tracers. If a later timestepper test uses more time From 19b0249129bc793ef3a1b8960867641745c78569 Mon Sep 17 00:00:00 2001 From: Maciej Waruszewski Date: Thu, 5 Dec 2024 12:36:36 -0700 Subject: [PATCH 2/5] Init default auxstate in time stepper test --- components/omega/test/timeStepping/TimeStepperTest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/omega/test/timeStepping/TimeStepperTest.cpp b/components/omega/test/timeStepping/TimeStepperTest.cpp index 7b8bc1ca1517..6145bb47725b 100644 --- a/components/omega/test/timeStepping/TimeStepperTest.cpp +++ b/components/omega/test/timeStepping/TimeStepperTest.cpp @@ -212,6 +212,12 @@ int initTimeStepperTest(const std::string &mesh) { LOG_ERROR("TimeStepperTest: error initializing tracers infrastructure"); } + int AuxStateErr = AuxiliaryState::init(); + if (AuxStateErr != 0) { + Err++; + LOG_ERROR("TimeStepperTest: error initializing default aux state"); + } + Err = Tendencies::init(); if (Err != 0) { LOG_CRITICAL("Error initializing default tendencies"); From 451bb7fbbbe9ee4426d237c1e4b572ec76adfcf5 Mon Sep 17 00:00:00 2001 From: Maciej Waruszewski Date: Thu, 5 Dec 2024 12:37:59 -0700 Subject: [PATCH 3/5] Create vert dim earlier in time stepper test --- components/omega/test/timeStepping/TimeStepperTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/omega/test/timeStepping/TimeStepperTest.cpp b/components/omega/test/timeStepping/TimeStepperTest.cpp index 6145bb47725b..847acf33ee96 100644 --- a/components/omega/test/timeStepping/TimeStepperTest.cpp +++ b/components/omega/test/timeStepping/TimeStepperTest.cpp @@ -172,6 +172,9 @@ int initTimeStepperTest(const std::string &mesh) { return Err; } + // Horz dimensions will be created in HorzMesh + auto VertDim = Dimension::create("NVertLevels", NVertLevels); + // Note that the default time stepper is not used in subsequent tests // but is initialized here because the number of time levels is needed // to initialize the Tracers. If a later timestepper test uses more time @@ -243,9 +246,6 @@ int initTimeStepperTest(const std::string &mesh) { auto *DefMesh = HorzMesh::getDefault(); auto *DefHalo = Halo::getDefault(); - // Horz dimensions created in HorzMesh - auto VertDim = Dimension::create("NVertLevels", NVertLevels); - int NTracers = Tracers::getNumTracers(); const int NTimeLevels = 2; auto *TestOceanState = OceanState::create("TestState", DefMesh, DefHalo, From 9cb31d73dc683778e3118886f1cc46397d2a37fe Mon Sep 17 00:00:00 2001 From: Maciej Waruszewski Date: Thu, 5 Dec 2024 12:41:47 -0700 Subject: [PATCH 4/5] Append time stepper name to provis state in RK4 stepper --- components/omega/src/timeStepping/RungeKutta4Stepper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/omega/src/timeStepping/RungeKutta4Stepper.cpp b/components/omega/src/timeStepping/RungeKutta4Stepper.cpp index 135b2e6995ae..f4d62c6d869b 100644 --- a/components/omega/src/timeStepping/RungeKutta4Stepper.cpp +++ b/components/omega/src/timeStepping/RungeKutta4Stepper.cpp @@ -53,8 +53,8 @@ void RungeKutta4Stepper::finalizeInit() { int NCellsSize = Mesh->NCellsSize; int NTimeLevels = 1; // for provisional tracer - ProvisState = - OceanState::create("Provis", Mesh, MeshHalo, NVertLevels, NTimeLevels); + ProvisState = OceanState::create("Provis" + Name, Mesh, MeshHalo, + NVertLevels, NTimeLevels); if (!ProvisState) LOG_CRITICAL("Error creating Provis state"); From 7ce88caa50845d75b00db6ca4d04631f0b04bf7a Mon Sep 17 00:00:00 2001 From: Maciej Waruszewski Date: Fri, 6 Dec 2024 16:58:06 -0700 Subject: [PATCH 5/5] Do not return errors from pack/unpack functions --- components/omega/src/base/Halo.h | 46 +++++++------------------------- 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/components/omega/src/base/Halo.h b/components/omega/src/base/Halo.h index 703c8d86bba3..a8011da62faf 100644 --- a/components/omega/src/base/Halo.h +++ b/components/omega/src/base/Halo.h @@ -273,11 +273,10 @@ class Halo { /// neighboring task and pack them into the proper send buffer for /// that Neighbor. template - typename std::enable_if_t::Is1D, int> + std::enable_if_t::Is1D> packBuffer(const T &Array, // 1D Kokkos array of any type const I4 CurNeighbor // current neighbor ) { - I4 Err = 0; OMEGA_SCOPE(LocList, Neighbors[CurNeighbor].SendLists[CurElem]); OMEGA_SCOPE(LocNeighbor, Neighbors[CurNeighbor]); @@ -301,16 +300,13 @@ class Halo { LocBuffH(IExch) = RVal; } } - - return Err; } template - typename std::enable_if_t::Is2D, int> + std::enable_if_t::Is2D> packBuffer(const T &Array, // 2D Kokkos array of any type const I4 CurNeighbor // current neighbor ) { - I4 Err = 0; OMEGA_SCOPE(LocList, Neighbors[CurNeighbor].SendLists[CurElem]); OMEGA_SCOPE(LocNeighbor, Neighbors[CurNeighbor]); @@ -342,15 +338,13 @@ class Halo { } } } - return Err; } template - typename std::enable_if_t::Is3D, int> + std::enable_if_t::Is3D> packBuffer(const T &Array, // 3D Kokkos array of any type const I4 CurNeighbor // current neighbor ) { - I4 Err = 0; OMEGA_SCOPE(LocList, Neighbors[CurNeighbor].SendLists[CurElem]); OMEGA_SCOPE(LocNeighbor, Neighbors[CurNeighbor]); @@ -387,15 +381,13 @@ class Halo { } } } - return Err; } template - typename std::enable_if_t::Is4D, int> + std::enable_if_t::Is4D> packBuffer(const T &Array, // 4D Kokkos array of any type const I4 CurNeighbor // current neighbor ) { - I4 Err = 0; OMEGA_SCOPE(LocList, Neighbors[CurNeighbor].SendLists[CurElem]); OMEGA_SCOPE(LocNeighbor, Neighbors[CurNeighbor]); @@ -437,15 +429,13 @@ class Halo { } } } - return Err; } template - typename std::enable_if_t::Is5D, int> + std::enable_if_t::Is5D> packBuffer(const T &Array, // 5D Kokkos array of any type const I4 CurNeighbor // current neighbor ) { - I4 Err = 0; OMEGA_SCOPE(LocList, Neighbors[CurNeighbor].SendLists[CurElem]); OMEGA_SCOPE(LocNeighbor, Neighbors[CurNeighbor]); @@ -492,7 +482,6 @@ class Halo { } } } - return Err; } /// Buffer unpack specialized function templates for supported Kokkos array @@ -500,11 +489,10 @@ class Halo { /// elements of the proper receive buffer for that Neighbor into the /// corresponding halo elements of the input Array template - typename std::enable_if_t::Is1D, int> + std::enable_if_t::Is1D> unpackBuffer(const T &Array, // 1D Kokkos array of any type const I4 CurNeighbor // current neighbor ) { - I4 Err = 0; using ValType = typename T::non_const_value_type; @@ -527,16 +515,13 @@ class Halo { Array(IArr) = reinterpret_cast(LocBuffH(IExch)); } } - - return Err; } template - typename std::enable_if_t::Is2D, int> + std::enable_if_t::Is2D> unpackBuffer(const T &Array, // 2D Kokkos array of any type const I4 CurNeighbor // current neighbor ) { - I4 Err = 0; using ValType = typename T::non_const_value_type; @@ -566,16 +551,13 @@ class Halo { } } } - - return Err; } template - typename std::enable_if_t::Is3D, int> + std::enable_if_t::Is3D> unpackBuffer(const T &Array, // 3D Kokkos array of any type const I4 CurNeighbor // current neighbor ) { - I4 Err = 0; using ValType = typename T::non_const_value_type; @@ -611,16 +593,13 @@ class Halo { } } } - - return Err; } template - typename std::enable_if_t::Is4D, int> + std::enable_if_t::Is4D> unpackBuffer(const T &Array, // 4D Kokkos array of any type const I4 CurNeighbor // current neighbor ) { - I4 Err = 0; using ValType = typename T::non_const_value_type; @@ -662,16 +641,13 @@ class Halo { } } } - - return Err; } template - typename std::enable_if_t::Is5D, int> + std::enable_if_t::Is5D> unpackBuffer(const T &Array, // 5D Kokkos array of any type const I4 CurNeighbor // current neighbor ) { - I4 Err = 0; using ValType = typename T::non_const_value_type; @@ -718,8 +694,6 @@ class Halo { } } } - - return Err; } //---------------------------------------------------------------------------