[RFC] EAMxx: Feedback regarding the EAMxx autoformatting workflow #7971
Replies: 14 comments
-
|
@mjschmidt271 how do you feel about dumping the diff in the printed message? so somewhere in this block (appears here: https://github.com/E3SM-Project/E3SM/actions/runs/17485575031?pr=7652) and somewhere in this logic too (here: https://github.com/E3SM-Project/E3SM/actions/runs/17485575031/job/49663790419?pr=7652#step:10:11) It can be a little better for quick fixes than downloading the patch etc. but I don't have strong opinion though... I like that message in the summary (https://github.com/E3SM-Project/E3SM/actions/runs/17485575031?pr=7652) very neat! |
Beta Was this translation helpful? Give feedback.
-
|
Another thought: let's name the uploaded artifacts file something else so that it is unique, otherwise, it will be hard to keep track of them if someone has multiple PRs. We can add the PR number and the sha number in the file name. Currently the file is called clang-format-patch.diff and so one would start seeing clang-format-patch 2.diff etc. |
Beta Was this translation helpful? Give feedback.
-
@mahf708 |
Beta Was this translation helpful? Give feedback.
-
|
Yes, I wonder if that markdown they have in there would support the but no problem if it doesn't work. No biggie! This is already great! |
Beta Was this translation helpful? Give feedback.
-
|
As to the name of the artifact file, I also noticed that and I'm surprised that it truncates the name like that on download because the artifact displays on the Actions page with the full name from here. |
Beta Was this translation helpful? Give feedback.
-
That's just the zip file, which looks good - name: upload diff patch
if: ${{ env.status_fail == 'true' }}
uses: actions/upload-artifact@v4
with:
name: clang-format-patch_${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}.diff
path: |
components/eamxx/clang-format-patch.diffWe want to also edit how we name "cland-format-patch.diff" file |
Beta Was this translation helpful? Give feedback.
-
|
@bartgol @mjschmidt271 is diff file only providing first ~200 lines of each file it is linting? See this example from a PR I am finalizing: Details
diff --git a/components/eamxx/src/diagnostics/aodvis.cpp b/components/eamxx/src/diagnostics/aodvis.cpp
index 3511e338d9..dc7d4e85fc 100644
--- a/components/eamxx/src/diagnostics/aodvis.cpp
+++ b/components/eamxx/src/diagnostics/aodvis.cpp
@@ -2,18 +2,20 @@
#include "share/util/eamxx_universal_constants.hpp"
-#include <ekat_team_policy_utils.hpp>
#include <ekat_reduction_utils.hpp>
+#include <ekat_team_policy_utils.hpp>
-namespace scream {
+namespace scream
+{
AODVis::AODVis(const ekat::Comm &comm, const ekat::ParameterList ¶ms)
- : AtmosphereDiagnostic(comm, params) {
+ : AtmosphereDiagnostic(comm, params)
+{
// Nothing to do here
}
-void AODVis::
-set_grids(const std::shared_ptr<const GridsManager> grids_manager)
+void
+AODVis::set_grids(const std::shared_ptr<const GridsManager> grids_manager)
{
using namespace ekat::units;
@@ -37,14 +39,17 @@ set_grids(const std::shared_ptr<const GridsManager> grids_manager)
FieldIdentifier fid(name(), scalar2d, nondim, grid_name);
m_diagnostic_output = Field(fid);
m_diagnostic_output.allocate_view();
-
}
-void AODVis::initialize_impl(const RunType /*run_type*/) {
+void
+AODVis::initialize_impl(const RunType /*run_type*/)
+{
m_diagnostic_output.get_header().set_extra_data("mask_field", get_field_in("sunlit_mask"));
}
-void AODVis::compute_diagnostic_impl() {
+void
+AODVis::compute_diagnostic_impl()
+{
using KT = KokkosTypes<DefaultDevice>;
using MT = typename KT::MemberType;
using TPF = ekat::TeamPolicyFactory<typename KT::ExeSpace>;
@@ -53,17 +58,15 @@ void AODVis::compute_diagnostic_impl() {
constexpr auto fill_value = constants::fill_value<Real>;
const auto aod = m_diagnostic_output.get_view<Real *>();
- const auto tau_vis = get_field_in("aero_tau_sw")
- .subfield(1, m_vis_bnd)
- .get_view<const Real **>();
- const auto sunlit = get_field_in("sunlit_mask").get_view<const Real *>();
+ const auto tau_vis = get_field_in("aero_tau_sw").subfield(1, m_vis_bnd).get_view<const Real **>();
+ const auto sunlit = get_field_in("sunlit_mask").get_view<const Real *>();
const auto num_levs = m_nlevs;
const auto policy = TPF::get_default_team_policy(m_ncols, m_nlevs);
Kokkos::parallel_for(
"Compute " + m_diagnostic_output.name(), policy, KOKKOS_LAMBDA(const MT &team) {
const int icol = team.league_rank();
- if(sunlit(icol) == 0.0) {
+ if (sunlit(icol) == 0.0) {
aod(icol) = fill_value;
} else {
auto tau_icol = ekat::subview(tau_vis, icol);
@@ -72,4 +75,4 @@ void AODVis::compute_diagnostic_impl() {
});
}
-} // namespace scream
+} // namespace scream
diff --git a/components/eamxx/src/diagnostics/tests/aodvis_test.cpp b/components/eamxx/src/diagnostics/tests/aodvis_test.cpp
index 66c0957c15..f0ebe88f5d 100644
--- a/components/eamxx/src/diagnostics/tests/aodvis_test.cpp
+++ b/components/eamxx/src/diagnostics/tests/aodvis_test.cpp
@@ -7,10 +7,12 @@
#include "share/util/eamxx_setup_random_test.hpp"
#include "share/util/eamxx_universal_constants.hpp"
-namespace scream {
+namespace scream
+{
-std::shared_ptr<GridsManager> create_gm(const ekat::Comm &comm, const int ncols,
- const int nlevs) {
+std::shared_ptr<GridsManager>
+create_gm(const ekat::Comm &comm, const int ncols, const int nlevs)
+{
const int num_global_cols = ncols * comm.size();
using vos_t = std::vector<std::string>;
@@ -28,7 +30,8 @@ std::shared_ptr<GridsManager> create_gm(const ekat::Comm &comm, const int ncols,
return gm;
}
-TEST_CASE("aodvis") {
+TEST_CASE("aodvis")
+{
using namespace ShortFieldTagsNames;
using namespace ekat::units;
@@ -53,10 +56,8 @@ TEST_CASE("aodvis") {
auto grid = gm->get_grid("physics");
// Input (randomized) tau
- FieldLayout scalar3d_swband_layout =
- grid->get_3d_vector_layout(true, nbnds, "swband");
- FieldIdentifier tau_fid("aero_tau_sw", scalar3d_swband_layout, nondim,
- grid->name());
+ FieldLayout scalar3d_swband_layout = grid->get_3d_vector_layout(true, nbnds, "swband");
+ FieldIdentifier tau_fid("aero_tau_sw", scalar3d_swband_layout, nondim, grid->name());
Field tau(tau_fid);
tau.allocate_view();
tau.get_header().get_tracking().update_time_stamp(t0);
@@ -78,7 +79,7 @@ TEST_CASE("aodvis") {
register_diagnostics();
constexpr int ntests = 5;
- for(int itest = 0; itest < ntests; ++itest) {
+ for (int itest = 0; itest < ntests; ++itest) {
// Randomize tau
randomize(tau, engine, pdf);
@@ -94,9 +95,9 @@ TEST_CASE("aodvis") {
diag->initialize(t0, RunType::Initial);
auto sun_h = sunlit.get_view<Real *, Host>();
- for(int icol = 0; icol < grid->get_num_local_dofs(); ++icol) {
+ for (int icol = 0; icol < grid->get_num_local_dofs(); ++icol) {
// zero out all sun_h if below 0.05
- if(sun_h(icol) < some_limit) {
+ if (sun_h(icol) < some_limit) {
sun_h(icol) = 0.0;
}
}
@@ -110,19 +111,19 @@ TEST_CASE("aodvis") {
tau.sync_to_host();
diag->get_diagnostic().sync_to_host();
- const auto tau_h = tau.get_view<const Real ***, Host>();
- const auto aod_hf = diag->get_diagnostic();
+ const auto tau_h = tau.get_view<const Real ***, Host>();
+ const auto aod_hf = diag->get_diagnostic();
const auto aod_mask = aod_hf.get_header().get_extra_data<Field>("mask_field");
Field aod_tf = diag->get_diagnostic().clone();
- auto aod_t = aod_tf.get_view<Real *, Host>();
+ auto aod_t = aod_tf.get_view<Real *, Host>();
- for(int icol = 0; icol < grid->get_num_local_dofs(); ++icol) {
- if(sun_h(icol) < some_limit) {
+ for (int icol = 0; icol < grid->get_num_local_dofs(); ++icol) {
+ if (sun_h(icol) < some_limit) {
aod_t(icol) = constants::fill_value<Real>;
} else {
aod_t(icol) = 0;
- for(int ilev = 0; ilev < nlevs; ++ilev) {
+ for (int ilev = 0; ilev < nlevs; ++ilev) {
aod_t(icol) += tau_h(icol, swvis, ilev);
}
}
@@ -131,7 +132,7 @@ TEST_CASE("aodvis") {
aod_tf.sync_to_dev();
// Workaround for non-bfb behavior of view_reduction() in release builds
- if(SCREAM_BFB_TESTING) {
+ if (SCREAM_BFB_TESTING) {
REQUIRE(views_are_equal(aod_hf, aod_tf));
}
// Ensure the masks are identical (should be pointing exactly to each other)
@@ -139,4 +140,4 @@ TEST_CASE("aodvis") {
}
}
-} // namespace scream
+} // namespace scream
diff --git a/components/eamxx/src/physics/cosp/eamxx_cosp.cpp b/components/eamxx/src/physics/cosp/eamxx_cosp.cpp
index 45ab9d8628..3361a1c240 100644
--- a/components/eamxx/src/physics/cosp/eamxx_cosp.cpp
+++ b/components/eamxx/src/physics/cosp/eamxx_cosp.cpp
@@ -1,9 +1,9 @@
#include "eamxx_cosp.hpp"
#include "cosp_functions.hpp"
#include "physics/share/physics_constants.hpp"
-#include "share/util/eamxx_universal_constants.hpp"
-#include "share/property_checks/field_within_interval_check.hpp"
#include "share/field/field_utils.hpp"
+#include "share/property_checks/field_within_interval_check.hpp"
+#include "share/util/eamxx_universal_constants.hpp"
#include <ekat_assert.hpp>
#include <ekat_units.hpp>
@@ -13,11 +13,11 @@
namespace scream
{
// =========================================================================================
-Cosp::Cosp (const ekat::Comm& comm, const ekat::ParameterList& params)
- : AtmosphereProcess(comm, params)
+Cosp::Cosp(const ekat::Comm &comm, const ekat::ParameterList ¶ms)
+ : AtmosphereProcess(comm, params)
{
- // Determine how often to call COSP; units can be steps or hours
- m_cosp_frequency = m_params.get<Int>("cosp_frequency", 1);
+ // Determine how often to call COSP; units can be steps or hours
+ m_cosp_frequency = m_params.get<Int>("cosp_frequency", 1);
m_cosp_frequency_units = m_params.get<std::string>("cosp_frequency_units", "steps");
EKAT_REQUIRE_MSG(
(m_cosp_frequency_units == "steps") || (m_cosp_frequency_units == "hours"),
diff --git a/components/eamxx/src/physics/rrtmgp/eamxx_rrtmgp_process_interface.cpp b/components/eamxx/src/physics/rrtmgp/eamxx_rrtmgp_process_interface.cpp
index a3113ba32b..2743eacda7 100644
--- a/components/eamxx/src/physics/rrtmgp/eamxx_rrtmgp_process_interface.cpp
+++ b/components/eamxx/src/physics/rrtmgp/eamxx_rrtmgp_process_interface.cpp
@@ -1,47 +1,54 @@
-#include "physics/rrtmgp/eamxx_rrtmgp_interface.hpp"
#include "physics/rrtmgp/eamxx_rrtmgp_process_interface.hpp"
+#include "physics/rrtmgp/eamxx_rrtmgp_interface.hpp"
#include "physics/rrtmgp/rrtmgp_utils.hpp"
#include "physics/rrtmgp/shr_orb_mod_c2f.hpp"
#include "physics/share/eamxx_trcmix.hpp"
#include "share/io/eamxx_scorpio_interface.hpp"
-#include "share/util/eamxx_fv_phys_rrtmgp_active_gases_workaround.hpp"
#include "share/property_checks/field_within_interval_check.hpp"
-#include "share/util/eamxx_common_physics_functions.hpp"
#include "share/util/eamxx_column_ops.hpp"
+#include "share/util/eamxx_common_physics_functions.hpp"
+#include "share/util/eamxx_fv_phys_rrtmgp_active_gases_workaround.hpp"
-#include <ekat_team_policy_utils.hpp>
#include <ekat_assert.hpp>
+#include <ekat_team_policy_utils.hpp>
#include "cpp/rrtmgp/mo_gas_concentrations.h"
-namespace scream {
+namespace scream
+{
-using KT = KokkosTypes<DefaultDevice>;
-using ExeSpace = KT::ExeSpace;
+using KT = KokkosTypes<DefaultDevice>;
+using ExeSpace = KT::ExeSpace;
using MemberType = KT::MemberType;
-using TPF = ekat::TeamPolicyFactory<ExeSpace>;
+using TPF = ekat::TeamPolicyFactory<ExeSpace>;
-namespace {
-
-struct ConvertToRrtmgpSubview
+namespace
{
+
+struct ConvertToRrtmgpSubview {
int beg;
int ncol;
template <typename View>
- View subview1d(const View& v) const {
- return View(v, std::make_pair(beg, beg+ncol));
+ View
+ subview1d(const View &v) const
+ {
+ return View(v, std::make_pair(beg, beg + ncol));
}
template <typename View>
- View subview2d_impl(const View& v, const int inner_dim) const {
- return View(v, std::make_pair(beg, beg+ncol), std::make_pair(0, inner_dim));
+ View
+ subview2d_impl(const View &v, const int inner_dim) const
+ {
+ return View(v, std::make_pair(beg, beg + ncol), std::make_pair(0, inner_dim));
}
#ifdef RRTMGP_LAYOUT_LEFT
template <typename FieldView, typename BufferView>
- BufferView subview2d(const FieldView&, const BufferView& buffer_view, const int inner_dim) const {
+ BufferView
+ subview2d(const FieldView &, const BufferView &buffer_view, const int inner_dim) const
+ {
return BufferView(buffer_view, std::make_pair(0, ncol), Kokkos::ALL);
}
#else
@@ -50,13 +57,17 @@ struct ConvertToRrtmgpSubview
// check_range_k will fail due to looking at unused values. Once rrtmgp can handle
// packs, this won't be necessary.
template <typename FieldView, typename BufferView>
- FieldView subview2d(const FieldView& field_view, const BufferView&, const int inner_dim) const {
+ FieldView
+ subview2d(const FieldView &field_view, const BufferView &, const int inner_dim) const
+ {
return subview2d_impl(field_view, inner_dim);
}
#endif
template <typename View>
- View subview3d(const View& v) const {
+ View
+ subview3d(const View &v) const
+ {
// The range assumes these are buffer views, not fields
return View(v, std::make_pair(0, ncol), Kokkos::ALL, Kokkos::ALL);
}
@@ -64,17 +75,16 @@ struct ConvertToRrtmgpSubview
}
-RRTMGPRadiation::
-RRTMGPRadiation (const ekat::Comm& comm, const ekat::ParameterList& params)
- : AtmosphereProcess(comm, params)
+RRTMGPRadiation::RRTMGPRadiation(const ekat::Comm &comm, const ekat::ParameterList ¶ms)
+ : AtmosphereProcess(comm, params)
{
// Gather the active gases from the rrtmgp parameter list and assign to the m_gas_names vector.
- const auto& active_gases = m_params.get<std::vector<std::string>>("active_gases");
- for (auto& it : active_gases) {
+ const auto &active_gases = m_params.get<std::vector<std::string>>("active_gases");
+ for (auto &it : active_gases) {
// Make sure only unique names are added
- if (not ekat::contains(m_gas_names,it)) {
+ if (not ekat::contains(m_gas_names, it)) {
m_gas_names.push_back(it);
- if (it=="o3") {
+ if (it == "o3") {
TraceGasesWorkaround::singleton().add_active_gas(it + "_volume_mix_ratio");
}
}
@@ -83,20 +93,22 @@ RRTMGPRadiation (const ekat::Comm& comm, const ekat::ParameterList& params)
m_ngas = m_gas_names.size();
}
-void RRTMGPRadiation::set_grids(const std::shared_ptr<const GridsManager> grids_manager) {
+void
+RRTMGPRadiation::set_grids(const std::shared_ptr<const GridsManager> grids_manager)
+{
using namespace ekat::units;
using namespace ekat::prefixes;
// Declare the set of fields used by rrtmgp
- Units m2(m*m,"m2");
+ Units m2(m * m, "m2");
auto nondim = Units::nondimensional();
- auto micron = micro*m;
+ auto micron = micro * m;
- m_grid = grids_manager->get_grid("physics");
- const auto& grid_name = m_grid->name();
- m_ncol = m_grid->get_num_local_dofs();
- m_nlay = m_grid->get_num_vertical_levels();
+ m_grid = grids_manager->get_grid("physics");
+ const auto &grid_name = m_grid->name();
+ m_ncol = m_grid->get_num_local_dofs();
+ m_nlay = m_grid->get_num_vertical_levels();
if (m_iop_data_manager) {
// For IOP runs, we need to use the lat/lon from the
@@ -115,62 +127,65 @@ void RRTMGPRadiation::set_grids(const std::shared_ptr<const GridsManager> grids_
}
// Figure out radiation column chunks stats
- m_col_chunk_size = std::min(m_params.get("column_chunk_size", m_ncol),m_ncol);
- m_num_col_chunks = (m_ncol+m_col_chunk_size-1) / m_col_chunk_size;
- m_col_chunk_beg.resize(m_num_col_chunks+1,0);
- for (int i=0; i<m_num_col_chunks; ++i) {
- m_col_chunk_beg[i+1] = std::min(m_ncol,m_col_chunk_beg[i] + m_col_chunk_size);
+ m_col_chunk_size = std::min(m_params.get("column_chunk_size", m_ncol), m_ncol);
+ m_num_col_chunks = (m_ncol + m_col_chunk_size - 1) / m_col_chunk_size;
+ m_col_chunk_beg.resize(m_num_col_chunks + 1, 0);
+ for (int i = 0; i < m_num_col_chunks; ++i) {
+ m_col_chunk_beg[i + 1] = std::min(m_ncol, m_col_chunk_beg[i] + m_col_chunk_size);
}
- this->log(LogLevel::debug,
- "[RRTMGP::set_grids] Col chunking stats:\n"
- " - Chunk size: " + std::to_string(m_col_chunk_size) + "\n"
- " - Number of chunks: " + std::to_string(m_num_col_chunks) + "\n");
+ this->log(LogLevel::debug, "[RRTMGP::set_grids] Col chunking stats:\n"
+ " - Chunk size: " +
+ std::to_string(m_col_chunk_size) +
+ "\n"
+ " - Number of chunks: " +
+ std::to_string(m_num_col_chunks) + "\n");
// Set up dimension layouts
- m_nswgpts = m_params.get<int>("nswgpts",112);
- m_nlwgpts = m_params.get<int>("nlwgpts",128);
- FieldLayout scalar2d = m_grid->get_2d_scalar_layout();
- FieldLayout scalar3d_mid = m_grid->get_3d_scalar_layout(true);
- FieldLayout scalar3d_int = m_grid->get_3d_scalar_layout(false);
- FieldLayout scalar3d_swband = m_grid->get_3d_vector_layout(true,m_nswbands,"swband");
- FieldLayout scalar3d_lwband = m_grid->get_3d_vector_layout(true,m_nlwbands,"lwband");
- FieldLayout scalar3d_swgpts = m_grid->get_3d_vector_layout(true,m_nswgpts,"swgpt");
- FieldLayout scalar3d_lwgpts = m_grid->get_3d_vector_layout(true,m_nlwgpts,"lwgpt");
+ m_nswgpts = m_params.get<int>("nswgpts", 112);
+ m_nlwgpts = m_params.get<int>("nlwgpts", 128);
+ FieldLayout scalar2d = m_grid->get_2d_scalar_layout();
+ FieldLayout scalar3d_mid = m_grid->get_3d_scalar_layout(true);
+ FieldLayout scalar3d_int = m_grid->get_3d_scalar_layout(false);
+ FieldLayout scalar3d_swband = m_grid->get_3d_vector_layout(true, m_nswbands, "swband");
+ FieldLayout scalar3d_lwband = m_grid->get_3d_vector_layout(true, m_nlwbands, "lwband");
+ FieldLayout scalar3d_swgpts = m_grid->get_3d_vector_layout(true, m_nswgpts, "swgpt");
+ FieldLayout scalar3d_lwgpts = m_grid->get_3d_vector_layout(true, m_nlwgpts, "lwgpt");
// Set required (input) fields here
- add_field<Required>("p_mid" , scalar3d_mid, Pa, grid_name);
+ add_field<Required>("p_mid", scalar3d_mid, Pa, grid_name);
add_field<Required>("p_int", scalar3d_int, Pa, grid_name);
add_field<Required>("pseudo_density", scalar3d_mid, Pa, grid_name);
add_field<Required>("sfc_alb_dir_vis", scalar2d, nondim, grid_name);
add_field<Required>("sfc_alb_dir_nir", scalar2d, nondim, grid_name);
add_field<Required>("sfc_alb_dif_vis", scalar2d, nondim, grid_name);
add_field<Required>("sfc_alb_dif_nir", scalar2d, nondim, grid_name);
- add_field<Required>("qc", scalar3d_mid, kg/kg, grid_name);
- add_field<Required>("nc", scalar3d_mid, 1/kg, grid_name);
- add_field<Required>("qi", scalar3d_mid, kg/kg, grid_name);
+ add_field<Required>("qc", scalar3d_mid, kg / kg, grid_name);
+ add_field<Required>("nc", scalar3d_mid, 1 / kg, grid_name);
+ add_field<Required>("qi", scalar3d_mid, kg / kg, grid_name);
add_field<Required>("cldfrac_tot", scalar3d_mid, nondim, grid_name);
add_field<Required>("eff_radius_qc", scalar3d_mid, micron, grid_name);
add_field<Required>("eff_radius_qi", scalar3d_mid, micron, grid_name);
- add_field<Required>("qv",scalar3d_mid,kg/kg,grid_name);
- add_field<Required>("surf_lw_flux_up",scalar2d,W/(m*m),grid_name);
+ add_field<Required>("qv", scalar3d_mid, kg / kg, grid_name);
+ add_field<Required>("surf_lw_flux_up", scalar2d, W / (m * m), grid_name);
// Set of required gas concentration fields
- for (auto& it : m_gas_names) {
- // Add gas VOLUME mixing ratios (moles of gas / moles of air; what actually gets input to RRTMGP)
+ for (auto &it : m_gas_names) {
+ // Add gas VOLUME mixing ratios (moles of gas / moles of air; what actually gets input to
+ // RRTMGP)
if (it == "o3") {
// o3 is read from file, or computed by chemistry
- add_field<Required>(it + "_volume_mix_ratio", scalar3d_mid, mol/mol, grid_name);
+ add_field<Required>(it + "_volume_mix_ratio", scalar3d_mid, mol / mol, grid_name);
} else {
// the rest are computed by RRTMGP from prescribed surface values
// NOTE: this may change at some point
- add_field<Computed>(it + "_volume_mix_ratio", scalar3d_mid, mol/mol, grid_name);
+ add_field<Computed>(it + "_volume_mix_ratio", scalar3d_mid, mol / mol, grid_name);
}
}
// Required aerosol optical properties from SPA
- m_do_aerosol_rad = m_params.get<bool>("do_aerosol_rad",true);
+ m_do_aerosol_rad = m_params.get<bool>("do_aerosol_rad", true);
if (m_do_aerosol_rad) {
add_field<Required>("aero_tau_sw", scalar3d_swband, nondim, grid_name);
add_field<Required>("aero_ssa_sw", scalar3d_swband, nondim, grid_name);
- add_field<Required>("aero_g_sw" , scalar3d_swband, nondim, grid_name);
+ add_field<Required>("aero_g_sw", scalar3d_swband, nondim, grid_name);
add_field<Required>("aero_tau_lw", scalar3d_lwband, nondim, grid_name);
}
@@ -179,38 +194,38 @@ void RRTMGPRadiation::set_grids(const std::shared_ptr<const GridsManager> grids_
m_extra_clnsky_diag = m_params.get<bool>("extra_clnsky_diag", false);
// Set computed (output) fields
- add_field<Updated >("T_mid" , scalar3d_mid, K , grid_name);
- add_field<Computed>("SW_flux_dn", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("SW_flux_up", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("SW_flux_dn_dir", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("LW_flux_up", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("LW_flux_dn", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("SW_clnclrsky_flux_dn", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("SW_clnclrsky_flux_up", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("SW_clnclrsky_flux_dn_dir", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("SW_clrsky_flux_dn", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("SW_clrsky_flux_up", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("SW_clrsky_flux_dn_dir", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("SW_clnsky_flux_dn", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("SW_clnsky_flux_up", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("SW_clnsky_flux_dn_dir", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("LW_clnclrsky_flux_up", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("LW_clnclrsky_flux_dn", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("LW_clrsky_flux_up", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("LW_clrsky_flux_dn", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("LW_clnsky_flux_up", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("LW_clnsky_flux_dn", scalar3d_int, W/m2, grid_name);
- add_field<Computed>("rad_heating_pdel", scalar3d_mid, Pa*K/s, grid_name);
+ add_field<Updated>("T_mid", scalar3d_mid, K, grid_name);
+ add_field<Computed>("SW_flux_dn", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("SW_flux_up", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("SW_flux_dn_dir", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("LW_flux_up", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("LW_flux_dn", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("SW_clnclrsky_flux_dn", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("SW_clnclrsky_flux_up", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("SW_clnclrsky_flux_dn_dir", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("SW_clrsky_flux_dn", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("SW_clrsky_flux_up", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("SW_clrsky_flux_dn_dir", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("SW_clnsky_flux_dn", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("SW_clnsky_flux_up", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("SW_clnsky_flux_dn_dir", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("LW_clnclrsky_flux_up", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("LW_clnclrsky_flux_dn", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("LW_clrsky_flux_up", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("LW_clrsky_flux_dn", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("LW_clnsky_flux_up", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("LW_clnsky_flux_dn", scalar3d_int, W / m2, grid_name);
+ add_field<Computed>("rad_heating_pdel", scalar3d_mid, Pa * K / s, grid_name);
// Cloud properties added as computed fields for diagnostic purposes
- add_field<Computed>("cldlow" , scalar2d, nondim, grid_name);
- add_field<Computed>("cldmed" , scalar2d, nondim, grid_name);
- add_field<Computed>("cldhgh" , scalar2d, nondim, grid_name);
- add_field<Computed>("cldtot" , scalar2d, nondim, grid_name);
+ add_field<Computed>("cldlow", scalar2d, nondim, grid_name);
+ add_field<Computed>("cldmed", scalar2d, nondim, grid_name);
+ add_field<Computed>("cldhgh", scalar2d, nondim, grid_name);
+ add_field<Computed>("cldtot", scalar2d, nondim, grid_name);
// 0.67 micron and 10.5 micron optical depth (needed for COSP)
- add_field<Computed>("dtau067" , scalar3d_mid, nondim, grid_name);
- add_field<Computed>("dtau105" , scalar3d_mid, nondim, grid_name);
- add_field<Computed>("sunlit_mask" , scalar2d , nondim, grid_name);
- add_field<Computed>("cldfrac_rad" , scalar3d_mid, nondim, grid_name);
+ add_field<Computed>("dtau067", scalar3d_mid, nondim, grid_name);
+ add_field<Computed>("dtau105", scalar3d_mid, nondim, grid_name);
+ add_field<Computed>("sunlit_mask", scalar2d, nondim, grid_name);
+ add_field<Computed>("cldfrac_rad", scalar3d_mid, nondim, grid_name);
// Cloud-top diagnostics following AeroCom recommendation
add_field<Computed>("T_mid_at_cldtop", scalar2d, K, grid_name);
add_field<Computed>("p_mid_at_cldtop", scalar2d, Pa, grid_name);
@@ -232,19 +247,19 @@ void RRTMGPRadiation::set_grids(const std::shared_ptr<const GridsManager> grids_
// netsw sfc_flux_sw_net net (down - up) SW flux at surface
// flwds sfc_flux_lw_dn downwelling LW flux at surface
// --------------------------------------------------------------
- add_field<Computed>("sfc_flux_dir_nir", scalar2d, W/m2, grid_name);
- add_field<Computed>("sfc_flux_dir_vis", scalar2d, W/m2, grid_name);
- add_field<Computed>("sfc_flux_dif_nir", scalar2d, W/m2, grid_name);
- add_field<Computed>("sfc_flux_dif_vis", scalar2d, W/m2, grid_name);
- add_field<Computed>("sfc_flux_sw_net" , scalar2d, W/m2, grid_name);
- add_field<Computed>("sfc_flux_lw_dn" , scalar2d, W/m2, grid_name);
+ add_field<Computed>("sfc_flux_dir_nir", scalar2d, W / m2, grid_name);
+ add_field<Computed>("sfc_flux_dir_vis", scalar2d, W / m2, grid_name);
+ add_field<Computed>("sfc_flux_dif_nir", scalar2d, W / m2, grid_name);
+ add_field<Computed>("sfc_flux_dif_vis", scalar2d, W / m2, grid_name);
+ add_field<Computed>("sfc_flux_sw_net", scalar2d, W / m2, grid_name);
+ add_field<Computed>("sfc_flux_lw_dn", scalar2d, W / m2, grid_name);
// Boundary flux fields for energy and mass conservation checks
if (has_column_conservation_check()) {
- add_field<Computed>("vapor_flux", scalar2d, kg/m2/s, grid_name);
- add_field<Computed>("water_flux", scalar2d, m/s, grid_name);
- add_field<Computed>("ice_flux", scalar2d, m/s, grid_name);
- add_field<Computed>("heat_flux", scalar2d, W/m2, grid_name);
+ add_field<Computed>("vapor_flux", scalar2d, kg / m2 / s, grid_name);
+ add_field<Computed>("water_flux", scalar2d, m / s, grid_name);
+ add_field<Computed>("ice_flux", scalar2d, m / s, grid_name);
+ add_field<Computed>("heat_flux", scalar2d, W / m2, grid_name);
}
// Working fields that we also want for diagnostic output
@@ -252,63 +267,65 @@ void RRTMGPRadiation::set_grids(const std::shared_ptr<const GridsManager> grids_
// Load bands bounds from coefficients files and compute the band centerpoint.
// Store both in the grid (if not already present)
- const auto cm = centi*m;
- for (std::string prefix : {"sw", "lw"} ) {
+ const auto cm = centi * m;
+ for (std::string prefix : {"sw", "lw"}) {
int nbands = prefix == "sw" ? m_nswbands : m_nlwbands;
if (not m_grid->has_geometry_data(prefix + "band_bounds")) {
using namespace ShortFieldTagsNames;
// NOTE: use append, so we get builtin name for (CMP,2) dim, without hard-coding it here
- FieldLayout layout({CMP},{nbands},{prefix+"band"});
- layout.append_dim(CMP,2);
- Field bounds (FieldIdentifier(prefix + "band_bounds", layout, 1/cm, grid_name));
+ FieldLayout layout({CMP}, {nbands}, {prefix + "band"});
+ layout.append_dim(CMP, 2);
+ Field bounds(FieldIdentifier(prefix + "band_bounds", layout, 1 / cm, grid_name));
bounds.allocate_view();
std::string fname = m_params.get<std::string>("rrtmgp_coefficients_file_" + prefix);
- scorpio::register_file(fname,scorpio::FileMode::Read);
- scorpio::read_var(fname,"bnd_limits_wavenumber",bounds.get_view<Real**,Host>().data());
+ scorpio::register_file(fname, scorpio::FileMode::Read);
+ scorpio::read_var(fname, "bnd_limits_wavenumber", bounds.get_view<Real **, Host>().data());
scorpio::release_file(fname);
bounds.sync_to_dev();
m_grid->set_geometry_data(bounds);
}
- // If no bounds were in the grid, the bands centerpoint likely wouldn't either. Still, let's check...
+ // If no bounds were in the grid, the bands centerpoint likely wouldn't either. Still, let's
+ // check...
if (not m_grid->has_geometry_data(prefix + "bands")) {
- auto bounds = m_grid->get_geometry_data(prefix + "band_bounds");
- auto bounds_h = bounds.get_view<const Real**,Host>();
+ auto bounds = m_grid->get_geometry_data(prefix + "band_bounds");
+ auto bounds_h = bounds.get_view<const Real **, Host>();
- auto bands = bounds.subfield(1,0).clone(prefix + "band");
- auto bands_h = bands.get_view<Real*,Host>();
- for (int i=0; i<nbands; ++i) {
- bands_h(i) = (bounds_h(i,0) + bounds_h(i,1)) / 2;
+ auto bands = bounds.subfield(1, 0).clone(prefix + "band");
+ auto bands_h = bands.get_view<Real *, Host>();
+ for (int i = 0; i < nbands; ++i) {
+ bands_h(i) = (bounds_h(i, 0) + bounds_h(i, 1)) / 2;
}
bands.sync_to_dev();
m_grid->set_geometry_data(bands);
}
}
-} // RRTMGPRadiation::set_grids
+} // RRTMGPRadiation::set_grids
-size_t RRTMGPRadiation::requested_buffer_size_in_bytes() const
+size_t
+RRTMGPRadiation::requested_buffer_size_in_bytes() const
{
const size_t interface_request =
- Buffer::num_1d_ncol*m_col_chunk_size +
- Buffer::num_2d_nlay*m_col_chunk_size*m_nlay +
- Buffer::num_2d_nlay_p1*m_col_chunk_size*(m_nlay+1) +
- Buffer::num_2d_nswbands*m_col_chunk_size*m_nswbands +
- Buffer::num_3d_nlev_nswbands*m_col_chunk_size*(m_nlay+1)*m_nswbands +
- Buffer::num_3d_nlev_nlwbands*m_col_chunk_size*(m_nlay+1)*m_nlwbands +
- Buffer::num_3d_nlay_nswbands*m_col_chunk_size*(m_nlay)*m_nswbands +
- Buffer::num_3d_nlay_nlwbands*m_col_chunk_size*(m_nlay)*m_nlwbands +
- Buffer::num_3d_nlay_nswgpts*m_col_chunk_size*(m_nlay)*m_nswgpts +
- Buffer::num_3d_nlay_nlwgpts*m_col_chunk_size*(m_nlay)*m_nlwgpts;
+ Buffer::num_1d_ncol * m_col_chunk_size + Buffer::num_2d_nlay * m_col_chunk_size * m_nlay +
+ Buffer::num_2d_nlay_p1 * m_col_chunk_size * (m_nlay + 1) +
+ Buffer::num_2d_nswbands * m_col_chunk_size * m_nswbands +
+ Buffer::num_3d_nlev_nswbands * m_col_chunk_size * (m_nlay + 1) * m_nswbands +
+ Buffer::num_3d_nlev_nlwbands * m_col_chunk_size * (m_nlay + 1) * m_nlwbands +
+ Buffer::num_3d_nlay_nswbands * m_col_chunk_size * (m_nlay)*m_nswbands +
+ Buffer::num_3d_nlay_nlwbands * m_col_chunk_size * (m_nlay)*m_nlwbands +
+ Buffer::num_3d_nlay_nswgpts * m_col_chunk_size * (m_nlay)*m_nswgpts +
+ Buffer::num_3d_nlay_nlwgpts * m_col_chunk_size * (m_nlay)*m_nlwgpts;
return interface_request * sizeof(Real);
} // RRTMGPRadiation::requested_buffer_size
// =========================================================================================
-void RRTMGPRadiation::init_buffers(const ATMBufferManager &buffer_manager)
+void
+RRTMGPRadiation::init_buffers(const ATMBufferManager &buffer_manager)
{
EKAT_REQUIRE_MSG(buffer_manager.allocated_bytes() >= requested_buffer_size_in_bytes(), "Error! Buffers size not sufficient.\n");
diff --git a/components/eamxx/src/share/grid/remap/coarsening_remapper.cpp b/components/eamxx/src/share/grid/remap/coarsening_remapper.cpp
index e2f0a021eb..bcf637348d 100644
--- a/components/eamxx/src/share/grid/remap/coarsening_remapper.cpp
+++ b/components/eamxx/src/share/grid/remap/coarsening_remapper.cpp
@@ -1,49 +1,46 @@
#include "coarsening_remapper.hpp"
-#include "share/grid/point_grid.hpp"
+#include "share/field/field.hpp"
#include "share/grid/grid_import_export.hpp"
+#include "share/grid/point_grid.hpp"
#include "share/io/scorpio_input.hpp"
-#include "share/field/field.hpp"
-#include <ekat_team_policy_utils.hpp>
#include <ekat_pack_utils.hpp>
+#include <ekat_team_policy_utils.hpp>
#include <numeric>
namespace scream
{
-CoarseningRemapper::
-CoarseningRemapper (const grid_ptr_type& src_grid,
- const std::string& map_file,
- const bool track_mask,
- const bool populate_tgt_grid_geo_data)
- : HorizInterpRemapperBase (src_grid,map_file,InterpType::Coarsen)
- , m_track_mask (track_mask)
+CoarseningRemapper::CoarseningRemapper(const grid_ptr_type &src_grid, const std::string &map_file,
+ const bool track_mask, const bool populate_tgt_grid_geo_data)
+ : HorizInterpRemapperBase(src_grid, map_file, InterpType::Coarsen),
+ m_track_mask(track_mask)
{
using namespace ShortFieldTagsNames;
if (populate_tgt_grid_geo_data) {
// Replicate the src grid geo data in the tgt grid. We use this remapper to do
// the remapping (if needed), and clean it up afterwards.
- const auto& src_geo_data_names = src_grid->get_geometry_data_names();
- for (const auto& name : src_geo_data_names) {
+ const auto &src_geo_data_names = src_grid->get_geometry_data_names();
+ for (const auto &name : src_geo_data_names) {
// Since different remappers may share the same data (if the map file is the same)
// the coarse grid may already have the geo data.
if (m_coarse_grid->has_geometry_data(name)) {
continue;
}
- const auto& src_data = src_grid->get_geometry_data(name);
- auto tgt_data = register_field_from_src(src_data);
+ const auto &src_data = src_grid->get_geometry_data(name);
+ auto tgt_data = register_field_from_src(src_data);
m_coarse_grid->set_geometry_data(tgt_data);
}
registration_ends();
- if (get_num_fields()>0) {
+ if (get_num_fields() > 0) {
remap_fwd();
// The remap phase only alters the fields on device.
// We need to sync them to host as well
- for (int i=0; i<get_num_fields(); ++i) {
+ for (int i = 0; i < get_num_fields(); ++i) {
auto tgt_data = get_tgt_field(i);
tgt_data.sync_to_host();
}
@@ -52,20 +49,19 @@ CoarseningRemapper (const grid_ptr_type& src_grid,
}
}
-CoarseningRemapper::
-~CoarseningRemapper ()
+CoarseningRemapper::~CoarseningRemapper()
{
// We need to free MPI requests
- for (size_t i=0; i<m_send_req.size(); ++i) {
+ for (size_t i = 0; i < m_send_req.size(); ++i) {
MPI_Request_free(&m_send_req[i]);
}
- for (size_t i=0; i<m_recv_req.size(); ++i) {
+ for (size_t i = 0; i < m_recv_req.size(); ++i) {
MPI_Request_free(&m_recv_req[i]);
}
}
-void CoarseningRemapper::
-registration_ends_impl ()
+void
+CoarseningRemapper::registration_ends_impl()
{
if (not m_track_mask) {
// Just call base class and be done
@@ -73,19 +69,18 @@ registration_ends_impl ()
return;
}
- // We store masks (src-tgt) here, and register them AFTER we parse all currently registered fields.
- // That makes the for loop below easier, since we can take references without worrring that they
- // would get invalidated. In fact, if you call register_field inside the loop, the src/tgt fields
- // vectors will grow, which may cause reallocation and references invalidation
- std::vector<std::pair<Field,Field>> masks;
-
- auto get_mask_idx = [&](const FieldIdentifier& src_mask_fid) {
+ // We store masks (src-tgt) here, and register them AFTER we parse all currently registered
+ // fields. That makes the for loop below easier, since we can take references without worrring
+ // that they would get invalidated. In fact, if you call register_field inside the loop, the
+ // src/tgt fields vectors will grow, which may cause reallocation and references invalidation
+ std::vector<std::pair<Field, Field>> masks;
+ auto get_mask_idx = [&](const FieldIdentifier &src_mask_fid) {
// Masks will be registered AFTER all fields, so the 1st mask will
// be right after the last registered "regular" field.
int idx = 0;
- for (const auto& it : masks) {
- if (it.first.get_header().get_identifier()==src_mask_fid) {
+ for (const auto &it : masks) {
+ if (it.first.get_header().get_identifier() == src_mask_fid) {
return idx;
}
++idx;
@@ -93,16 +88,16 @@ registration_ends_impl ()
return -1;
};
- for (int i=0; i<m_num_fields; ++i) {
- const auto& src = m_src_fields[i];
- auto& tgt = m_tgt_fields[i];
+ for (int i = 0; i < m_num_fields; ++i) {
+ const auto &src = m_src_fields[i];
+ auto &tgt = m_tgt_fields[i];
if (not src.get_header().has_extra_data("mask_field"))
continue;
- const auto& src_mask = src.get_header().get_extra_data<Field>("mask_field");
+ const auto &src_mask = src.get_header().get_extra_data<Field>("mask_field");
- // Make sure fields representing masks are not themselves meant to be masked.
- EKAT_REQUIRE_MSG(not src_mask.get_header().has_extra_data("mask_field"),
+ // Make sure fields representing masks are not themselves meant to be masked.
+ EKAT_REQUIRE_MSG(not src_mask.get_header().has_extra_data("mask_field"),
"Error! A mask field cannot be itself masked.\n"
" - field name: " + src.name() + "\n"
" - mask field name: " + src_mask.name() + "\n");
diff --git a/components/eamxx/src/share/io/scorpio_output.cpp b/components/eamxx/src/share/io/scorpio_output.cpp
index 0c17f01498..542631ee58 100644
--- a/components/eamxx/src/share/io/scorpio_output.cpp
+++ b/components/eamxx/src/share/io/scorpio_output.cpp
@@ -1,61 +1,63 @@
#include "share/io/scorpio_output.hpp"
-#include "share/io/scorpio_input.hpp"
-#include "share/io/eamxx_io_utils.hpp"
+#include "share/field/field_utils.hpp"
#include "share/grid/remap/coarsening_remapper.hpp"
#include "share/grid/remap/vertical_remapper.hpp"
+#include "share/io/eamxx_io_utils.hpp"
+#include "share/io/scorpio_input.hpp"
#include "share/util/eamxx_timing.hpp"
-#include "share/field/field_utils.hpp"
-#include <ekat_units.hpp>
-#include <ekat_string_utils.hpp>
#include <ekat_std_utils.hpp>
+#include <ekat_string_utils.hpp>
+#include <ekat_units.hpp>
#include <numeric>
-namespace {
- // Helper lambda, to copy extra data (io string attributes plus filled settings).
- // This will be used if any remapper is created, to ensure atts set by atm_procs are not lost
- void transfer_extra_data (const scream::Field& src, scream::Field& tgt) {
-
- // Transfer io string attributes
- const std::string io_string_atts_key ="io: string attributes";
- using stratts_t = std::map<std::string,std::string>;
- const auto& src_atts = src.get_header().get_extra_data<stratts_t>(io_string_atts_key);
- auto& dst_atts = tgt.get_header().get_extra_data<stratts_t>(io_string_atts_key);
- for (const auto& [name,val] : src_atts) {
- dst_atts[name] = val;
- }
+namespace
+{
+// Helper lambda, to copy extra data (io string attributes plus filled settings).
+// This will be used if any remapper is created, to ensure atts set by atm_procs are not lost
+void
+transfer_extra_data(const scream::Field &src, scream::Field &tgt)
+{
- // Transfer whether or not this field MAY contain fill_value (to trigger usage of the
- // proper implementation of Field update methods
- if (src.get_header().may_be_filled()) {
- tgt.get_header().set_may_be_filled(true);
- }
- };
+ // Transfer io string attributes
+ const std::string io_string_atts_key = "io: string attributes";
+ using stratts_t = std::map<std::string, std::string>;
+ const auto &src_atts = src.get_header().get_extra_data<stratts_t>(io_string_atts_key);
+ auto &dst_atts = tgt.get_header().get_extra_data<stratts_t>(io_string_atts_key);
+ for (const auto &[name, val] : src_atts) {
+ dst_atts[name] = val;
+ }
+
+ // Transfer whether or not this field MAY contain fill_value (to trigger usage of the
+ // proper implementation of Field update methods
+ if (src.get_header().may_be_filled()) {
+ tgt.get_header().set_may_be_filled(true);
+ }
+};
}
namespace scream
{
-template<typename T>
-bool has_duplicates (const std::vector<T>& c)
+template <typename T>
+bool
+has_duplicates(const std::vector<T> &c)
{
- std::set<T> s(c.begin(),c.end());
- return c.size()>s.size();
+ std::set<T> s(c.begin(), c.end());
+ return c.size() > s.size();
}
-AtmosphereOutput::
-AtmosphereOutput (const ekat::Comm& comm,
- const std::vector<Field>& fields,
- const std::shared_ptr<const grid_type>& grid)
- : m_comm (comm)
+AtmosphereOutput::AtmosphereOutput(const ekat::Comm &comm, const std::vector<Field> &fields,
+ const std::shared_ptr<const grid_type> &grid)
+ : m_comm(comm)
{
// This version of AtmosphereOutput is for quick output of fields (no remaps, no time dim)
- m_avg_type = OutputAvgType::Instant;
+ m_avg_type = OutputAvgType::Instant;
m_add_time_dim = false;
// Create a FieldManager with the input fields
- auto fm = std::make_shared<FieldManager> (grid);
+ auto fm = std::make_shared<FieldManager>(grid);
for (auto f : fields) {
fm->add_field(f);
m_fields_names.push_back(f.name());
@@ -66,15 +68,14 @@ AtmosphereOutput (const ekat::Comm& comm,
m_field_mgrs[FromModel] = m_field_mgrs[AfterVertRemap] = m_field_mgrs[AfterHorizRemap] = fm;
// Setup I/O structures
- init ();
+ init();
}
-AtmosphereOutput::
-AtmosphereOutput (const ekat::Comm& comm, const ekat::ParameterList& params,
- const std::shared_ptr<const fm_type>& field_mgr,
- const std::string& grid_name)
- : m_comm (comm)
- , m_add_time_dim (true)
+AtmosphereOutput::AtmosphereOutput(const ekat::Comm &comm, const ekat::ParameterList ¶ms,
+ const std::shared_ptr<const fm_type> &field_mgr,
+ const std::string &grid_name)
+ : m_comm(comm),
+ m_add_time_dim(true)
{
using vos_t = std::vector<std::string>;
@@ -82,7 +83,7 @@ AtmosphereOutput (const ekat::Comm& comm, const ekat::ParameterList& params,
// Figure out what kind of averaging is requested
auto avg_type = params.get<std::string>("averaging_type");
- m_avg_type = str2avg(avg_type);
+ m_avg_type = str2avg(avg_type);
EKAT_REQUIRE_MSG (m_avg_type!=OutputAvgType::Invalid,
"Error! Unsupported averaging type '" + avg_type + "'.\n"
" Valid options: instant, Max, Min, Average. Case insensitive.\n");
|
Beta Was this translation helpful? Give feedback.
-
|
I'm not aware of any limit to either I'll take a look to the workflow, to see if there's something off. |
Beta Was this translation helpful? Give feedback.
-
|
Well, darn... Always fresh new surprises when it comes to gh actions 🫠 |
Beta Was this translation helpful? Give feedback.
-
|
I can also test locally; i mean, it's ok, but this highlights the challenges of our dense/big code |
Beta Was this translation helpful? Give feedback.
-
|
I guess worst case scenario it will take a couple of PRs to finally format large files... Or maybe it's just going to take 2 CI runs, meaning 1) CI fails with patch, 2) push format commit, 3) CI fails again with new patch (covering remainder of file). And we can always think of having a big PR with all eamxx format taken care of (or maybe a handful of PRs), so that ppl touching existing large files won't get slammed with large clang-format diffs... |
Beta Was this translation helpful? Give feedback.
-
|
I agree that the multi-step formatting procedure mentioned above is viable, though non-ideal. I do still find it odd that the output gets cut off--wondering if it could be a buffering issue? No idea how shell redirect works under the hood... I also have always been in favor of the format-all-files idea because it seems like it'd reduce the ongoing pain for individuals. However, there is the drawback of diffing across the Great Chasm of the total format, even though the one-by-one approach means there will be hundreds of cases where that occurs with handfuls of isolated files |
Beta Was this translation helpful? Give feedback.
-
|
Interestingly, I also got a somewhat "short" patch for another PR. But after applying it, the clang-format action passed, suggesting that either it was not formatting the whole file, or the rest was already formatted correctly. Both seem unlikely though. |
Beta Was this translation helpful? Give feedback.
-
|
After doing some testing locally and comparing to the patch files, I believe I've confirmed that the entire diff is getting printed to the patch file. I finally convinced myself by doing a manual run on $E3SM_ROOT/format_all.sh#!/bin/bash
flist=($(find "./components/eamxx" -depth -name "*.?pp"))
for f in ${flist[@]}; do
clang-format -i \
--style="file:${E3SM_ROOT}/components/eamxx/.clang-format" \
"${f}" > local_diff.diff
done
diff local_diff.diff ${PATCH_FILE} > diffdiff.diff |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Since things are oft prone to go awry...
Please use this issue to provide any feedback, questions, comments, or complaints about the
clang-formatautoformatting workflow that was added in PRs #7302 and #7549.Beta Was this translation helpful? Give feedback.
All reactions