ElfPSP_AntColony
Protein Structure Prediction using Ant Colony Optimization
Public Member Functions | Private Member Functions | Private Attributes | List of all members
InterProcess Class Reference

Encapsulates interprocess communication among MPI nodes. More...

Public Member Functions

 InterProcess (int numDirections)
 Default constructor. More...
 
 ~InterProcess ()
 Deletes internal buffers. More...
 
void send_solution (const vector< char > &directions, int contacts, int destIdx)
 Sends a solution to another MPI node. More...
 
void recv_solution (vector< char > &directions, int &contacts, int srcIdx)
 Received a solution from another MPI node. More...
 

Private Member Functions

void serialize_solution (const vector< char > &directions, int nContacts)
 Serializes the given data within the internal send buffer. More...
 
vector< char > deserialize_solution (int &nContacts)
 Deserializes data from the internal receive buffer. More...
 

Private Attributes

int dBufSize
 Size, in bytes, of recv and send buffers. More...
 
void * dSendBuffer
 Send buffer. More...
 
void * dRecvBuffer
 Receive buffer. More...
 

Detailed Description

Encapsulates interprocess communication among MPI nodes.

This class's best contribution is to hold buffers than can be reused throughout many communications. A strong assumption here is that the machines are homogeneous, so we can pass raw bytes between them.

Constructor & Destructor Documentation

◆ InterProcess()

InterProcess::InterProcess ( int  numDirections)
inline

Default constructor.

Parameters
numDirectionsnumber of relative directions that each protein solution holds. This is used to calculate the internal buffer sizes.

◆ ~InterProcess()

InterProcess::~InterProcess ( )
inline

Deletes internal buffers.

Member Function Documentation

◆ deserialize_solution()

vector<char> InterProcess::deserialize_solution ( int &  nContacts)
inlineprivate

Deserializes data from the internal receive buffer.

Parameters
nContactsDeserialized number of contacts is returned in this variable.
Returns
Deserialized vector of relative directions.

◆ recv_solution()

void InterProcess::recv_solution ( vector< char > &  directions,
int &  contacts,
int  srcIdx 
)
inline

Received a solution from another MPI node.

Parameters
directions
contacts
srcIdxIdentifier for the MPI node from which we should receive the data.

◆ send_solution()

void InterProcess::send_solution ( const vector< char > &  directions,
int  contacts,
int  destIdx 
)
inline

Sends a solution to another MPI node.

Parameters
directions
contacts
destIdxIdentifier for the MPI node that should receive the data.

◆ serialize_solution()

void InterProcess::serialize_solution ( const vector< char > &  directions,
int  nContacts 
)
inlineprivate

Serializes the given data within the internal send buffer.

Member Data Documentation

◆ dBufSize

int InterProcess::dBufSize
private

Size, in bytes, of recv and send buffers.

◆ dRecvBuffer

void* InterProcess::dRecvBuffer
private

Receive buffer.

◆ dSendBuffer

void* InterProcess::dSendBuffer
private

Send buffer.


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