Skip to content

Commit f17c866

Browse files
committed
Fix pack size logic
1 parent 959c3db commit f17c866

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/utils/few_modes_ft.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,17 @@ void FewModesFT::SetPhases(MeshBlock *pmb, ParameterInput *pin) {
9898
// initializtion. From my (pgrete) point of view, it's currently cleaner to keep things
9999
// separate and not touch the main driver at the expense of using one pack per rank --
100100
// which is typically fastest on devices anyway.
101-
const auto pack_size = pin->GetInteger("parthenon/mesh", "pack_size");
102-
PARTHENON_REQUIRE_THROWS(pack_size == -1,
103-
"Few modes FT currently needs parthenon/mesh/pack_size=-1 "
104-
"to work because of global reductions.")
101+
bool uses_single_pack = false;
102+
// need separate check due to new packs_per_rank parameter
103+
if (pin->DoesParameterExist("parthenon/mesh", "pack_size")) {
104+
uses_single_pack = pin->GetInteger("parthenon/mesh", "pack_size") == -1;
105+
// one parameter has to exist
106+
} else {
107+
uses_single_pack = pin->GetInteger("parthenon/mesh", "packs_per_rank") == 1;
108+
}
109+
PARTHENON_REQUIRE_THROWS(uses_single_pack,
110+
"Few modes FT currently needs parthenon/mesh/packs_per_rank=1 "
111+
"to work because of global reductions.");
105112

106113
const auto Lx1 = pm->mesh_size.xmax(X1DIR) - pm->mesh_size.xmin(X1DIR);
107114
const auto Lx2 = pm->mesh_size.xmax(X2DIR) - pm->mesh_size.xmin(X2DIR);

0 commit comments

Comments
 (0)