#define FALSE

FALSE is defined as 0

A. Resource Management Functions
virtual void exit( int exitval )
System shutdown
virtual int setup( int argc, char* argv[], int *my_id, int *master_id )
Initialization of the master process
virtual int config( int *nhosts, int *narches, MWWorkerID ***w )
This returns the state of the "virtual machine" - aka the set of workers under the master's control
virtual int start_worker( MWWorkerID *w )
Start a worker on a machine that has been given to you
virtual int init_beginning_workers( int *nworkers, MWWorkerID ***workers )
This routine is used to start up multiple workers at the beginning of a run
virtual int removeWorker( MWWorkerID *w )
Remove a worker from the virtual machine
B. Checkpointing Functions
virtual int write_checkpoint( FILE * fp )
Write out internal state to a FILE *
virtual int read_checkpoint( FILE * fp )
Read in restart information from a FILE *
virtual int read_RMstate( FILE *fp )
Some Low level specific read/write functions
virtual int write_RMstate( FILE *fp )
C. Other public functions
void set_worker_attributes( int arch_class, char *exec_name, char *requirements )
Set the name of the binary and the requirements string for an arch class
virtual void processExec( char*, char* )
If the RM software needs to "process" the executable name in some way, this is done here
int get_num_arches()
Return the number of arch classes
void set_num_arches( int n )
Set the number of arch classes
virtual void set_worker_checkpointing( bool wc )
Set whether or not you would like worker checkpointing (if the CommRM implementation has the capability)
D. Host Management Members
virtual int hostaddlogic( int *num_workers )
This will figure out if we need to ask for more hosts or remove hosts
void set_target_num_workers( int num_workers )
Set a "target" number of workers across all arches
E. Some Protected Data
char worker_executables[16][_POSIX_PATH_MAX]
An array containing the full pathnames of the executables
char worker_requirements[16][1024]
An array containing the requirements string for each arch class
int target_num_workers
The desired number of workers
int num_arches
The number of different arch classes
bool worker_checkpointing
Would you like the workers to be checkpointed
MWRMComm()
Constructor
The Communication Routines
virtual int initsend( int encoding = 0 )
Initialize a buffer for sending some data
virtual int send( int to_whom, int msgtag )
Send the data that has been packed
virtual int recv( int from_whom, int msgtag )
Receive some data that has been packed
virtual int bufinfo( int buf_id, int *len, int *tag, int *from )
Provide info on the message just received
virtual void hostadd( )
Needed only for MW-Independent
Pack Functions
virtual int pack( char *bytes, int nitem, int stride = 1 )
Pack some bytes
virtual int pack( float *f, int nitem, int stride = 1 )
float
virtual int pack( double *d, int nitem, int stride = 1 )
double
virtual int pack( int *i, int nitem, int stride = 1 )
int
virtual int pack( unsigned int *ui, int nitem, int stride = 1 )
unsigned int
virtual int pack( short *sh, int nitem, int stride = 1 )
short
virtual int pack( unsigned short *ush, int nitem, int stride = 1 )
unsigned short
virtual int pack( long *l, int nitem, int stride = 1 )
long
virtual int pack( unsigned long *ul, int nitem, int stride = 1 )
unsigned long
virtual int pack( char *string )
Pack a NULL-terminated string
Unpack Functions
virtual int unpack( char *bytes, int nitem, int stride = 1 )
Unpack some bytes
virtual int unpack( float *f, int nitem, int stride = 1 )
float
virtual int unpack( double *d, int nitem, int stride = 1 )
double
virtual int unpack( int *i, int nitem, int stride = 1 )
int
virtual int unpack( unsigned int *ui, int nitem, int stride = 1 )
unsigned int
virtual int unpack( short *sh, int nitem, int stride = 1 )
short
virtual int unpack( unsigned short *ush, int nitem, int stride = 1 )
unsigned short
virtual int unpack( long *l, int nitem, int stride = 1 )
long
virtual int unpack( unsigned long *ul, int nitem, int stride = 1 )
unsigned long
virtual int unpack( char *string )
Unpack a NULL-terminated string
virtual ~MWRMComm()
Destructor...

Documentation

FALSE is defined as 0
MWRMComm()
Constructor. Sets data to -1's.

virtual ~MWRMComm()
Destructor...

A. Resource Management Functions
Here are all the methods you could want to have for managing a set of machines. See each method for details...

virtual void exit( int exitval )
System shutdown. Does not return.
Parameters:
exitval - The value to call ::exit() with

virtual int setup( int argc, char* argv[], int *my_id, int *master_id )
Initialization of the master process. This will be called one time only when the master starts up.
Returns:
0 on success, -1 on failure

virtual int config( int *nhosts, int *narches, MWWorkerID ***w )
This returns the state of the "virtual machine" - aka the set of workers under the master's control.
Returns:
0 on success, -1 on error.
Parameters:
nhosts - The number of hosts
narches - The number of architechture classes
w - A pointer to a pointer to an array of pointers. This should be NULL when called; config() will allocate the memory using new and return it to you. Don't forget to delete not only the elements in that array, but also the array itself. The array will have nhosts elements, and they will each represent a worker machine.

virtual int start_worker( MWWorkerID *w )
Start a worker on a machine that has been given to you. This is really only important if the process of starting a worker is two-stage. For instance, in pvm, you first get a machine. THEN you have to spawn an executable on that machine. For something like MW-files, once you get a worker it already has the executable started on it. In that case this will basically be a no-op.
Returns:
id2 on success, -1 on failure
Parameters:
w - A pointer to a MWWorkerID. This must point to allocated memory. It is filled with info like the machine name, id2, and the arch.

virtual int init_beginning_workers( int *nworkers, MWWorkerID ***workers )
This routine is used to start up multiple workers at the beginning of a run. It should only be called one time. It basically does a config() to find out what machines are available, and then starts a worker on each of them. You may want to check the implementations for details...
Returns:
0 on success, -1 on failure
Parameters:
nworkers - The number of workers at the start (returned!)
workers - A pointer to a pointer to an array of MWWorkerID pointers. The memory management for this is the same as it is for the config() call - it should be null when called and will point to allocated memory when it comes back.

virtual int removeWorker( MWWorkerID *w )
Remove a worker from the virtual machine. This call will delete w, so don't reference that memory again!
Returns:
0 on success, a negative number on failure
Parameters:
w - The MWWorkerID of the machine to remove.

B. Checkpointing Functions

virtual int write_checkpoint( FILE * fp )
Write out internal state to a FILE *

virtual int read_checkpoint( FILE * fp )
Read in restart information from a FILE *

virtual int read_RMstate( FILE *fp )
Some Low level specific read/write functions

virtual int write_RMstate( FILE *fp )

C. Other public functions

void set_worker_attributes( int arch_class, char *exec_name, char *requirements )
Set the name of the binary and the requirements string for an arch class. Technically, the requirements string is not needed for MWPvmRC - it is defined in the submit file. It *is* needed in the MWFileRC, however, for job submission.
Parameters:
arch_class - This specifies which arch class the above requirements will apply to.
exec_name - The name of the worker executable for this arch class.
requirements - A string containing the "requirements" attribute of a given arch class of workers. This will be something that can be used in a submit file, like "(arch == \"INTEL\" && opsys == \"SOLARIS26\")"

virtual void processExec( char*, char* )
If the RM software needs to "process" the executable name in some way, this is done here

int get_num_arches()
Return the number of arch classes

void set_num_arches( int n )
Set the number of arch classes

virtual void set_worker_checkpointing( bool wc )
Set whether or not you would like worker checkpointing (if the CommRM implementation has the capability)

D. Host Management Members

virtual int hostaddlogic( int *num_workers )
This will figure out if we need to ask for more hosts or remove hosts. It is called whenever a host is added or removed from the system, or set_target_num_workers() is called.
Returns:
If we have more workers than we need, we return a positive number as the "excess" that can be deleted.
Parameters:
num_workers - A pointer to an array of length num_arches that contains the number of workers for each arch class.

void set_target_num_workers( int num_workers )
Set a "target" number of workers across all arches. This is useful if you don't care how many you get of each arch...
Parameters:
num_workers - The target number of workers

E. Some Protected Data

char worker_executables[16][_POSIX_PATH_MAX]
An array containing the full pathnames of the executables. Element 0 is for arch "0", element 1 is for arch "1", etc. Usually read in get get_userinfo(). The array is fixed at 16 arches - that ought to be enough!

char worker_requirements[16][1024]
An array containing the requirements string for each arch class. This is needed in MW-files.

int target_num_workers
The desired number of workers

int num_arches
The number of different arch classes

bool worker_checkpointing
Would you like the workers to be checkpointed

The Communication Routines
These message passing routines are very closely modeled on PVM's message passing facility. They are, however, pretty generic in that any message passing interface should be able to implement them.

virtual int initsend( int encoding = 0 )
Initialize a buffer for sending some data
Parameters:
encoding - Defined by each application. 0 = default

virtual int send( int to_whom, int msgtag )
Send the data that has been packed.
Parameters:
to_whom - An identifier for the recipient
msgtag - A 'tag' to identify that type of message

virtual int recv( int from_whom, int msgtag )
Receive some data that has been packed. Should make this more PVM-independent; will do this sometime.
Parameters:
from_whom - From a specific source; -1 is from all
msgtag - With a certain tag; -1 is all.

virtual int bufinfo( int buf_id, int *len, int *tag, int *from )
Provide info on the message just received

virtual void hostadd( )
Needed only for MW-Independent

Pack Functions
In the following pack() functions, there are some common themes. First, each stuffs some data into a buffer to be sent. The nitem parameter is just a count of the number of items. The stride parameter specifies *which* items to pack. 1 implies all, 2 would be every 2nd item, 3 is every 3rd item, etc.

The return value is user defined. It should be standardized, but I'll do that later.

virtual int pack( char *bytes, int nitem, int stride = 1 )
Pack some bytes

virtual int pack( float *f, int nitem, int stride = 1 )
float

virtual int pack( double *d, int nitem, int stride = 1 )
double

virtual int pack( int *i, int nitem, int stride = 1 )
int

virtual int pack( unsigned int *ui, int nitem, int stride = 1 )
unsigned int

virtual int pack( short *sh, int nitem, int stride = 1 )
short

virtual int pack( unsigned short *ush, int nitem, int stride = 1 )
unsigned short

virtual int pack( long *l, int nitem, int stride = 1 )
long

virtual int pack( unsigned long *ul, int nitem, int stride = 1 )
unsigned long

virtual int pack( char *string )
Pack a NULL-terminated string

Unpack Functions
These unpack functions unpack data packed with the pack() functions. See the pack() functions for more details.

virtual int unpack( char *bytes, int nitem, int stride = 1 )
Unpack some bytes

virtual int unpack( float *f, int nitem, int stride = 1 )
float

virtual int unpack( double *d, int nitem, int stride = 1 )
double

virtual int unpack( int *i, int nitem, int stride = 1 )
int

virtual int unpack( unsigned int *ui, int nitem, int stride = 1 )
unsigned int

virtual int unpack( short *sh, int nitem, int stride = 1 )
short

virtual int unpack( unsigned short *ush, int nitem, int stride = 1 )
unsigned short

virtual int unpack( long *l, int nitem, int stride = 1 )
long

virtual int unpack( unsigned long *ul, int nitem, int stride = 1 )
unsigned long

virtual int unpack( char *string )
Unpack a NULL-terminated string

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de