Skip to content

Commit

Permalink
fixed tag and flag comparison type, renamed NonBlockingRootCommunicat…
Browse files Browse the repository at this point in the history
…or to NonCollectiveRootCommunicator
  • Loading branch information
gberg617 committed Dec 13, 2024
1 parent 4835c73 commit 7921ec5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions src/axom/lumberjack/MPIUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ const char* mpiBlockingReceiveMessages(MPI_Comm comm)
return charArray;
}

const char* mpiNonBlockingReceiveMessages(MPI_Comm comm, const int tag)
const char* mpiNonBlockingReceiveMessages(MPI_Comm comm, int tag)
{
const int mpiTag = (tag == false) ? LJ_TAG : tag;
const int mpiTag = (tag == 0) ? LJ_TAG : tag;
char* charArray = nullptr;
int messageSize = -1;
MPI_Status mpiStatus;

// Get size and source of MPI message
int mpiFlag = true;
int mpiFlag = 0;
MPI_Iprobe(MPI_ANY_SOURCE, tag, comm, &mpiFlag, &mpiStatus);

if (mpiFlag == true) {
if (mpiFlag == 1) {
MPI_Get_count(&mpiStatus, MPI_CHAR, &messageSize);

// Setup where to receive the char array
Expand All @@ -83,9 +83,9 @@ const char* mpiNonBlockingReceiveMessages(MPI_Comm comm, const int tag)
void mpiNonBlockingSendMessages(MPI_Comm comm,
int destinationRank,
const char* packedMessagesToBeSent,
const int tag)
int tag)
{
const int mpiTag = (tag == false) ? LJ_TAG : tag;
const int mpiTag = (tag == 0) ? LJ_TAG : tag;
MPI_Request mpiRequest;
MPI_Isend(const_cast<char*>(packedMessagesToBeSent),
strlen(packedMessagesToBeSent),
Expand Down
4 changes: 2 additions & 2 deletions src/axom/lumberjack/MPIUtility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const char* mpiBlockingReceiveMessages(MPI_Comm comm);
* \param [in] comm The MPI Communicator.
*****************************************************************************
*/
const char* mpiNonBlockingReceiveMessages(MPI_Comm comm, const int tag = 0);
const char* mpiNonBlockingReceiveMessages(MPI_Comm comm, int tag = 0);

/*!
*****************************************************************************
Expand All @@ -57,7 +57,7 @@ const char* mpiNonBlockingReceiveMessages(MPI_Comm comm, const int tag = 0);
void mpiNonBlockingSendMessages(MPI_Comm comm,
int destinationRank,
const char* packedMessagesToBeSent,
const int tag = 0);
int tag = 0);
} // end namespace lumberjack
} // end namespace axom

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@
/*!
******************************************************************************
*
* \file NonBlockingRootCommunicator.cpp
* \file NonCollectiveRootCommunicator.cpp
*
* \brief Implementation of the NonBlockingRootCommunicator class.
* \brief Implementation of the NonCollectiveRootCommunicator class.
*
******************************************************************************
*/

#include "axom/lumberjack/NonBlockingRootCommunicator.hpp"
#include "axom/lumberjack/NonCollectiveRootCommunicator.hpp"
#include "axom/lumberjack/MPIUtility.hpp"

namespace axom
{
namespace lumberjack
{
void NonBlockingRootCommunicator::initialize(MPI_Comm comm, int ranksLimit)
void NonCollectiveRootCommunicator::initialize(MPI_Comm comm, int ranksLimit)
{
m_mpiComm = comm;
MPI_Comm_rank(m_mpiComm, &m_mpiCommRank);
MPI_Comm_size(m_mpiComm, &m_mpiCommSize);
m_ranksLimit = ranksLimit;
}

void NonBlockingRootCommunicator::finalize() { }
void NonCollectiveRootCommunicator::finalize() { }

int NonBlockingRootCommunicator::rank() { return m_mpiCommRank; }
int NonCollectiveRootCommunicator::rank() { return m_mpiCommRank; }

void NonBlockingRootCommunicator::ranksLimit(int value) { m_ranksLimit = value; }
void NonCollectiveRootCommunicator::ranksLimit(int value) { m_ranksLimit = value; }

int NonBlockingRootCommunicator::ranksLimit() { return m_ranksLimit; }
int NonCollectiveRootCommunicator::ranksLimit() { return m_ranksLimit; }

int NonBlockingRootCommunicator::numPushesToFlush() { return 1; }
int NonCollectiveRootCommunicator::numPushesToFlush() { return 1; }

void NonBlockingRootCommunicator::push(const char* packedMessagesToBeSent,
void NonCollectiveRootCommunicator::push(const char* packedMessagesToBeSent,
std::vector<const char*>& receivedPackedMessages)
{
constexpr int mpiTag = 32767;
Expand Down Expand Up @@ -78,7 +78,7 @@ void NonBlockingRootCommunicator::push(const char* packedMessagesToBeSent,
}
}

bool NonBlockingRootCommunicator::isOutputNode()
bool NonCollectiveRootCommunicator::isOutputNode()
{
if(m_mpiCommRank == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

/*!
*******************************************************************************
* \file NonBlockingRootCommunicator.hpp
* \file NonCollectiveRootCommunicator.hpp
*
* \brief This file contains the class definition of the
* NonBlockingRootCommunicator.
* NonCollectiveRootCommunicator.
*******************************************************************************
*/

#ifndef NONBLOCKINGROOTCOMMUNICATOR_HPP
#define NONBLOCKINGROOTCOMMUNICATOR_HPP
#ifndef NONCollectiveROOTCOMMUNICATOR_HPP
#define NONCollectiveROOTCOMMUNICATOR_HPP

#include "axom/lumberjack/Lumberjack.hpp"
#include "axom/lumberjack/Communicator.hpp"
Expand All @@ -24,13 +24,13 @@ namespace lumberjack
{
/*!
*******************************************************************************
* \class NonBlockingRootCommunicator
* \class NonCollectiveRootCommunicator
*
* \brief Based off of RootCommunicator. This communicator pushes
messages from any rank to root non-collectively, if any messages are sent.
*******************************************************************************
*/
class NonBlockingRootCommunicator : public axom::lumberjack::Communicator
class NonCollectiveRootCommunicator : public axom::lumberjack::Communicator
{
public:
/*!
Expand Down

0 comments on commit 7921ec5

Please sign in to comment.