FreeNOS
|
Implements a MPI backend for the host OS which communicates with mpiproxy servers. More...
#include <MpiHost.h>
Data Structures | |
struct | Node |
Describes a remote CPU node accessible via MPI. More... | |
struct | Packet |
Describes data received via UDP. More... | |
Public Member Functions | |
MpiHost () | |
Constructor. More... | |
virtual Result | initialize (int *argc, char ***argv) |
Initialize the backend. More... | |
virtual Result | terminate () |
Terminate the backend. More... | |
virtual Result | getCommRank (MPI_Comm comm, int *rank) |
Retrieve communication rank (core id) More... | |
virtual Result | getCommSize (MPI_Comm comm, int *size) |
Retrieve communication size (total cores) More... | |
virtual Result | send (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) |
Synchronous send data. More... | |
virtual Result | receive (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status) |
Synchronous receive data. More... | |
Private Member Functions | |
Result | parseHostsFile (const char *hostsfile) |
Parse the given hosts file. More... | |
Result | startProcesses (int argc, char **argv) |
Start remote processes. More... | |
Result | sendPacket (const Size nodeId, const void *packet, const Size size) const |
Send UDP packet to a remote node. More... | |
Result | receivePacket (const Size nodeId, const MpiProxy::Operation operation, void *packet, Size &size) |
Receive UDP packet from remote node. More... | |
Private Attributes | |
int | m_sock |
UDP socket for communicating with remote nodes. More... | |
Index< Node, MaximumNodes > | m_nodes |
Contains all known nodes that participate in the computation. More... | |
Index< List< Packet * >, MaximumNodes > | m_packetBuffers |
Buffers incoming packets for later processing. More... | |
Static Private Attributes | |
static const Size | MaximumNodes = 512 |
Maximum number of supported nodes. More... | |
Additional Inherited Members | |
Public Types inherited from MpiBackend | |
typedef int | Result |
Result code. More... | |
Static Public Member Functions inherited from AbstractFactory< MpiBackend > | |
static MpiBackend * | create () |
Abstract function to create an instance of T. More... | |
Implements a MPI backend for the host OS which communicates with mpiproxy servers.
MpiHost::MpiHost | ( | ) |
Constructor.
Definition at line 37 of file MpiHost.cpp.
|
virtual |
Retrieve communication rank (core id)
comm | Communication reference |
rank | Output the communication rank number |
Implements MpiBackend.
Definition at line 156 of file MpiHost.cpp.
References MPI_SUCCESS.
|
virtual |
Retrieve communication size (total cores)
comm | Communication reference |
size | Output the communication size |
Implements MpiBackend.
Definition at line 163 of file MpiHost.cpp.
References m_nodes, and MPI_SUCCESS.
|
virtual |
Initialize the backend.
Implements MpiBackend.
Definition at line 41 of file MpiHost.cpp.
References MpiHost::Node::coreId, errno, ERROR, MpiHost::Node::ipAddress, m_nodes, m_sock, memset(), MPI_ERR_ARG, MPI_ERR_IO, MPI_SUCCESS, parseHostsFile(), startProcesses(), strerror(), and MpiHost::Node::udpPort.
|
private |
Parse the given hosts file.
hostsfile | Path to the hosts file to parse |
Definition at line 315 of file MpiHost.cpp.
References atoi(), MpiHost::Node::coreId, List< T >::count(), DEBUG, errno, ERROR, fclose(), fopen(), fread(), ListIterator< T >::hasCurrent(), MpiHost::Node::ipAddress, m_nodes, m_packetBuffers, MPI_ERR_ARG, MPI_ERR_IO, MPI_ERR_NO_MEM, MPI_SUCCESS, NULL, String::split(), stat::st_size, stat(), strerror(), and MpiHost::Node::udpPort.
Referenced by initialize().
|
virtual |
Synchronous receive data.
buf | Output data buffer |
count | Number of data items |
datatype | Type of data |
source | Source to receive data from (core id) |
tag | Optional data identifier to receive |
comm | Communication reference |
status | Output the MPI status |
Implements MpiBackend.
Definition at line 236 of file MpiHost.cpp.
References MpiHost::Node::coreId, MpiProxy::Header::coreId, MpiProxy::Header::datacount, MpiProxy::Header::datatype, ERROR, header, m_nodes, MpiProxy::MaximumPacketSize, MPI_ERR_RANK, MPI_ERR_UNSUPPORTED_DATAREP, MPI_INT, MPI_SUCCESS, MPI_UNSIGNED_CHAR, MpiProxy::MpiOpRecv, MpiProxy::Header::operation, MpiProxy::Header::rankId, receivePacket(), sendPacket(), and ZERO.
|
private |
Receive UDP packet from remote node.
nodeId | Identification number of the node to receive from |
operation | Expected MPI operation value of the packet |
packet | Payload output |
size | Output for number of bytes received |
Definition at line 537 of file MpiHost.cpp.
References MemoryBlock::copy(), MpiHost::Node::coreId, MpiProxy::Header::coreId, MpiHost::Packet::data, DEBUG, errno, ERROR, ListIterator< T >::hasCurrent(), MpiHost::Node::ipAddress, m_nodes, m_packetBuffers, m_sock, MPI_ERR_ARG, MPI_ERR_IO, MPI_ERR_NO_MEM, MPI_SUCCESS, MpiProxy::Header::operation, MpiProxy::Header::rankId, recvfrom(), MpiHost::Packet::size, strerror(), MpiHost::Node::udpPort, and ZERO.
Referenced by receive(), startProcesses(), and terminate().
|
virtual |
Synchronous send data.
buf | Input data buffer |
count | Number of data items |
datatype | Type of data |
dest | Destination to send to (core id) |
tag | Optional data identifier to send |
comm | Communication reference |
Implements MpiBackend.
Definition at line 170 of file MpiHost.cpp.
References MemoryBlock::copy(), MpiHost::Node::coreId, MpiProxy::Header::coreId, MpiProxy::Header::datacount, MpiProxy::Header::datatype, ERROR, m_nodes, MpiProxy::MaximumPacketSize, MPI_ERR_ARG, MPI_INT, MPI_SUCCESS, MPI_UNSIGNED_CHAR, MpiProxy::MpiOpSend, MpiProxy::Header::operation, MpiProxy::Header::rankId, MpiProxy::Header::result, sendPacket(), and ZERO.
|
private |
Send UDP packet to a remote node.
nodeId | Identification number of the node |
packet | Buffer with data to send |
size | Number of bytes to send |
Definition at line 506 of file MpiHost.cpp.
References DEBUG, errno, ERROR, MpiHost::Node::ipAddress, m_nodes, m_sock, MPI_ERR_ARG, MPI_ERR_IO, MPI_SUCCESS, sendto(), strerror(), MpiHost::Node::udpPort, and ZERO.
Referenced by receive(), send(), startProcesses(), and terminate().
|
private |
Start remote processes.
Definition at line 418 of file MpiHost.cpp.
References basename(), MemoryBlock::copy(), MpiProxy::Header::coreCount, coreId, MpiProxy::Header::coreId, DEBUG, ERROR, String::length(), m_nodes, MpiProxy::MaximumPacketSize, MPI_SUCCESS, MpiProxy::MpiOpExec, NOTICE, MpiProxy::Header::operation, MpiProxy::Header::rankId, receivePacket(), MpiProxy::Header::result, and sendPacket().
Referenced by initialize().
|
virtual |
Terminate the backend.
Implements MpiBackend.
Definition at line 105 of file MpiHost.cpp.
References MpiProxy::Header::coreId, ERROR, header, m_nodes, MpiProxy::MaximumPacketSize, MPI_SUCCESS, MpiProxy::MpiOpTerminate, NOTICE, MpiProxy::Header::operation, MpiProxy::Header::rankId, receivePacket(), and sendPacket().
|
private |
Contains all known nodes that participate in the computation.
Definition at line 210 of file MpiHost.h.
Referenced by getCommSize(), initialize(), parseHostsFile(), receive(), receivePacket(), send(), sendPacket(), startProcesses(), and terminate().
|
private |
Buffers incoming packets for later processing.
Definition at line 213 of file MpiHost.h.
Referenced by parseHostsFile(), and receivePacket().
|
private |
UDP socket for communicating with remote nodes.
Definition at line 207 of file MpiHost.h.
Referenced by initialize(), receivePacket(), and sendPacket().
|
staticprivate |