Accelerated Computation Engine
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Ace::QMPI Class Reference

#include <ace_qmpi.h>

Inheritance diagram for Ace::QMPI:

Public Slots

void sendData (int toRank, const QByteArray &data)
 
void sendLocalData (int toRank, const QByteArray &data)
 

Signals

void dataReceived (const QByteArray &data, int fromRank)
 
void localDataReceived (const QByteArray &data, int fromRank)
 

Public Member Functions

bool isMaster () const
 
int size () const
 
int rank () const
 
int localSize () const
 
int localRank () const
 
void start ()
 
void stop ()
 

Static Public Member Functions

static QMPIinstance ()
 
static void shutdown ()
 

Protected Member Functions

virtual void timerEvent (QTimerEvent *event) override final
 

Detailed Description

This is a wrapper to the MPI interface. It provides support for basic MPI functionality including initializing MPI, getting rank and size for world and local, and sending and receiving data for world and local. This provides sending and receiving of data by using Qt slots and signals to allow for event handling through Qt's event handling system. This is a singleton class which only has a single instance you can access through a special static function. This singleton class is however special in it has to be shutdown before exiting the program and cannot be initialized more than once. This requirement is due to how MPI works.

Listening for incoming MPI messages can also be enabled or disabled, and is disabled by default.

Member Function Documentation

◆ dataReceived

void Ace::QMPI::dataReceived ( const QByteArray &  data,
int  fromRank 
)
signal

Signals that new data has been received from the world MPI comm.

Parameters
dataThe data received from the world comm.
fromRankThe rank of the node that sent this data.

◆ instance()

QMPI & QMPI::instance ( )
static

This returns a reference to the singleton instance of this class if shutdown of another instance has not occurred. If MPI was already initialized it simply returns a reference to the instance.

Returns
Reference to the singleton instance of this class.

◆ isMaster()

bool QMPI::isMaster ( ) const

Tests if this process is the master node (rank 0).

Returns
Returns true if this is the master node else returns false.

◆ localDataReceived

void Ace::QMPI::localDataReceived ( const QByteArray &  data,
int  fromRank 
)
signal

Signals that new data has been received from the local shared resource MPI comm.

Parameters
dataThe data received from the local comm.
fromRankThe local rank of the node that sent this data.

◆ localRank()

int QMPI::localRank ( ) const

Returns the local rank of this node to identify it within the number of other nodes that share its local resources.

Returns
Local rank of this node.

◆ localSize()

int QMPI::localSize ( ) const

Returns the local size representing the number of nodes that share local resources.

Returns
Size of nodes that share local resources.

◆ rank()

int QMPI::rank ( ) const

Returns the world rank of this node.

Returns
World rank of this node.

◆ sendData

void QMPI::sendData ( int  toRank,
const QByteArray &  data 
)
slot

Called to send data to another node using the world MPI comm. This is asynchronous and returns immediately.

Parameters
toRankThe rank of the node to send this data to.
dataThe data that is sent to the node with the given rank.

◆ sendLocalData

void QMPI::sendLocalData ( int  toRank,
const QByteArray &  data 
)
slot

Called to send data to another node using the local MPI comm. This is asynchronous and returns immediately.

Parameters
toRankThe rank of the process to send this data to.
dataStores the raw data that will be sent to the given process.

◆ shutdown()

void QMPI::shutdown ( )
static

This deletes the singleton instance of this class thereby shutting down the MPI system. After calling this another instance cannot be initialized or referenced.

◆ size()

int QMPI::size ( ) const

Returns world node size.

Returns
World node size.

◆ start()

void QMPI::start ( )

Enables listening to incoming MPI messages and emitting signals when they are received.

◆ stop()

void QMPI::stop ( )

Disables listening to incoming MPI messages, leaving any pending messages until it is enabled.

◆ timerEvent()

void QMPI::timerEvent ( QTimerEvent *  event)
finaloverrideprotectedvirtual

Implements the QObject interface that is called whenever the timer event is fired. This function is used to poll for new data from the MPI system without blocking and firing signals for any new data received.

Parameters
eventIgnored Qt event data since this class only has a single timer event active.

The documentation for this class was generated from the following files: