class MessageBus

This defines the organization of the message sending buffers.

Public Fields

[more]FILE* msgFP
File pointer for sending logged information
[more]int nSpikes
Logged data: Number of spikes sent
[more]int nNodes
Number of nodes used by the simulation
[more]int nBusy
Not used
[more]int maxBusy
Not used
[more]PACKET** BusyList
Not used
[more]MPI_Request* BusyReq
Not used - Array of request structs for msgs
[more]MPI_Status* BusyStat
Not used - Array of status structs for waiting on busy msgs
[more]int* iDone
Not used - For MPI_Waitsome to return indices in
[more]int msgSent
Count of messages sent: for testing
[more]int msgRecv
Count of messages received: for testing
[more]int pktSent
Count of packets sent: for testing
[more]int pktRecv
Count of packets received: for testing
[more]int nSend
Number of other nodes this MessageBus sends data to
[more]PACKET** SendList
Array of pointers to packets.
[more]int* SendTo
Array containing the actual ids of nodes sent to
[more]MPI_Request* SendReq
Array containing MPI_Requests (set to MPI_REQUEST_NULL)
[more]int nRecv
Number of other nodes this MessageBus receives data from
[more]int* RecvFrom
Array containing the actual ids of nodes received from
[more]int SlotNow
Current slot in incoming message ring buffer that the brain will take the messages from
[more]int nSlots
Number of slots in the incoming message ring buffer (twice the maximum synaptic delay)
[more]Message** MsgList
Array of Buffers where each slot is an upcoming timestep, so that all messages for a timestep form a list
[more]PACKET** PendList
Storage area for newly arrived packets.

Public Methods

[more] MessageBus()
Constructor builds and initializes structures used for sending and receiving
[more] ~MessageBus()
Destructor
[more]void SendSpikeMsgs(int TimeStep, int delay, int nTo, SENDITEM* ToList )
Called by Compartment to send spike messages.
[more]void SendStimMsg(int TimeStep, int nTo, char** ToList, int MsgType, double Value)
Called by Stimulus routines.
[more]void SendPacket(PACKET* Pkt, int ToNode, int TimeStep)
Called by Send*Msg and FlushMsgs - Calls MPI to send packet to other node, or if same node, links packet into PendList
[more]bool ReceiveMsgs(int timestep, bool wait)
This routine receives any MPI messages that may be waiting It uses either MPI_Probe or MPI_Iprobe (depending on wait argument), so it can either return immediately if nothing is pending, or block until something is ready to be received (to force synchronization).
[more]void SlotMsgs(PACKET* Pkt, int TimeStep)
Alfter receiving a packet filled with messages, the individual messages are inspected for their delivery time and placed in the appropriate slot of the MsgList
[more]void DeliverMsgs(int TimeStep)
Called by Brain to distribute the current timestep's messages to their destinations.
[more]void FlushMsgs(int TimeStep)
This is called (from Brain::DoThink) after cells have done their processing, but before reporting.
[more]void Sync(int TimeStep)
This is called from Brain::DoThink at the end of each timestep.
[more]bool Synched(int TimeStep )
Helper function for Sync, this function verifies that each other node this receives from has advanced far enough to allow this node to continue.
[more]void IncreaseBusy()
Not Used
[more]void PrintPktList(PACKET* )
Prints information about a packet and other packets stored in its linked list
[more]void PrintMsgList(Message* )
Prints information about a message and other messages stored in its linked list


Documentation

This defines the organization of the message sending buffers. There is an array of buffer pointers, with an entry for each node. Only the nodes this node sends to actually point to a real buffer. The others just have the array entry set to NULL. This is so that selecting the proper buffer for a message means just using the destination node as an array index.

The SendMsg routine will put its message into the buffer the array currently points to. If that fills it, the buffer is sent with MPI_Isend, the buffer pointer moved to the busy buffer list (ring buffer?) and a new buffer gotten from the free buffer list. If no free ones are left, MPI_Wait is called on the requests in the busy buffer list, to clear any pending sends and thus free the buffers.

The buffer encapsulates both the information to be sent (in PACKET), and information about the status of the send. Note trickiness with request: MPI says it's an opaque type that can be assigned & compared. Requests array has to be in order of buffers for MPI_Waitsome and send/busy/free scheme to work...

oFILE* msgFP
File pointer for sending logged information

oint nSpikes
Logged data: Number of spikes sent

oint nNodes
Number of nodes used by the simulation

oint nBusy
Not used

oint maxBusy
Not used

oPACKET** BusyList
Not used

oMPI_Request* BusyReq
Not used - Array of request structs for msgs

oMPI_Status* BusyStat
Not used - Array of status structs for waiting on busy msgs

oint* iDone
Not used - For MPI_Waitsome to return indices in

oint msgSent
Count of messages sent: for testing

oint msgRecv
Count of messages received: for testing

oint pktSent
Count of packets sent: for testing

oint pktRecv
Count of packets received: for testing

oint nSend
Number of other nodes this MessageBus sends data to

oPACKET** SendList
Array of pointers to packets. Only nodes communicated with will have actual packets

oint* SendTo
Array containing the actual ids of nodes sent to

oMPI_Request* SendReq
Array containing MPI_Requests (set to MPI_REQUEST_NULL)

oint nRecv
Number of other nodes this MessageBus receives data from

oint* RecvFrom
Array containing the actual ids of nodes received from

oint SlotNow
Current slot in incoming message ring buffer that the brain will take the messages from

oint nSlots
Number of slots in the incoming message ring buffer (twice the maximum synaptic delay)

oMessage** MsgList
Array of Buffers where each slot is an upcoming timestep, so that all messages for a timestep form a list

oPACKET** PendList
Storage area for newly arrived packets. Packets are sorted based on the time of the latest message

o MessageBus()
Constructor builds and initializes structures used for sending and receiving

o ~MessageBus()
Destructor

ovoid SendSpikeMsgs(int TimeStep, int delay, int nTo, SENDITEM* ToList )
Called by Compartment to send spike messages. It gets a SENDITEM list and count, to avoid overhead of repeated calls.
Parameters:
- TimeStep Current Timestep of the simulation
- delay The number of timesteps between creating of the spike and actual delivery time
nTo - The number of Compartments that will receive this spike message
ToList - Information about the destination compartments

ovoid SendStimMsg(int TimeStep, int nTo, char** ToList, int MsgType, double Value)
Called by Stimulus routines. It sends messages only to this node
Parameters:
- TimeStep Current TimeStep of the simulation
nTo - Number of compartents that receive this stimulus
MsgType - Whether the message is Current (I) or Voltage Clamp (V) @ @param Value The amount of current (I) or voltage (V)

ovoid SendPacket(PACKET* Pkt, int ToNode, int TimeStep)
Called by Send*Msg and FlushMsgs - Calls MPI to send packet to other node, or if same node, links packet into PendList
Parameters:
Pkt - Pointer to Packet to be sent
ToNode - ID of target node
- TimeStep The current TimeStep of the simulation

obool ReceiveMsgs(int timestep, bool wait)
This routine receives any MPI messages that may be waiting It uses either MPI_Probe or MPI_Iprobe (depending on wait argument), so it can either return immediately if nothing is pending, or block until something is ready to be received (to force synchronization).
Parameters:
timestep - The current timestep of the simulation
wait - Indicates if the message bus should block until it receives messages
Returns:
boolean to indicate if any messages are present (true)

ovoid SlotMsgs(PACKET* Pkt, int TimeStep)
Alfter receiving a packet filled with messages, the individual messages are inspected for their delivery time and placed in the appropriate slot of the MsgList
Parameters:
Pkt - Packet filled with freshly delivered messages
- TimeStep Current TimeStep of the simulation

ovoid DeliverMsgs(int TimeStep)
Called by Brain to distribute the current timestep's messages to their destinations. First, any messages still in need of sending off-node are sent, then messages that local structures need at this timestep are given to the appropriate location (Stimulus and Spike messages given to compartments).
Parameters:
- TimeStep Current TimeStep of the simulations

ovoid FlushMsgs(int TimeStep)
This is called (from Brain::DoThink) after cells have done their processing, but before reporting. It sends any remaining messages from the current timestep, or sends an empty packet to each node that receives messages from this node. This packet has the synchronization flag set.
Parameters:
- TimeStep The simulation's current Timestep

ovoid Sync(int TimeStep)
This is called from Brain::DoThink at the end of each timestep. It checks to see if all nodes that this node receives from have also finished this timestep. If not, it checks for incoming messages until they have. Also, returns empty packets to the Message Manager
Parameters:
- TimeStep Current TimeStep of the simulation

obool Synched(int TimeStep )
Helper function for Sync, this function verifies that each other node this receives from has advanced far enough to allow this node to continue.
Parameters:
- TimeStep Current TimeStep of the simulation

ovoid IncreaseBusy()
Not Used

ovoid PrintPktList(PACKET* )
Prints information about a packet and other packets stored in its linked list

ovoid PrintMsgList(Message* )
Prints information about a message and other messages stored in its linked list


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.