From 8275b6d393fa70096f4aa34ddfe5fd1c0a7f5d66 Mon Sep 17 00:00:00 2001 From: Guy Bergel Date: Thu, 16 Jan 2025 11:04:53 -0800 Subject: [PATCH] applied clang-format --- src/axom/lumberjack/MPIUtility.cpp | 15 ++++++++------- .../lumberjack/NonCollectiveRootCommunicator.cpp | 16 +++++++++------- .../lumberjack_NonCollectiveRootCommunicator.hpp | 13 ++++++------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/axom/lumberjack/MPIUtility.cpp b/src/axom/lumberjack/MPIUtility.cpp index 0859da8ea8..6f7063b205 100644 --- a/src/axom/lumberjack/MPIUtility.cpp +++ b/src/axom/lumberjack/MPIUtility.cpp @@ -60,7 +60,8 @@ const char* mpiNonBlockingReceiveMessages(MPI_Comm comm, int tag) int mpiFlag = 0; MPI_Iprobe(MPI_ANY_SOURCE, tag, comm, &mpiFlag, &mpiStatus); - if (mpiFlag == 1) { + if(mpiFlag == 1) + { MPI_Get_count(&mpiStatus, MPI_CHAR, &messageSize); // Setup where to receive the char array @@ -69,12 +70,12 @@ const char* mpiNonBlockingReceiveMessages(MPI_Comm comm, int tag) // Receive packed Message MPI_Recv(charArray, - messageSize, - MPI_CHAR, - mpiStatus.MPI_SOURCE, - mpiTag, - comm, - &mpiStatus); + messageSize, + MPI_CHAR, + mpiStatus.MPI_SOURCE, + mpiTag, + comm, + &mpiStatus); } return charArray; diff --git a/src/axom/lumberjack/NonCollectiveRootCommunicator.cpp b/src/axom/lumberjack/NonCollectiveRootCommunicator.cpp index 3cef663370..37f374e495 100644 --- a/src/axom/lumberjack/NonCollectiveRootCommunicator.cpp +++ b/src/axom/lumberjack/NonCollectiveRootCommunicator.cpp @@ -35,14 +35,18 @@ void NonCollectiveRootCommunicator::finalize() { } int NonCollectiveRootCommunicator::rank() { return m_mpiCommRank; } -void NonCollectiveRootCommunicator::ranksLimit(int value) { m_ranksLimit = value; } +void NonCollectiveRootCommunicator::ranksLimit(int value) +{ + m_ranksLimit = value; +} int NonCollectiveRootCommunicator::ranksLimit() { return m_ranksLimit; } int NonCollectiveRootCommunicator::numPushesToFlush() { return 1; } -void NonCollectiveRootCommunicator::push(const char* packedMessagesToBeSent, - std::vector& receivedPackedMessages) +void NonCollectiveRootCommunicator::push( + const char* packedMessagesToBeSent, + std::vector& receivedPackedMessages) { if(m_mpiCommRank == 0) { @@ -54,15 +58,14 @@ void NonCollectiveRootCommunicator::push(const char* packedMessagesToBeSent, if(isPackedMessagesEmpty(currPackedMessages)) { - if (currPackedMessages == nullptr ) + if(currPackedMessages == nullptr) { receive_messages = false; } else { - delete [] currPackedMessages; + delete[] currPackedMessages; } - } else { @@ -70,7 +73,6 @@ void NonCollectiveRootCommunicator::push(const char* packedMessagesToBeSent, } currPackedMessages = nullptr; - } } else diff --git a/src/axom/lumberjack/tests/lumberjack_NonCollectiveRootCommunicator.hpp b/src/axom/lumberjack/tests/lumberjack_NonCollectiveRootCommunicator.hpp index fd3f3bf2c4..52f4813862 100644 --- a/src/axom/lumberjack/tests/lumberjack_NonCollectiveRootCommunicator.hpp +++ b/src/axom/lumberjack/tests/lumberjack_NonCollectiveRootCommunicator.hpp @@ -13,7 +13,7 @@ TEST(lumberjack_NonCollectiveRootCommunicator, noncollective_communication) int commSize = -1; MPI_Comm_size(MPI_COMM_WORLD, &commSize); - + const int ranksLimit = 5; axom::lumberjack::NonCollectiveRootCommunicator c; @@ -24,7 +24,7 @@ TEST(lumberjack_NonCollectiveRootCommunicator, noncollective_communication) std::vector receivedPackedMessages; // send message only from even ranks - if ((c.rank() % 2) == 0) + if((c.rank() % 2) == 0) { c.push(message.c_str(), receivedPackedMessages); } @@ -35,11 +35,12 @@ TEST(lumberjack_NonCollectiveRootCommunicator, noncollective_communication) } else { - const int numMessagesToReceive = ((commSize % 2) == 0) ? ((commSize / 2) - 1) : (commSize / 2); + const int numMessagesToReceive = + ((commSize % 2) == 0) ? ((commSize / 2) - 1) : (commSize / 2); EXPECT_EQ((int)receivedPackedMessages.size(), numMessagesToReceive); for(int i = 1; i <= numMessagesToReceive; ++i) { - std::string currMessage = std::to_string(i*2); + std::string currMessage = std::to_string(i * 2); bool found = false; for(auto& rm : receivedPackedMessages) { @@ -69,7 +70,6 @@ TEST(lumberjack_NonCollectiveRootCommunicator, noncollective_communication) } receivedPackedMessages.clear(); - } TEST(lumberjack_NonCollectiveRootCommunicator, multiple_communicators) @@ -78,7 +78,7 @@ TEST(lumberjack_NonCollectiveRootCommunicator, multiple_communicators) int commSize = -1; MPI_Comm_size(MPI_COMM_WORLD, &commSize); - + const int ranksLimit = 5; axom::lumberjack::NonCollectiveRootCommunicator c1; axom::lumberjack::NonCollectiveRootCommunicator c2; @@ -95,5 +95,4 @@ TEST(lumberjack_NonCollectiveRootCommunicator, multiple_communicators) c2.finalize(); MPI_Barrier(MPI_COMM_WORLD); - } \ No newline at end of file