MALOC 0.1
Files | Classes | Typedefs | Functions
Vcom class

Virtual (currently just MPI) communications layer. More...

Files

file  vcom.h
 Class Vcom: virtual (currently just MPI) communications layer.
 

Classes

struct  sVcom
 Contains public data members for Vcom class. More...
 

Typedefs

typedef struct sVcom Vcom
 Declaration of the Vcom class as the Vcom structure

 

Functions

int Vcom_init (int *argc, char ***argv)
 The Vmp initializer.
 
int Vcom_finalize (void)
 The Vmp finalizer.
 
VcomVcom_ctor (int commtype)
 Construct the communications object. This routine sets up data members of class and initializes MPI.
 
int Vcom_ctor2 (Vcom *thee, int commtype)
 Construct the communications object. This routine sets up data members of class and initializes MPI. This is broken into two parts to be callable from FORTRAN.
 
void Vcom_dtor (Vcom **thee)
 Destroy the communications object.
 
void Vcom_dtor2 (Vcom *thee)
 Destroy the communications object. This is broken into two parts to be callable from FORTRAN.
 
int Vcom_send (Vcom *thee, int des, void *buf, int len, int type, int block)
 Send a buffer. Returns 1 on success.
 
int Vcom_recv (Vcom *thee, int src, void *buf, int len, int type, int block)
 Receive a (character) buffer.
The blocking flag is present, but not used. All receives are assumed to be blocking. A non-blocking receive would be very ugly to implement (signals or something?).
 
int Vcom_getCount (Vcom *thee, int src, int *length, int type)
 Perform a blocking probe to get the length (in number of items of specified type) of an incoming message and place it in the
argument ``length".
 
int Vcom_reduce (Vcom *thee, void *sendbuf, void *recvbuf, int length, int type, int op)
 Perform a reduction of the data across all processors. This is equivalent (and in the case of MPI is identical to) MPI_Allreduce. Basically, the specified operations are appleed to each member of
the sendbuf across all processors and the results are written to recvbuf.
 
int Vcom_size (Vcom *thee)
 Get the number of PEs in communicator.
 
int Vcom_resize (Vcom *thee, int newsize)
 Resize (shrink) the communications group to include only newsize number of processors.
Obsolete processes are given rank of -1 and size of 0.
 
int Vcom_rank (Vcom *thee)
 Get the ID of the local PE

 
int Vcom_barr (Vcom *thee)
 Synchronization barrier.
 

Detailed Description

Virtual (currently just MPI) communications layer.

Typedef Documentation

◆ Vcom

typedef struct sVcom Vcom

Declaration of the Vcom class as the Vcom structure

Author
Michael Holst
Returns
None

Function Documentation

◆ Vcom_barr()

int Vcom_barr ( Vcom thee)

Synchronization barrier.

Author
Michael Holst
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
1 if successful.
Parameters
theePointer to the communications object

◆ Vcom_ctor()

Vcom * Vcom_ctor ( int  commtype)

Construct the communications object. This routine sets up data members of class and initializes MPI.

Author
Michael Holst
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
Pointer to the new allocated communications object.
Parameters
commtypetype of communications object

◆ Vcom_ctor2()

int Vcom_ctor2 ( Vcom thee,
int  commtype 
)

Construct the communications object. This routine sets up data members of class and initializes MPI. This is broken into two parts to be callable from FORTRAN.

Authors
Nathan Baker and Michael Holst
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
Success enumeration
Parameters
theePointer to the new allocated communications object.
commtypetype of communications object

◆ Vcom_dtor()

void Vcom_dtor ( Vcom **  thee)

Destroy the communications object.

Authors
Nathan Baker and Michael Holst
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
None
Parameters
theePointer to the communications object.

◆ Vcom_dtor2()

void Vcom_dtor2 ( Vcom thee)

Destroy the communications object. This is broken into two parts to be callable from FORTRAN.

Authors
Nathan Baker and Michael Holst
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
None
Parameters
theePointer to the communications object.

◆ Vcom_finalize()

int Vcom_finalize ( void  )

The Vmp finalizer.

Author
Michael Holst
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
Success enumeration

◆ Vcom_getCount()

int Vcom_getCount ( Vcom thee,
int  src,
int *  length,
int  type 
)

Perform a blocking probe to get the length (in number of items of specified type) of an incoming message and place it in the
argument ``length".

Author
Nathan Baker
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
Success enumeration
Parameters
theePointer to the communications object.
srcrank of receiving processor
lengthPointer to perform a blocking probe
typetype of items in message.
0 => MPI_BYTE, 1 => MPI_INT, 2 => MPI_DOUBLE, 3 => MPI_CHAR

◆ Vcom_init()

int Vcom_init ( int *  argc,
char ***  argv 
)

The Vmp initializer.

Author
Michael Holst
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
Success enumeration
Parameters
argcnumber of the command line arguments
argvthe command line arguments

◆ Vcom_rank()

int Vcom_rank ( Vcom thee)

Get the ID of the local PE

Authors
Nathan Baker and Michael Holst
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
Get the ID of the local PE
Parameters
theePointer to the communications object

◆ Vcom_recv()

int Vcom_recv ( Vcom thee,
int  src,
void *  buf,
int  len,
int  type,
int  block 
)

Receive a (character) buffer.
The blocking flag is present, but not used. All receives are assumed to be blocking. A non-blocking receive would be very ugly to implement (signals or something?).

Authors
Nathan Baker and Michael Holst
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
1 if successful
Parameters
theePointer to the communications object.
srcrank of receiving processor
bufpointer to buffer of previously allocated memory
lennumber of items (of declared type) in buffer
typetype of items in message.

0 => MPI_BYTE, 1 => MPI_INT, 2 => MPI_DOUBLE, 3 => MPI_CHAR
blocktoggles blocking on (=1) and off (=0)

◆ Vcom_reduce()

int Vcom_reduce ( Vcom thee,
void *  sendbuf,
void *  recvbuf,
int  length,
int  type,
int  op 
)

Perform a reduction of the data across all processors. This is equivalent (and in the case of MPI is identical to) MPI_Allreduce. Basically, the specified operations are appleed to each member of
the sendbuf across all processors and the results are written to recvbuf.

Author
Nathan Baker
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
Success enumeration
Parameters
theePointer to the communications object
sendbufbuffer containing length items of the specified type to be operated on
recvbufbuffer containing length items of the specified type after operation
lengthnumber of items
typetype of items in message
0 => MPI_BYTE, 1 => MPI_INT, 2 => MPI_DOUBLE, 3 => MPI_CHAR
opoperation to perform
0 => MPI_SUM, 1 => MPI_PROD, 2 => MPI_MIN, 3 => MPI_MAX

◆ Vcom_resize()

int Vcom_resize ( Vcom thee,
int  newsize 
)

Resize (shrink) the communications group to include only newsize number of processors.
Obsolete processes are given rank of -1 and size of 0.

Author
Nathan Baker
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
1 if successful
Parameters
theePointer to the communications object
newsizenumber of processors

◆ Vcom_send()

int Vcom_send ( Vcom thee,
int  des,
void *  buf,
int  len,
int  type,
int  block 
)

Send a buffer. Returns 1 on success.

Authors
Nathan Baker and Michael Holst
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
1 if successful
Parameters
theePointer to the communications object.
desrank of receiving processor
bufbuffer containing message
lennumber of items (of declared type) in buffer
typetype of items in message.
0 => MPI_BYTE, 1 => MPI_INT, 2 => MPI_DOUBLE, 3 => MPI_CHAR
blocktoggles blocking on (=1) and off (=0)

◆ Vcom_size()

int Vcom_size ( Vcom thee)

Get the number of PEs in communicator.

Authors
Nathan Baker Michael Holst
Note
Class Vcom: Non-Inlineable methods (vcom.c)
Returns
Number of PEs or -1 if error
Parameters
theePointer to the communications object