Skip to content

Commit

Permalink
EAMxx: fix pack size determination for VerticalLayer diag
Browse files Browse the repository at this point in the history
  • Loading branch information
bartgol committed May 20, 2024
1 parent 2f4be63 commit 4b12127
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/eamxx/src/diagnostics/vertical_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ initialize_impl (const RunType /*run_type*/)

m_diagnostic_output = Field(fid);
auto& diag_fap = m_diagnostic_output.get_header().get_alloc_properties();
int ps = SCREAM_PACK_SIZE;
for (const auto& f : {T,rho,p,qv,phis}) {
const auto& fap = f.get_header().get_alloc_properties();
const auto& ps = fap.get_largest_pack_size();
diag_fap.request_allocation(ps);
const auto& f_ps = fap.get_largest_pack_size();

// We must use a pack size that works with all inputs, so pick the smallest
ps = std::min(ps,f_ps);
}
diag_fap.request_allocation(ps);
m_diagnostic_output.allocate_view();

using stratts_t = std::map<std::string,std::string>;
Expand All @@ -121,7 +125,6 @@ initialize_impl (const RunType /*run_type*/)
// Initialize temporary views based on need. Can alias the diag if a temp is not needed
auto create_temp = [&](const std::string& name, int levs) {
auto u = Units::nondimensional();
auto ps = diag_fap.get_largest_pack_size();
FieldLayout fl({COL,LEV},{m_num_cols,levs});
FieldIdentifier fid (name,fl,u,grid_name);
Field f = Field(fid);
Expand Down

0 comments on commit 4b12127

Please sign in to comment.