VTK
vtkMPICommunicator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMPICommunicator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
38 #ifndef vtkMPICommunicator_h
39 #define vtkMPICommunicator_h
40 
41 #include "vtkParallelMPIModule.h" // For export macro
42 #include "vtkCommunicator.h"
43 
44 class vtkMPIController;
45 class vtkProcessGroup;
46 
50 
52 {
53 public:
54 //BTX
55 
57  {
58  public:
60  Request( const Request& );
62  Request& operator = ( const Request& );
63  int Test();
64  void Cancel();
65  void Wait();
67  };
68 
69 //ETX
70 
72  void PrintSelf(ostream& os, vtkIndent indent);
73 
76 
80 
81 
86 
90  int SplitInitialize(vtkCommunicator *oldcomm, int color, int key);
91 
93 
96  virtual int SendVoidArray(const void *data, vtkIdType length, int type,
97  int remoteProcessId, int tag);
98  virtual int ReceiveVoidArray(void *data, vtkIdType length, int type,
99  int remoteProcessId, int tag);
101 
103 
108  int NoBlockSend(const int* data, int length, int remoteProcessId, int tag,
109  Request& req);
110  int NoBlockSend(const unsigned long* data, int length, int remoteProcessId,
111  int tag, Request& req);
112  int NoBlockSend(const char* data, int length, int remoteProcessId,
113  int tag, Request& req);
114  int NoBlockSend(const unsigned char* data, int length, int remoteProcessId,
115  int tag, Request& req);
116  int NoBlockSend(const float* data, int length, int remoteProcessId,
117  int tag, Request& req);
118  int NoBlockSend(const double* data, int length, int remoteProcessId,
119  int tag, Request& req);
120 #ifdef VTK_USE_64BIT_IDS
121  int NoBlockSend(const vtkIdType* data, int length, int remoteProcessId,
122  int tag, Request& req);
123 #endif
124 
125 
127 
131  int NoBlockReceive(int* data, int length, int remoteProcessId,
132  int tag, Request& req);
133  int NoBlockReceive(unsigned long* data, int length,
134  int remoteProcessId, int tag, Request& req);
135  int NoBlockReceive(char* data, int length, int remoteProcessId,
136  int tag, Request& req);
137  int NoBlockReceive(unsigned char* data, int length, int remoteProcessId,
138  int tag, Request& req);
139  int NoBlockReceive(float* data, int length, int remoteProcessId,
140  int tag, Request& req);
141  int NoBlockReceive(double* data, int length, int remoteProcessId,
142  int tag, Request& req);
143 #ifdef VTK_USE_64BIT_IDS
144  int NoBlockReceive(vtkIdType* data, int length, int remoteProcessId,
145  int tag, Request& req);
146 #endif
147 
148 
149 
151 
154  virtual void Barrier();
155  virtual int BroadcastVoidArray(void *data, vtkIdType length, int type,
156  int srcProcessId);
157  virtual int GatherVoidArray(const void *sendBuffer, void *recvBuffer,
158  vtkIdType length, int type, int destProcessId);
159  virtual int GatherVVoidArray(const void *sendBuffer, void *recvBuffer,
160  vtkIdType sendLength, vtkIdType *recvLengths,
161  vtkIdType *offsets, int type, int destProcessId);
162  virtual int ScatterVoidArray(const void *sendBuffer, void *recvBuffer,
163  vtkIdType length, int type, int srcProcessId);
164  virtual int ScatterVVoidArray(const void *sendBuffer, void *recvBuffer,
165  vtkIdType *sendLengths, vtkIdType *offsets,
166  vtkIdType recvLength, int type,
167  int srcProcessId);
168  virtual int AllGatherVoidArray(const void *sendBuffer, void *recvBuffer,
169  vtkIdType length, int type);
170  virtual int AllGatherVVoidArray(const void *sendBuffer, void *recvBuffer,
171  vtkIdType sendLength, vtkIdType *recvLengths,
172  vtkIdType *offsets, int type);
173  virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer,
174  vtkIdType length, int type,
175  int operation, int destProcessId);
176  virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer,
177  vtkIdType length, int type,
178  Operation *operation, int destProcessId);
179  virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer,
180  vtkIdType length, int type,
181  int operation);
182  virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer,
183  vtkIdType length, int type,
184  Operation *operation);
186 
188 
195  int Iprobe(int source, int tag, int* flag, int* actualSource);
196  int Iprobe(int source, int tag, int* flag, int* actualSource,
197  int* type, int* size);
198  int Iprobe(int source, int tag, int* flag, int* actualSource,
199  unsigned long* type, int* size);
200  int Iprobe(int source, int tag, int* flag, int* actualSource,
201  const char* type, int* size);
202  int Iprobe(int source, int tag, int* flag, int* actualSource,
203  float* type, int* size);
204  int Iprobe(int source, int tag, int* flag, int* actualSource,
205  double* type, int* size);
207 
210  int WaitAll(const int count, Request requests[]);
211 
215  int WaitAny(const int count, Request requests[], int& idx);
216 
218 
221  int WaitSome(
222  const int count, Request requests[], int &NCompleted, int *completed );
224 
228  int TestAll( const int count, Request requests[], int& flag );
229 
231  int TestAny(const int count, Request requests[], int &idx, int &flag );
232 
234 
238  int TestSome(const int count,Request requests[],
239  int& NCompleted,int *completed);
240 //BTX
242 
243  friend class vtkMPIController;
244 
246  {
247  return this->MPIComm;
248  }
249 
251 
252 //ETX
253 
254  static char* Allocate(size_t size);
255  static void Free(char* ptr);
256 
257 
259 
261  vtkSetClampMacro(UseSsend, int, 0, 1);
262  vtkGetMacro(UseSsend, int);
263  vtkBooleanMacro(UseSsend, int);
265 
267 
272 protected:
276 
277  // Obtain size and rank setting NumberOfProcesses and LocalProcessId Should
278  // not be called if the current communicator does not include this process
280 
282 
289  vtkSetMacro(KeepHandle, int);
290  vtkBooleanMacro(KeepHandle, int);
292 
293 
295 
297 
305 
307 
308  virtual int ReceiveDataInternal(
309  char* data, int length, int sizeoftype,
310  int remoteProcessId, int tag,
312  int useCopy, int& senderId);
314 
316 
319 
321  int UseSsend;
322  static int CheckForMPIError(int err);
323 
324 private:
325  vtkMPICommunicator(const vtkMPICommunicator&); // Not implemented.
326  void operator=(const vtkMPICommunicator&); // Not implemented.
327 };
328 
329 #endif
vtkMPICommunicator::Barrier
virtual void Barrier()
vtkMPICommunicator::CheckForMPIError
static int CheckForMPIError(int err)
vtkMPICommunicator::TestAll
int TestAll(const int count, Request requests[], int &flag)
vtkMPICommunicator::vtkMPICommunicator
vtkMPICommunicator()
vtkMPICommunicator::Duplicate
void Duplicate(vtkMPICommunicator *source)
vtkgl::data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
vtkMPICommunicator::Request
Definition: vtkMPICommunicator.h:57
vtkMPICommunicator::WaitSome
int WaitSome(const int count, Request requests[], int &NCompleted, int *completed)
vtkgl::group
GLboolean GLuint group
Definition: vtkgl.h:18647
vtkMPICommunicator::NoBlockReceive
int NoBlockReceive(unsigned char *data, int length, int remoteProcessId, int tag, Request &req)
vtkMPICommunicator::NoBlockReceive
int NoBlockReceive(float *data, int length, int remoteProcessId, int tag, Request &req)
vtkgl::count
GLuint GLuint GLsizei count
Definition: vtkgl.h:11315
vtkMPICommunicator::~vtkMPICommunicator
~vtkMPICommunicator()
vtkMPICommunicator::Initialized
int Initialized
Definition: vtkMPICommunicator.h:317
vtkMPICommunicatorReceiveDataInfo
Definition: vtkMPI.h:45
vtkCommunicator
Used to send/receive messages in a multiprocess environment.
Definition: vtkCommunicator.h:52
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkMPICommunicator::UseSsend
int UseSsend
Definition: vtkMPICommunicator.h:321
vtkMPICommunicator::Initialize
int Initialize(vtkProcessGroup *group)
vtkMPICommunicatorOpaqueComm
Definition: vtkMPI.h:31
vtkMPICommunicator::NoBlockSend
int NoBlockSend(const unsigned char *data, int length, int remoteProcessId, int tag, Request &req)
vtkCommunicator::Operation
Definition: vtkCommunicator.h:103
vtkX3D::key
@ key
Definition: vtkX3D.h:257
vtkMPICommunicator::ScatterVoidArray
virtual int ScatterVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int srcProcessId)
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkMPICommunicator::Request::Request
Request()
vtkMPICommunicator::AllReduceVoidArray
virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, Operation *operation)
vtkMPICommunicator::Request::Cancel
void Cancel()
vtkMPICommunicator::Request::Test
int Test()
vtkMPICommunicator::NoBlockSend
int NoBlockSend(const float *data, int length, int remoteProcessId, int tag, Request &req)
vtkgl::length
GLuint GLsizei GLsizei * length
Definition: vtkgl.h:11992
vtkMPICommunicator::GatherVoidArray
virtual int GatherVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int destProcessId)
vtkMPICommunicator::NoBlockReceive
int NoBlockReceive(char *data, int length, int remoteProcessId, int tag, Request &req)
vtkMPICommunicator::LastSenderId
int LastSenderId
Definition: vtkMPICommunicator.h:320
vtkMPICommunicator::BroadcastVoidArray
virtual int BroadcastVoidArray(void *data, vtkIdType length, int type, int srcProcessId)
vtkMPICommunicator
Class for creating user defined MPI communicators.
Definition: vtkMPICommunicator.h:52
vtkMPICommunicator::Allocate
static char * Allocate(size_t size)
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:821
vtkMPICommunicator::New
static vtkMPICommunicator * New()
vtkMPICommunicator::WaitAny
int WaitAny(const int count, Request requests[], int &idx)
vtkMPICommunicatorOpaqueRequest
Definition: vtkMPI.h:65
vtkMPICommunicator::ReduceVoidArray
virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int operation, int destProcessId)
vtkMPICommunicator::NoBlockReceive
int NoBlockReceive(unsigned long *data, int length, int remoteProcessId, int tag, Request &req)
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkMPICommunicator::Request::Request
Request(const Request &)
vtkMPICommunicator::SendVoidArray
virtual int SendVoidArray(const void *data, vtkIdType length, int type, int remoteProcessId, int tag)
vtkMPICommunicator::WaitAll
int WaitAll(const int count, Request requests[])
vtkMPICommunicator::InitializeNumberOfProcesses
int InitializeNumberOfProcesses()
vtkMPICommunicator::Iprobe
int Iprobe(int source, int tag, int *flag, int *actualSource, float *type, int *size)
vtkMPICommunicator::InitializeCopy
void InitializeCopy(vtkMPICommunicator *source)
VTKPARALLELMPI_EXPORT
#define VTKPARALLELMPI_EXPORT
Definition: vtkParallelMPIModule.h:15
vtkMPICommunicator::AllGatherVVoidArray
virtual int AllGatherVVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int type)
vtkMPICommunicator::WorldCommunicator
static vtkMPICommunicator * WorldCommunicator
Definition: vtkMPICommunicator.h:290
vtkMPICommunicator::Iprobe
int Iprobe(int source, int tag, int *flag, int *actualSource)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMPICommunicator::TestSome
int TestSome(const int count, Request requests[], int &NCompleted, int *completed)
vtkMPICommunicator::AllReduceVoidArray
virtual int AllReduceVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, int operation)
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkMPICommunicator::Iprobe
int Iprobe(int source, int tag, int *flag, int *actualSource, unsigned long *type, int *size)
vtkgl::color
GLuint color
Definition: vtkgl.h:12351
vtkMPICommunicator::Iprobe
int Iprobe(int source, int tag, int *flag, int *actualSource, int *type, int *size)
vtkMPICommunicator::NoBlockSend
int NoBlockSend(const int *data, int length, int remoteProcessId, int tag, Request &req)
vtkMPICommunicator::GetWorldCommunicator
static vtkMPICommunicator * GetWorldCommunicator()
vtkMPICommunicator::Request::Wait
void Wait()
vtkMPICommunicator::ReceiveDataInternal
virtual int ReceiveDataInternal(char *data, int length, int sizeoftype, int remoteProcessId, int tag, vtkMPICommunicatorReceiveDataInfo *info, int useCopy, int &senderId)
vtkMPICommunicator::NoBlockReceive
int NoBlockReceive(int *data, int length, int remoteProcessId, int tag, Request &req)
vtkMPICommunicator::ReduceVoidArray
virtual int ReduceVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type, Operation *operation, int destProcessId)
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkMPICommunicator::CopyFrom
void CopyFrom(vtkMPICommunicator *source)
vtkMPICommunicator::NoBlockReceive
int NoBlockReceive(double *data, int length, int remoteProcessId, int tag, Request &req)
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkMPICommunicator::Free
static void Free(char *ptr)
vtkMPICommunicator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkProcessGroup
A subgroup of processes from a communicator.
Definition: vtkProcessGroup.h:57
vtkMPICommunicator::TestAny
int TestAny(const int count, Request requests[], int &idx, int &flag)
vtkMPICommunicator::InitializeExternal
int InitializeExternal(vtkMPICommunicatorOpaqueComm *comm)
vtkCommunicator.h
vtkMPICommunicator::Iprobe
int Iprobe(int source, int tag, int *flag, int *actualSource, double *type, int *size)
vtkMPICommunicator::KeepHandle
int KeepHandle
Definition: vtkMPICommunicator.h:318
vtkMPICommunicator::GatherVVoidArray
virtual int GatherVVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType sendLength, vtkIdType *recvLengths, vtkIdType *offsets, int type, int destProcessId)
vtkMPICommunicator::MPIComm
vtkMPICommunicatorOpaqueComm * MPIComm
Definition: vtkMPICommunicator.h:315
vtkMPICommunicator::GetMPIComm
vtkMPICommunicatorOpaqueComm * GetMPIComm()
Definition: vtkMPICommunicator.h:245
vtkMPICommunicator::AllGatherVoidArray
virtual int AllGatherVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType length, int type)
vtkMPICommunicator::ScatterVVoidArray
virtual int ScatterVVoidArray(const void *sendBuffer, void *recvBuffer, vtkIdType *sendLengths, vtkIdType *offsets, vtkIdType recvLength, int type, int srcProcessId)
vtkMPICommunicator::NoBlockSend
int NoBlockSend(const unsigned long *data, int length, int remoteProcessId, int tag, Request &req)
vtkMPIController
Process communication using MPI.
Definition: vtkMPIController.h:61
vtkParallelMPIModule.h
vtkMPICommunicator::ReceiveVoidArray
virtual int ReceiveVoidArray(void *data, vtkIdType length, int type, int remoteProcessId, int tag)
vtkgl::type
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
vtkMPICommunicator::Request::Req
vtkMPICommunicatorOpaqueRequest * Req
Definition: vtkMPICommunicator.h:66
vtkMPICommunicator::Iprobe
int Iprobe(int source, int tag, int *flag, int *actualSource, const char *type, int *size)
vtkMPICommunicator::NoBlockSend
int NoBlockSend(const double *data, int length, int remoteProcessId, int tag, Request &req)
vtkMPICommunicator::SplitInitialize
int SplitInitialize(vtkCommunicator *oldcomm, int color, int key)
vtkMPICommunicator::Request::~Request
~Request()
vtkMPICommunicator::NoBlockSend
int NoBlockSend(const char *data, int length, int remoteProcessId, int tag, Request &req)
vtkgl::size
GLsizeiptr size
Definition: vtkgl.h:11843