Skip to content

Commit

Permalink
format and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lroberts36 committed Nov 4, 2024
1 parent 24aa55f commit f72ee8f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/bvals/comms/bnd_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ void BndId::PrintInfo(const std::string &start) {
printf("%s var %s (%i -> %i) starting at %i with size %i (Total combined buffer size = "
"%i, buffer size = %i, buf_allocated = %i) [rank = %i]\n",
start.c_str(), Variable<Real>::GetLabel(var_id()).c_str(), send_gid(),
recv_gid(), start_idx(), size(), combined_buf.size(), buf.size(),
buf_allocated, Globals::my_rank);
recv_gid(), start_idx(), size(), combined_buf.size(), buf.size(), buf_allocated,
Globals::my_rank);
}

BndInfo BndInfo::GetSendBndInfo(MeshBlock *pmb, const NeighborBlock &nb,
Expand Down
4 changes: 2 additions & 2 deletions src/bvals/comms/bnd_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct BndId {
bool buf_allocated;
buf_pool_t<Real>::weak_t buf; // comm buffer from pool
BufArray1D<Real> combined_buf; // Combined buffer

void PrintInfo(const std::string &start);

KOKKOS_DEFAULTED_FUNCTION
Expand All @@ -102,7 +102,7 @@ struct BndId {
}
}

bool SameBVChannel(const BndId& other) {
bool SameBVChannel(const BndId &other) {
// Don't want to compare start_idx, so -1
for (int i = 0; i < NDAT - 1; ++i) {
if (data[i] != other.data[i]) return false;
Expand Down
10 changes: 5 additions & 5 deletions src/bvals/comms/boundary_communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,17 @@ TaskStatus SendBoundBufs(std::shared_ptr<MeshData<Real>> &md) {
else
buf.SendNullLocal();
}

// Send the combined buffers
pmesh->pcombined_buffers->PackAndSend(md.get(), bound_type);
} else {
} else {
for (int ibuf = 0; ibuf < cache.buf_vec.size(); ++ibuf) {
auto &buf = *cache.buf_vec[ibuf];
if (sending_nonzero_flags_h(ibuf) || !Globals::sparse_config.enabled)
buf.Send();
else
buf.SendNull();
}
}
}
return TaskStatus::complete;
}
Expand Down Expand Up @@ -236,13 +236,13 @@ TaskStatus ReceiveBoundBufs(std::shared_ptr<MeshData<Real>> &md) {
all_received = pbuf->TryReceiveLocal() && all_received;
nreceived += pbuf->TryReceiveLocal();
});
} else {
} else {
int nreceived{0};
std::for_each(std::begin(cache.buf_vec), std::end(cache.buf_vec),
[&all_received, &nreceived](auto pbuf) {
all_received = pbuf->TryReceive() && all_received;
nreceived += pbuf->TryReceive();
});
});
}
int ibound = 0;
if (Globals::sparse_config.enabled && all_received) {
Expand Down
5 changes: 4 additions & 1 deletion src/bvals/comms/combined_buffers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ struct CombinedBuffersRankPartition {

void AllocateCombinedBuffer();

bool IsAvailableForWrite() { return sparse_status_buffer.IsAvailableForWrite() && combined_comm_buffer.IsAvailableForWrite(); }
bool IsAvailableForWrite() {
return sparse_status_buffer.IsAvailableForWrite() &&
combined_comm_buffer.IsAvailableForWrite();
}

ParArray1D<BndId> &GetBndIdsOnDevice(const std::set<Uid_t> &vars);

Expand Down
3 changes: 2 additions & 1 deletion src/mesh/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ Mesh::Mesh(ParameterInput *pin, ApplicationInput *app_in, Packages_t &packages,
brdisp(Globals::nranks), bddisp(Globals::nranks),
pcombined_buffers(std::make_shared<CombinedBuffers>(this)),
receive_type{pin->GetOrAddString("parthenon/mesh", "receive_type", "iprobe")},
do_combined_comms{pin->GetOrAddBoolean("parthenon/mesh", "do_combined_comms", false)} {
do_combined_comms{
pin->GetOrAddBoolean("parthenon/mesh", "do_combined_comms", false)} {
// Allow for user overrides to default Parthenon functions
if (app_in->InitUserMeshData != nullptr) {
InitUserMeshData = app_in->InitUserMeshData;
Expand Down

0 comments on commit f72ee8f

Please sign in to comment.