• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Parallel/vtkMPICommunicator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkMPICommunicator.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00038 #ifndef __vtkMPICommunicator_h
00039 #define __vtkMPICommunicator_h
00040 
00041 #include "vtkCommunicator.h"
00042 
00043 class vtkMPIController;
00044 class vtkMPIGroup;
00045 class vtkProcessGroup;
00046 
00047 class vtkMPICommunicatorOpaqueComm;
00048 class vtkMPICommunicatorOpaqueRequest;
00049 class vtkMPICommunicatorReceiveDataInfo;
00050 
00051 class VTK_PARALLEL_EXPORT vtkMPICommunicator : public vtkCommunicator
00052 {
00053 public:
00054 //BTX
00055 
00056   class VTK_PARALLEL_EXPORT Request
00057   {
00058   public:
00059     Request();
00060     Request( const Request& );
00061     ~Request();
00062     Request& operator = ( const Request& );
00063     int Test();
00064     void Cancel();
00065     void Wait();
00066     vtkMPICommunicatorOpaqueRequest* Req;
00067   };
00068 
00069 //ETX
00070 
00071   vtkTypeRevisionMacro( vtkMPICommunicator,vtkCommunicator);
00072   void PrintSelf(ostream& os, vtkIndent indent);
00073   
00075   static vtkMPICommunicator* New();
00076 
00079   static vtkMPICommunicator* GetWorldCommunicator();
00080   
00081 
00085   int Initialize(vtkProcessGroup *group);
00086 
00088   VTK_LEGACY(int Initialize(vtkMPICommunicator* mpiComm, vtkMPIGroup* group));
00089 
00091 
00093   virtual int SendVoidArray(const void *data, vtkIdType length, int type,
00094                             int remoteProcessId, int tag);
00095   virtual int ReceiveVoidArray(void *data, vtkIdType length, int type,
00096                                int remoteProcessId, int tag);
00098 
00100 
00104   int NoBlockSend(const int* data, int length, int remoteProcessId, int tag,
00105                   Request& req);
00106   int NoBlockSend(const unsigned long* data, int length, int remoteProcessId,
00107                   int tag, Request& req);
00108   int NoBlockSend(const char* data, int length, int remoteProcessId, 
00109                   int tag, Request& req);
00110   int NoBlockSend(const float* data, int length, int remoteProcessId, 
00111                   int tag, Request& req);
00113 
00115 
00118   int NoBlockReceive(int* data, int length, int remoteProcessId, 
00119                      int tag, Request& req);
00120   int NoBlockReceive(unsigned long* data, int length, 
00121                      int remoteProcessId, int tag, Request& req);
00122   int NoBlockReceive(char* data, int length, int remoteProcessId, 
00123                      int tag, Request& req);
00124   int NoBlockReceive(float* data, int length, int remoteProcessId, 
00125                      int tag, Request& req);
00126 #ifdef VTK_USE_64BIT_IDS
00127   int NoBlockReceive(vtkIdType* data, int length, int remoteProcessId, 
00128                      int tag, Request& req);
00130 #endif
00131 
00132 
00134 
00136   virtual void Barrier();
00137   virtual int BroadcastVoidArray(void *data, vtkIdType length, int type,
00138                                  int srcProcessId);
00139   virtual int GatherVoidArray(const void *sendBuffer, void *recvBuffer,
00140                               vtkIdType length, int type, int destProcessId);
00141   virtual int GatherVVoidArray(const void *sendBuffer, void *recvBuffer,
00142                                vtkIdType sendLength, vtkIdType *recvLengths,
00143                                vtkIdType *offsets, int type, int destProcessId);
00144   virtual int ScatterVoidArray(const void *sendBuffer, void *recvBuffer,
00145                                vtkIdType length, int type, int srcProcessId);
00146   virtual int ScatterVVoidArray(const void *sendBuffer, void *recvBuffer,
00147                                 vtkIdType *sendLengths, vtkIdType *offsets,
00148                                 vtkIdType recvLength, int type,
00149                                 int srcProcessId);
00150   virtual int AllGatherVoidArray(const void *sendBuffer, void *recvBuffer,
00151                                  vtkIdType length, int type);
00152   virtual int AllGatherVVoidArray(const void *sendBuffer, void *recvBuffer,
00153                                   vtkIdType sendLength, vtkIdType *recvLengths,
00154                                   vtkIdType *offsets, int type);
00155   virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer,
00156                               vtkIdType length, int type,
00157                               int operation, int destProcessId);
00158   virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer,
00159                               vtkIdType length, int type,
00160                               Operation *operation, int destProcessId);
00161   virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer,
00162                                  vtkIdType length, int type,
00163                                  int operation);
00164   virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer,
00165                                  vtkIdType length, int type,
00166                                  Operation *operation);
00168 
00170 
00171   VTK_LEGACY(int ReduceMax(int* data, int* to, int size, int root));
00172   VTK_LEGACY(int ReduceMax(unsigned long* data, unsigned long* to, int size, int root));
00173   VTK_LEGACY(int ReduceMax(float* data, float* to, int size, int root));
00174   VTK_LEGACY(int ReduceMax(double* data, double* to, int size, int root));
00176 
00177   VTK_LEGACY(int ReduceMin(int* data, int* to, int size, int root));
00178   VTK_LEGACY(int ReduceMin(unsigned long* data, unsigned long* to, int size, int root));
00179   VTK_LEGACY(int ReduceMin(float* data, float* to, int size, int root));
00180   VTK_LEGACY(int ReduceMin(double* data, double* to, int size, int root));
00181 
00182   VTK_LEGACY(int ReduceSum(int* data, int* to, int size, int root));
00183   VTK_LEGACY(int ReduceSum(unsigned long* data, unsigned long* to, int size, int root));
00184   VTK_LEGACY(int ReduceSum(float* data, float* to, int size, int root));
00185   VTK_LEGACY(int ReduceSum(double* data, double* to, int size, int root));
00186 
00187 //BTX
00188   VTK_LEGACY(int ReduceAnd(bool* data, bool* to, int size, int root));
00189   VTK_LEGACY(int ReduceOr(bool* data, bool* to, int size, int root));
00190 //ETX
00191 
00192 //BTX
00193 
00194   friend class vtkMPIController;
00195 
00196   vtkMPICommunicatorOpaqueComm *GetMPIComm()
00197     {
00198     return this->MPIComm;
00199     }
00200 //ETX
00201 
00202   static char* Allocate(size_t size);
00203   static void Free(char* ptr);
00204 
00205 
00207 
00209   vtkSetClampMacro(UseSsend, int, 0, 1);
00210   vtkGetMacro(UseSsend, int);
00211   vtkBooleanMacro(UseSsend, int);
00213 
00218   void CopyFrom(vtkMPICommunicator* source);
00219 protected:
00220   vtkMPICommunicator();
00221   ~vtkMPICommunicator();
00222 
00223   // Obtain size and rank setting NumberOfProcesses and LocalProcessId Should
00224   // not be called if the current communicator does not include this process
00225   int InitializeNumberOfProcesses();
00226 
00228 
00235   vtkSetMacro(KeepHandle, int);
00236   vtkBooleanMacro(KeepHandle, int);
00238 
00239 
00240   static vtkMPICommunicator* WorldCommunicator;
00241 
00242   void InitializeCopy(vtkMPICommunicator* source);
00243 
00250   void Duplicate(vtkMPICommunicator* source);
00251 
00253 
00254   virtual int ReceiveDataInternal(
00255     char* data, int length, int sizeoftype, 
00256     int remoteProcessId, int tag,
00257     vtkMPICommunicatorReceiveDataInfo* info,
00258     int useCopy, int& senderId);
00260 
00261   vtkMPICommunicatorOpaqueComm* MPIComm;
00262 
00263   int Initialized;
00264   int KeepHandle;
00265 
00266   int LastSenderId;
00267   int UseSsend;
00268   static int CheckForMPIError(int err);
00269 
00270 private:
00271   vtkMPICommunicator(const vtkMPICommunicator&);  // Not implemented.
00272   void operator=(const vtkMPICommunicator&);  // Not implemented.
00273 };
00274 
00275 #endif

Generated by  doxygen 1.7.1