VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | Friends
vtkMPIController Class Reference

Process communication using MPI. More...

#include <vtkMPIController.h>

Inheritance diagram for vtkMPIController:
Inheritance graph
[legend]
Collaboration diagram for vtkMPIController:
Collaboration graph
[legend]

List of all members.

Public Types

typedef vtkMultiProcessController Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
virtual void Initialize (int *vtkNotUsed(argc), char ***vtkNotUsed(argv), int initializedExternally)
virtual void Initialize ()
virtual void Finalize ()
virtual void Finalize (int finalizedExternally)
virtual void SingleMethodExecute ()
virtual void MultipleMethodExecute ()
virtual void CreateOutputWindow ()
void SetCommunicator (vtkMPICommunicator *comm)
virtual vtkMPIControllerCreateSubController (vtkProcessGroup *group)
virtual vtkMPIControllerPartitionController (int localColor, int localKey)
virtual void Initialize (int *argc, char ***argv)
int NoBlockSend (const int *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
int NoBlockSend (const unsigned long *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
int NoBlockSend (const char *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
int NoBlockSend (const float *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
int NoBlockSend (const double *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
int NoBlockReceive (int *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
int NoBlockReceive (unsigned long *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
int NoBlockReceive (char *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
int NoBlockReceive (float *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
int NoBlockReceive (double *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
int Iprobe (int source, int tag, int *flag, int *actualSource)
int Iprobe (int source, int tag, int *flag, int *actualSource, int *type, int *size)
int Iprobe (int source, int tag, int *flag, int *actualSource, unsigned long *type, int *size)
int Iprobe (int source, int tag, int *flag, int *actualSource, const char *type, int *size)
int Iprobe (int source, int tag, int *flag, int *actualSource, float *type, int *size)
int Iprobe (int source, int tag, int *flag, int *actualSource, double *type, int *size)

Static Public Member Functions

static vtkMPIControllerNew ()
static int IsTypeOf (const char *type)
static vtkMPIControllerSafeDownCast (vtkObject *o)
static char * ErrorString (int err)
static const char * GetProcessorName ()

Protected Member Functions

void InitializeCommunicator (vtkMPICommunicator *comm)
void InitializeRMICommunicator ()
virtual void TriggerRMIInternal (int remoteProcessId, void *arg, int argLength, int rmiTag, bool propagate)

Static Protected Attributes

static vtkMPICommunicatorWorldRMICommunicator
static int Initialized
static char ProcessorName []

Friends

class vtkMPIOutputWindow
static void SetUseSsendForRMI (int use_send)
static int GetUseSsendForRMI ()
 vtkMPIController ()
 ~vtkMPIController ()
static int UseSsendForRMI

Detailed Description

Process communication using MPI.

vtkMPIController is a concrete class which implements the abstract multi-process control methods defined in vtkMultiProcessController using MPI (Message Passing Interface) cf. Using MPI / Portable Parallel Programming with the Message-Passing Interface, Gropp et al, MIT Press. It also provide functionality specific to MPI and not present in vtkMultiProcessController. Before any MPI communication can occur Initialize() must be called by all processes. It is required to be called once, controllers created after this need not call Initialize(). At the end of the program Finalize() must be called by all processes.

The use of user-defined communicators are supported with the CreateSubController method. Note that a duplicate of the user defined communicator is used for internal communications (RMIs). This communicator has the same properties as the user one except that it has a new context which prevents the two communicators from interfering with each other.

See also:
vtkOutputPort vtkInputPort vtkMultiProcessController vtkMPICommunicator vtkProcessGroup
Examples:
vtkMPIController (Examples)
Tests:
vtkMPIController (Tests)

Definition at line 57 of file vtkMPIController.h.


Member Typedef Documentation

Reimplemented from vtkMultiProcessController.

Definition at line 63 of file vtkMPIController.h.


Constructor & Destructor Documentation

vtkMPIController::vtkMPIController ( ) [protected]

When set to 1, TriggerRMI uses Ssend() instead of Send() calls. Off (0) by default.

vtkMPIController::~vtkMPIController ( ) [protected]

When set to 1, TriggerRMI uses Ssend() instead of Send() calls. Off (0) by default.


Member Function Documentation

static vtkMPIController* vtkMPIController::New ( ) [static]

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkObject.

virtual const char* vtkMPIController::GetClassName ( ) [virtual]

Reimplemented from vtkMultiProcessController.

static int vtkMPIController::IsTypeOf ( const char *  name) [static]

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkMultiProcessController.

virtual int vtkMPIController::IsA ( const char *  name) [virtual]

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkMultiProcessController.

static vtkMPIController* vtkMPIController::SafeDownCast ( vtkObject o) [static]

Reimplemented from vtkMultiProcessController.

void vtkMPIController::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkMultiProcessController.

virtual void vtkMPIController::Initialize ( int argc,
char ***  argv 
) [inline, virtual]

This method is for setting up the processes. It needs to be called only once during program execution. Calling it more than once will have no effect. Controllers created after this call will be initialized automatically (i.e. they will have the proper LocalProcessId and NumberOfProcesses). The addresses of argc and argv should be passed to this method otherwise command line arguments will not be correct (because usually MPI implementations add their own arguments during startup).

Definition at line 75 of file vtkMPIController.h.

virtual void vtkMPIController::Initialize ( int vtkNotUsedargc,
char ***  vtkNotUsedargv,
int  initializedExternally 
) [virtual]

This method is for setting up the processes. If a subclass needs to initialize process communication (i.e. MPI) it would over ride this method. Provided for initialization outside vtk.

Implements vtkMultiProcessController.

virtual void vtkMPIController::Initialize ( ) [virtual]

Same as Initialize(0, 0, 1). Mainly for calling from wrapped languages.

virtual void vtkMPIController::Finalize ( ) [inline, virtual]

This method is for cleaning up and has to be called before the end of the program if MPI was initialized with Initialize()

Implements vtkMultiProcessController.

Definition at line 88 of file vtkMPIController.h.

virtual void vtkMPIController::Finalize ( int  finalizedExternally) [virtual]

This method is for cleaning up. If a subclass needs to clean up process communication (i.e. MPI) it would over ride this method. Provided for finalization outside vtk.

Implements vtkMultiProcessController.

virtual void vtkMPIController::SingleMethodExecute ( ) [virtual]

Execute the SingleMethod (as define by SetSingleMethod) using this->NumberOfProcesses processes.

Implements vtkMultiProcessController.

virtual void vtkMPIController::MultipleMethodExecute ( ) [virtual]

Execute the MultipleMethods (as define by calling SetMultipleMethod for each of the required this->NumberOfProcesses methods) using this->NumberOfProcesses processes.

Implements vtkMultiProcessController.

virtual void vtkMPIController::CreateOutputWindow ( ) [virtual]

This method can be used to tell the controller to create a special output window in which all messages are preceded by the process id.

Implements vtkMultiProcessController.

static char* vtkMPIController::ErrorString ( int  err) [static]

Given an MPI error code, return a string which contains an error message. This string has to be freed by the user.

void vtkMPIController::SetCommunicator ( vtkMPICommunicator comm)

MPIController uses this communicator in all sends and receives. By default, MPI_COMM_WORLD is used. THIS SHOULD ONLY BE CALLED ON THE PROCESSES INCLUDED IN THE COMMUNICATOR. FOR EXAMPLE, IF THE COMMUNICATOR CONTAINES PROCESSES 0 AND 1, INVOKING THIS METHOD ON ANY OTHER PROCESS WILL CAUSE AN MPI ERROR AND POSSIBLY LEAD TO A CRASH.

virtual vtkMPIController* vtkMPIController::CreateSubController ( vtkProcessGroup group) [virtual]

Creates a new controller with the processes specified by the given group. The new controller will already be initialized for you. You are responsible for deleting the controller once you are done. It is invalid to pass this method a group with a different communicator than is used by this controller. This operation is collective accross all processes defined in the group. It is undefined what will happen if the group is not the same on all processes. This method must be called by all processes in the controller regardless of whether they are in the group. NULL is returned on all process not in the group.

Reimplemented from vtkMultiProcessController.

virtual vtkMPIController* vtkMPIController::PartitionController ( int  localColor,
int  localKey 
) [virtual]

Partitions this controller based on a coloring. That is, each process passes in a color. All processes with the same color are grouped into the same partition. The processes are ordered by their self-assigned key. Lower keys have lower process ids. Ties are broken by the current process ids. (For example, if all the keys are 0, then the resulting processes will be ordered in the same way.) This method returns a new controller to each process that represents the local partition. This is basically the same operation as MPI_Comm_split.

Reimplemented from vtkMultiProcessController.

int vtkMPIController::NoBlockSend ( const int data,
int  length,
int  remoteProcessId,
int  tag,
vtkMPICommunicator::Request req 
) [inline]

This method sends data to another process (non-blocking). Tag eliminates ambiguity when multiple sends or receives exist in the same process. The last argument, vtkMPICommunicator::Request& req can later be used (with req.Test() ) to test the success of the message. Return values are 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 130 of file vtkMPIController.h.

int vtkMPIController::NoBlockSend ( const unsigned long *  data,
int  length,
int  remoteProcessId,
int  tag,
vtkMPICommunicator::Request req 
) [inline]

This method sends data to another process (non-blocking). Tag eliminates ambiguity when multiple sends or receives exist in the same process. The last argument, vtkMPICommunicator::Request& req can later be used (with req.Test() ) to test the success of the message. Return values are 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 134 of file vtkMPIController.h.

int vtkMPIController::NoBlockSend ( const char *  data,
int  length,
int  remoteProcessId,
int  tag,
vtkMPICommunicator::Request req 
) [inline]

This method sends data to another process (non-blocking). Tag eliminates ambiguity when multiple sends or receives exist in the same process. The last argument, vtkMPICommunicator::Request& req can later be used (with req.Test() ) to test the success of the message. Return values are 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 138 of file vtkMPIController.h.

int vtkMPIController::NoBlockSend ( const float data,
int  length,
int  remoteProcessId,
int  tag,
vtkMPICommunicator::Request req 
) [inline]

This method sends data to another process (non-blocking). Tag eliminates ambiguity when multiple sends or receives exist in the same process. The last argument, vtkMPICommunicator::Request& req can later be used (with req.Test() ) to test the success of the message. Return values are 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 142 of file vtkMPIController.h.

int vtkMPIController::NoBlockSend ( const double data,
int  length,
int  remoteProcessId,
int  tag,
vtkMPICommunicator::Request req 
) [inline]

This method sends data to another process (non-blocking). Tag eliminates ambiguity when multiple sends or receives exist in the same process. The last argument, vtkMPICommunicator::Request& req can later be used (with req.Test() ) to test the success of the message. Return values are 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 146 of file vtkMPIController.h.

int vtkMPIController::NoBlockReceive ( int data,
int  length,
int  remoteProcessId,
int  tag,
vtkMPICommunicator::Request req 
) [inline]

This method receives data from a corresponding send (non-blocking). The last argument, vtkMPICommunicator::Request& req can later be used (with req.Test() ) to test the success of the message. Return values are 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 158 of file vtkMPIController.h.

int vtkMPIController::NoBlockReceive ( unsigned long *  data,
int  length,
int  remoteProcessId,
int  tag,
vtkMPICommunicator::Request req 
) [inline]

This method receives data from a corresponding send (non-blocking). The last argument, vtkMPICommunicator::Request& req can later be used (with req.Test() ) to test the success of the message. Return values are 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 162 of file vtkMPIController.h.

int vtkMPIController::NoBlockReceive ( char *  data,
int  length,
int  remoteProcessId,
int  tag,
vtkMPICommunicator::Request req 
) [inline]

This method receives data from a corresponding send (non-blocking). The last argument, vtkMPICommunicator::Request& req can later be used (with req.Test() ) to test the success of the message. Return values are 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 167 of file vtkMPIController.h.

int vtkMPIController::NoBlockReceive ( float data,
int  length,
int  remoteProcessId,
int  tag,
vtkMPICommunicator::Request req 
) [inline]

This method receives data from a corresponding send (non-blocking). The last argument, vtkMPICommunicator::Request& req can later be used (with req.Test() ) to test the success of the message. Return values are 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 171 of file vtkMPIController.h.

int vtkMPIController::NoBlockReceive ( double data,
int  length,
int  remoteProcessId,
int  tag,
vtkMPICommunicator::Request req 
) [inline]

This method receives data from a corresponding send (non-blocking). The last argument, vtkMPICommunicator::Request& req can later be used (with req.Test() ) to test the success of the message. Return values are 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 175 of file vtkMPIController.h.

int vtkMPIController::Iprobe ( int  source,
int  tag,
int flag,
int actualSource 
) [inline]

Nonblocking test for a message. Inputs are: source -- the source rank or ANY_SOURCE; tag -- the tag value. Outputs are: flag -- True if a message matches; actualSource -- the rank sending the message (useful if ANY_SOURCE is used) if flag is True and actualSource isn't NULL; size -- the length of the message in bytes if flag is true (only set if size isn't NULL). The return value is 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 195 of file vtkMPIController.h.

int vtkMPIController::Iprobe ( int  source,
int  tag,
int flag,
int actualSource,
int type,
int size 
) [inline]

Nonblocking test for a message. Inputs are: source -- the source rank or ANY_SOURCE; tag -- the tag value. Outputs are: flag -- True if a message matches; actualSource -- the rank sending the message (useful if ANY_SOURCE is used) if flag is True and actualSource isn't NULL; size -- the length of the message in bytes if flag is true (only set if size isn't NULL). The return value is 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 198 of file vtkMPIController.h.

int vtkMPIController::Iprobe ( int  source,
int  tag,
int flag,
int actualSource,
unsigned long *  type,
int size 
) [inline]

Nonblocking test for a message. Inputs are: source -- the source rank or ANY_SOURCE; tag -- the tag value. Outputs are: flag -- True if a message matches; actualSource -- the rank sending the message (useful if ANY_SOURCE is used) if flag is True and actualSource isn't NULL; size -- the length of the message in bytes if flag is true (only set if size isn't NULL). The return value is 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 202 of file vtkMPIController.h.

int vtkMPIController::Iprobe ( int  source,
int  tag,
int flag,
int actualSource,
const char *  type,
int size 
) [inline]

Nonblocking test for a message. Inputs are: source -- the source rank or ANY_SOURCE; tag -- the tag value. Outputs are: flag -- True if a message matches; actualSource -- the rank sending the message (useful if ANY_SOURCE is used) if flag is True and actualSource isn't NULL; size -- the length of the message in bytes if flag is true (only set if size isn't NULL). The return value is 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 206 of file vtkMPIController.h.

int vtkMPIController::Iprobe ( int  source,
int  tag,
int flag,
int actualSource,
float type,
int size 
) [inline]

Nonblocking test for a message. Inputs are: source -- the source rank or ANY_SOURCE; tag -- the tag value. Outputs are: flag -- True if a message matches; actualSource -- the rank sending the message (useful if ANY_SOURCE is used) if flag is True and actualSource isn't NULL; size -- the length of the message in bytes if flag is true (only set if size isn't NULL). The return value is 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 210 of file vtkMPIController.h.

int vtkMPIController::Iprobe ( int  source,
int  tag,
int flag,
int actualSource,
double type,
int size 
) [inline]

Nonblocking test for a message. Inputs are: source -- the source rank or ANY_SOURCE; tag -- the tag value. Outputs are: flag -- True if a message matches; actualSource -- the rank sending the message (useful if ANY_SOURCE is used) if flag is True and actualSource isn't NULL; size -- the length of the message in bytes if flag is true (only set if size isn't NULL). The return value is 1 for success and 0 otherwise. Note: These methods delegate to the communicator

Definition at line 214 of file vtkMPIController.h.

static const char* vtkMPIController::GetProcessorName ( ) [static]
static void vtkMPIController::SetUseSsendForRMI ( int  use_send) [inline, static]

When set to 1, TriggerRMI uses Ssend() instead of Send() calls. Off (0) by default.

Definition at line 227 of file vtkMPIController.h.

static int vtkMPIController::GetUseSsendForRMI ( ) [inline, static]

When set to 1, TriggerRMI uses Ssend() instead of Send() calls. Off (0) by default.

Definition at line 229 of file vtkMPIController.h.

void vtkMPIController::InitializeCommunicator ( vtkMPICommunicator comm) [protected]
void vtkMPIController::InitializeRMICommunicator ( ) [protected]
virtual void vtkMPIController::TriggerRMIInternal ( int  remoteProcessId,
void *  arg,
int  argLength,
int  rmiTag,
bool  propagate 
) [protected, virtual]

Implementation for TriggerRMI() provides subclasses an opportunity to modify the behaviour eg. MPIController provides ability to use Ssend instead of Send.

Reimplemented from vtkMultiProcessController.


Friends And Related Function Documentation

friend class vtkMPIOutputWindow [friend]

Definition at line 257 of file vtkMPIController.h.


Member Data Documentation

Definition at line 255 of file vtkMPIController.h.

int vtkMPIController::Initialized [static, protected]

Definition at line 260 of file vtkMPIController.h.

char vtkMPIController::ProcessorName[] [static, protected]

Definition at line 262 of file vtkMPIController.h.

When set, TriggerRMI uses Ssend instead of Send.

Definition at line 266 of file vtkMPIController.h.


The documentation for this class was generated from the following file: