Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages

BspCentral Class Reference

#include <BspCentral.hpp>

Collaboration diagram for BspCentral:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BspCentral (Config &config)
void registerRemoteIor (int pid, string ior)
void takeYourPid (int pid)
void waitGlobalInit ()
void initSlave (string processZeroIor)
int getPid ()
void setPid (int pid_)
void setTotalNumProcs (int numProcs)
int getTotalNumProcs ()
string getIor ()
void bspPut (int pid, void *src, void *dst, int offset, int nBytes)
void bspSynch ()
void bspSynchDone ()
void bspLocalSynch ()
void addPendingPut (const BspPut &bspPut)
void addPendingRegistration (void *ident, int size)
void addPendingDeregistration (void *ident)
void bspEnd ()
void bspGet (int pid, void *src, int offset, void *dst, int nBytes)
void bspGetRequest (const BspGetRequest &request)
void bspGetReply (const BspGetReply &reply)
void bspGetReplyFowarder (const int &pid, const BspGetReply &reply)

Private Member Functions

int getNextPid ()
string getIor (int taskNum)
string getTaskId (int taskNum)

Private Attributes

BspProxyStubPool stubPool
std::map< int, std::string > tasks
std::map< int, std::string > iors
int myPid
int totalNumProcs
GuardedVariable< int > superstep
GuardedVariable< int > synchedProcecess
GuardedVariable< int > pids
DrmaManager drmaManager
pthread_mutex_t bspSynchLock
Condition globalInitDone
Condition synchDone

Detailed Description

BspCentral - Encapsulates BSP logic.

BspCentral contais methods needed by a BSP application. It contains a server side, represented by BspProxyImpl, and a client side implemented by BspProxyStubPool. It also implements the methods defined by BspProxy and fowarded by BspProxyImpl.

Author:
Andrei Goldchleger
Date:
november/2003


Constructor & Destructor Documentation

BspCentral::BspCentral Config config  ) 
 

Constructs a BspCentral object

Parameters:
config - Configuration parameters such as ORB & IDL path


Member Function Documentation

void BspCentral::addPendingDeregistration void *  ident  ) 
 

Deregister the LAST registration of a given memory address

Parameters:
ident - the memory address of the registration to be removed

void BspCentral::addPendingPut const BspPut bspPut  ) 
 

Adds a pending remote bsp_put request to the DrmaManager

Parameters:
bspPut - the BspPut representing the put

void BspCentral::addPendingRegistration void *  ident,
int  size
 

Registers a memory area as globally accessible to all BSP tasks

Parameters:
ident - Memory address to be registered
size - The size of the memory area being registered

void BspCentral::bspEnd  ) 
 

FIXME Uninplemented

void BspCentral::bspGet int  pid,
void *  src,
int  offset,
void *  dst,
int  nBytes
 

Implements the bsp_get method. Allows the local task to read from memory from a remote process.

Parameters:
pid - The BSP process ID from where memory contents will be read
src - Memory address from where data will be copied
offset - Offset that will be added to the source address to determine the starting position from where data will be copied
dst - The destination address to were data will be written
nBytes - Number of bytes to be read

void BspCentral::bspGetReply const BspGetReply reply  ) 
 

Called by another BSP task in order to reply to one of our bspGetRequets

Parameters:
reply - Contains information regarding the reply

void BspCentral::bspGetReplyFowarder const int &  pid,
const BspGetReply reply
 

Called by DrmaManager in order to reply to a bspGetRequest originated from a remote process

Parameters:
pid - The BSP process ID of the process that issued the request
reply - Information suach as the memory contents to be copied to the remote task, destination address, etc...

void BspCentral::bspGetRequest const BspGetRequest request  ) 
 

Called by another BSP task in order to request the contents of a given memory area.

Parameters:
request - Contains information regarding the request

void BspCentral::bspLocalSynch  ) 
 

Indicates that the local BSP task reached a synchronization barrier and is awaiting for global synchronization

void BspCentral::bspPut int  pid,
void *  src,
void *  dst,
int  offset,
int  nBytes
 

The implementation of the bsp_put operation. Allows a BSP task to write on the address space of a task.

Parameters:
pid - The BSP process ID of the remote task on which bsp_put is going to be invoked
src - The local address from which memory contents will be copied to the remote BSP task
dst - The local address that will be translated to a logical BSP addressm, which is unique to all BSP tasks
offset - an offset from src that will hold when copying the memory area to the remote BSP task
nBytes - the number of bytes to be copied from src + offset to dst

void BspCentral::bspSynch  ) 
 

Called on Process Zero to indicate that a given process reached the barrier synchronization.

void BspCentral::bspSynchDone  ) 
 

Called by process zero on each remote BSP task to indicate that the current barrier synchronization is complete.

string BspCentral::getIor  ) 
 

Gets the IOR of the local process

string BspCentral::getIor int  taskNum  )  [private]
 

Gets the IOR of a given task

Parameters:
taskNum - PID of a BSP task

int BspCentral::getNextPid  )  [private]
 

Returns the next BSP PID that should be attributed to a BSP task.

int BspCentral::getPid  )  [inline]
 

Return the BSP PID of the local task

string BspCentral::getTaskId int  taskNum  )  [private]
 

Gets the BspProxyStubPool ID of a given task

Parameters:
taskNum - PID of a BSP task

int BspCentral::getTotalNumProcs  )  [inline]
 

Gets the total number of tasks in the BSP application

void BspCentral::initSlave string  processZeroIor  ) 
 

Initializes the BspCentral when the task in question is a slave, that is, not the process zero.

Parameters:
processZeroIor - IOR of process zero

void BspCentral::registerRemoteIor int  pid,
string  ior
 

Register the IOR of a remote BSP task. This method encapsulate the logic of the method defined in BspProxy IDL interface and fowarded by BspProxyImpl

Parameters:
pid - the BSP PID of the remote task
ior - the IOR of the emote task

void BspCentral::setPid int  pid_  )  [inline]
 

Sets the BSP PID of the local task

void BspCentral::setTotalNumProcs int  numProcs  )  [inline]
 

Sets the total number of tasks in the BSP application

void BspCentral::takeYourPid int  pid  ) 
 

Receives a PID from process zero. This method encapsulate the logic of the method defined in BspProxy IDL interface and fowarded by BspProxyImpl.

Parameters:
pid - the new BSP PID for this task

void BspCentral::waitGlobalInit  ) 
 

Blocks until initialization is complete, that is all tasks know all the PIDs and IORs of each other


Member Data Documentation

pthread_mutex_t BspCentral::bspSynchLock [private]
 

Lock to avoid race conditions between local and remote synchronization requests. Relevant only to process zero

DrmaManager BspCentral::drmaManager [private]
 

DrmaManager object. Responsible for DRMA operations

Condition BspCentral::globalInitDone [private]
 

Indicates Wether or not global initialization is complete, that is, each tasks has its pid and knows the IORs of each other

std::map<int, std::string> BspCentral::iors [private]
 

iors of the remote tasks

int BspCentral::myPid [private]
 

PID of this BSP task

GuardedVariable<int> BspCentral::pids [private]
 

Last pid atributted to a BSP tast. Relevant to process zero only.

BspProxyStubPool BspCentral::stubPool [private]
 

The stubPool contains proxies for each of the other BSP tasks

GuardedVariable<int> BspCentral::superstep [private]
 

The current superstep of the BSP application

Condition BspCentral::synchDone [private]
 

Indicate wether or not a bsp_synch is complete

GuardedVariable<int> BspCentral::synchedProcecess [private]
 

Number of tasks that called bsp_synch. Relevant to process zero only.

std::map<int, std::string> BspCentral::tasks [private]
 

Ids for proxy retrieval from the stubPool

int BspCentral::totalNumProcs [private]
 

Total number of tasks in the BSP program


The documentation for this class was generated from the following files:
Generated on Mon Sep 6 16:13:09 2004 by doxygen 1.3.3