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 More...

## Functions

int | Vcom_init (int *argc, char ***argv)
| The Vmp initializer. More...
int | Vcom_finalize (void)
| The Vmp finalizer. More...
Vcom * | Vcom_ctor (int commtype)
| Construct the communications object. This routine sets up data members of class and initializes MPI. More...
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. More...
void | Vcom_dtor (Vcom **thee)
| Destroy the communications object. More...
void | Vcom_dtor2 (Vcom *thee)
| Destroy the communications object. This is broken into two parts to be callable from FORTRAN. More...
int | Vcom_send (Vcom *thee, int des, void *buf, int len, int type, int block)
| Send a buffer. Returns 1 on success. More...
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?). More...
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". More...
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. More...
int | Vcom_size (Vcom *thee)
| Get the number of PEs in communicator. More...
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. More...
int | Vcom_rank (Vcom *thee)
| Get the ID of the local PE More...
int | Vcom_barr (Vcom *thee)
| Synchronization barrier. More...

## 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

  thee | Pointer 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

  commtype | type 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

  thee | Pointer to the new allocated communications object.
  commtype | type 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

  thee | Pointer 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

  thee | Pointer 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

  thee | Pointer to the communications object.
  src | rank of receiving processor
  length | Pointer to perform a blocking probe
  type | type 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

  argc | number of the command line arguments
  argv | the 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

  thee | Pointer 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

  thee | Pointer to the communications object.
  src | rank of receiving processor
  buf | pointer to buffer of previously allocated memory
  len | number of items (of declared type) in buffer
  type | type of items in message. 0 => MPI_BYTE, 1 => MPI_INT, 2 => MPI_DOUBLE, 3 => MPI_CHAR
  block | toggles 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

  thee | Pointer to the communications object
  sendbuf | buffer containing `length` items of the specified type to be operated on
  recvbuf | buffer containing `length` items of the specified type after operation
  length | number of items
  type | type of items in message 0 => MPI_BYTE, 1 => MPI_INT, 2 => MPI_DOUBLE, 3 => MPI_CHAR
  op | operation 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

  thee | Pointer to the communications object
  newsize | number 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

  thee | Pointer to the communications object.
  des | rank of receiving processor
  buf | buffer containing message
  len | number of items (of declared type) in buffer
  type | type of items in message. 0 => MPI_BYTE, 1 => MPI_INT, 2 => MPI_DOUBLE, 3 => MPI_CHAR
  block | toggles 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

  thee | Pointer to the communications object