Go to the documentation of this file.
24 , m_mpiInitResult(
MPI_Init(&m_argc, &m_argv))
46 ERROR(
"failed to lookup MPI rank: result = " << result);
62 ERROR(
"failed to lookup MPI core count: result = " << result);
65 NOTICE(
"ping " << (cores - 1) <<
" cores");
68 for (
int i = 1; i < cores; i++)
73 ERROR(
"failed to send ping to core" << i <<
": result = " << (
int) pingResult);
80 ERROR(
"failed to receive pong from core" << i <<
": result = " << (
int) pongResult);
84 NOTICE(
"pong received from core" << i);
93 ERROR(
"failed to receive ping from core0: result = " << (
int) recvResult);
100 ERROR(
"failed to send message to core0: result = " << (
int) sendResult);
108 ERROR(
"failed to finalize MPI: result = " << result);
116 const int number)
const
125 ERROR(
"failed to send message to core" <<
coreId <<
": result = " << (
int) result);
133 const int expectedNumber)
const
143 ERROR(
"failed to receive message from core" <<
coreId <<
": result = " << (
int) result);
147 if (buf != expectedNumber)
150 " received from core" <<
coreId);
virtual Result exec()
Execute the application.
Result receiveNumber(const Size coreId, const int expectedNumber) const
Receive a message containing a number.
static const int PongMagicNumber
Magic number send for the pong message.
#define NOTICE(msg)
Output a notice message.
C int MPI_Comm_size(MPI_Comm comm, int *size)
POSIX-compatible application.
void setDescription(const String &desc)
Set program description.
uint MPI_Status
Status holder.
virtual ~MpiPing()
Destructor.
#define DEBUG(msg)
Output a debug message to standard output.
C int MPI_Init(int *argc, char ***argv)
virtual Result initialize()
Initialize the application.
unsigned int Size
Any sane size indicator cannot go negative.
C int MPI_Comm_rank(MPI_Comm comm, int *rank)
Result sendNumber(const Size coreId, const int number) const
Send a message containing a number.
ArgumentParser & parser()
Get program arguments parser.
#define ERROR(msg)
Output an error message.
C int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
int m_mpiInitResult
Result of MPI initialization.
C int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)
static const int PingMagicNumber
Magic number to send as ping message.
MpiPing(int argc, char **argv)
Constructor.
int m_id
MPI core identifier (rank) of the current process.