FreeNOS
|
Send a ping message via MPI to all available nodes. More...
#include <MpiPing.h>
Public Member Functions | |
MpiPing (int argc, char **argv) | |
Constructor. More... | |
virtual | ~MpiPing () |
Destructor. More... | |
virtual Result | initialize () |
Initialize the application. More... | |
virtual Result | exec () |
Execute the application. More... | |
Public Member Functions inherited from POSIXApplication | |
POSIXApplication (int argc, char **argv) | |
Class constructor. More... | |
virtual | ~POSIXApplication () |
Class destructor. More... | |
Public Member Functions inherited from Application | |
Application (int argc, char **argv) | |
Class constructor. More... | |
virtual | ~Application () |
Class destructor. More... | |
virtual int | run () |
Run the application. More... | |
Private Member Functions | |
Result | sendNumber (const Size coreId, const int number) const |
Send a message containing a number. More... | |
Result | receiveNumber (const Size coreId, const int expectedNumber) const |
Receive a message containing a number. More... | |
Private Attributes | |
int | m_mpiInitResult |
Result of MPI initialization. More... | |
int | m_id |
MPI core identifier (rank) of the current process. More... | |
Static Private Attributes | |
static const int | PingMagicNumber = 0xaabbccdd |
Magic number to send as ping message. More... | |
static const int | PongMagicNumber = 0x12345678 |
Magic number send for the pong message. More... | |
Additional Inherited Members | |
Public Types inherited from Application | |
enum | Result { Success, NotFound, IOError, InvalidArgument, ShowUsage, TimedOut, OutOfMemory } |
Result codes. More... | |
Protected Member Functions inherited from POSIXApplication | |
virtual Result | output (const char *string) const |
Print text to output. More... | |
int | runProgram (const char *path, const char **argv) |
Runs an external program. More... | |
Protected Member Functions inherited from Application | |
virtual Result | output (String &string) const |
Print string to output. More... | |
ArgumentParser & | parser () |
Get program arguments parser. More... | |
const ArgumentParser & | parser () const |
Get constant program arguments parser. More... | |
const ArgumentContainer & | arguments () const |
Get program arguments. More... | |
void | setVersion (const String &version) |
Set program version. More... | |
Protected Attributes inherited from Application | |
int | m_argc |
Input argument count. More... | |
char ** | m_argv |
Input argument values. More... | |
MpiPing::MpiPing | ( | int | argc, |
char ** | argv | ||
) |
Constructor.
Definition at line 22 of file MpiPing.cpp.
References Application::parser(), and ArgumentParser::setDescription().
|
virtual |
|
virtual |
Execute the application.
Implements Application.
Definition at line 53 of file MpiPing.cpp.
References ERROR, Application::IOError, m_id, MPI_Comm_size(), MPI_COMM_WORLD, MPI_Finalize(), MPI_SUCCESS, NOTICE, PingMagicNumber, PongMagicNumber, receiveNumber(), sendNumber(), and Application::Success.
|
virtual |
Initialize the application.
Reimplemented from Application.
Definition at line 35 of file MpiPing.cpp.
References ERROR, Application::IOError, m_id, m_mpiInitResult, MPI_Comm_rank(), MPI_COMM_WORLD, MPI_SUCCESS, and Application::Success.
|
private |
Receive a message containing a number.
coreId | Core identifier to receive the message from |
expectedNumber | The expected number value to receive |
Definition at line 132 of file MpiPing.cpp.
References coreId, DEBUG, ERROR, Number::Hex, Application::IOError, MPI_COMM_WORLD, MPI_INT, MPI_Recv(), MPI_SUCCESS, and Application::Success.
Referenced by exec().
|
private |
Send a message containing a number.
Definition at line 115 of file MpiPing.cpp.
References coreId, DEBUG, ERROR, Number::Hex, Application::IOError, MPI_COMM_WORLD, MPI_INT, MPI_Send(), MPI_SUCCESS, and Application::Success.
Referenced by exec().
|
private |
MPI core identifier (rank) of the current process.
Definition at line 100 of file MpiPing.h.
Referenced by exec(), and initialize().
|
private |
|
staticprivate |
|
staticprivate |