VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkMPIController.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 =========================================================================*/ 00045 #ifndef __vtkMPIController_h 00046 #define __vtkMPIController_h 00047 00048 #include "vtkMultiProcessController.h" 00049 // Do not remove this header file. This class contains methods 00050 // which take arguments defined in vtkMPICommunicator.h by 00051 // reference. 00052 #include "vtkMPICommunicator.h" // Needed for direct access to communicator 00053 00054 class VTK_PARALLEL_EXPORT vtkMPIController : public vtkMultiProcessController 00055 { 00056 00057 public: 00058 00059 static vtkMPIController *New(); 00060 vtkTypeRevisionMacro(vtkMPIController,vtkMultiProcessController); 00061 void PrintSelf(ostream& os, vtkIndent indent); 00062 00064 00072 virtual void Initialize(int* argc, char*** argv) 00073 { this->Initialize(argc, argv, 0); } 00075 00076 virtual void Initialize(int* vtkNotUsed(argc), char*** vtkNotUsed(argv), 00077 int initializedExternally); 00078 00081 virtual void Finalize() { this->Finalize(0); } 00082 00083 virtual void Finalize(int finalizedExternally); 00084 00087 virtual void SingleMethodExecute(); 00088 00092 virtual void MultipleMethodExecute(); 00093 00096 virtual void CreateOutputWindow(); 00097 00100 static char* ErrorString(int err); 00101 00102 00108 void SetCommunicator(vtkMPICommunicator* comm); 00109 00110 virtual vtkMPIController *CreateSubController(vtkProcessGroup *group); 00111 00112 //BTX 00113 00115 00120 int NoBlockSend(const int* data, int length, int remoteProcessId, int tag, 00121 vtkMPICommunicator::Request& req) 00122 { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend 00123 (data ,length, remoteProcessId, tag, req); } 00124 int NoBlockSend(const unsigned long* data, int length, int remoteProcessId, 00125 int tag, vtkMPICommunicator::Request& req) 00126 { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend 00127 (data, length, remoteProcessId, tag, req); } 00128 int NoBlockSend(const char* data, int length, int remoteProcessId, 00129 int tag, vtkMPICommunicator::Request& req) 00130 { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend 00131 (data, length, remoteProcessId, tag, req); } 00132 int NoBlockSend(const float* data, int length, int remoteProcessId, 00133 int tag, vtkMPICommunicator::Request& req) 00134 { return ((vtkMPICommunicator*)this->Communicator)->NoBlockSend 00135 (data, length, remoteProcessId, tag, req); } 00137 00139 00143 int NoBlockReceive(int* data, int length, int remoteProcessId, 00144 int tag, vtkMPICommunicator::Request& req) 00145 { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive 00146 (data, length, remoteProcessId, tag, req); } 00147 int NoBlockReceive(unsigned long* data, int length, 00148 int remoteProcessId, int tag, 00149 vtkMPICommunicator::Request& req) 00150 { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive 00151 (data, length, remoteProcessId, tag, req); } 00152 int NoBlockReceive(char* data, int length, int remoteProcessId, 00153 int tag, vtkMPICommunicator::Request& req) 00154 { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive 00155 (data, length, remoteProcessId, tag, req); } 00156 int NoBlockReceive(float* data, int length, int remoteProcessId, 00157 int tag, vtkMPICommunicator::Request& req) 00158 { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive 00159 (data, length, remoteProcessId, tag, req); } 00160 #ifdef VTK_USE_64BIT_IDS 00161 int NoBlockReceive(vtkIdType* data, int length, int remoteProcessId, 00162 int tag, vtkMPICommunicator::Request& req) 00163 { return ((vtkMPICommunicator*)this->Communicator)->NoBlockReceive 00164 (data, length, remoteProcessId, tag, req); } 00166 #endif 00167 00168 //ETX 00169 00170 static const char* GetProcessorName(); 00171 00173 00175 static void SetUseSsendForRMI(int use_send) 00176 { vtkMPIController::UseSsendForRMI = (use_send != 0)? 1: 0; } 00177 static int GetUseSsendForRMI() { return vtkMPIController::UseSsendForRMI; } 00179 //BTX 00180 protected: 00181 vtkMPIController(); 00182 ~vtkMPIController(); 00183 00184 // Set the communicator to comm and call InitializeNumberOfProcesses() 00185 void InitializeCommunicator(vtkMPICommunicator* comm); 00186 00187 // Duplicate the current communicator, creating RMICommunicator 00188 void InitializeRMICommunicator(); 00189 00191 00194 virtual void TriggerRMIInternal(int remoteProcessId, 00195 void* arg, int argLength, int rmiTag, bool propagate); 00197 00198 // MPI communicator created when Initialize() called. 00199 // This is a copy of MPI_COMM_WORLD but uses a new 00200 // context, i.e. even if the tags are the same, the 00201 // RMI messages will not interfere with user level 00202 // messages. 00203 static vtkMPICommunicator* WorldRMICommunicator; 00204 00205 friend class vtkMPIOutputWindow; 00206 00207 // Initialize only once. 00208 static int Initialized; 00209 00210 static char ProcessorName[]; 00211 00213 static int UseSsendForRMI; 00214 private: 00215 vtkMPIController(const vtkMPIController&); // Not implemented. 00216 void operator=(const vtkMPIController&); // Not implemented. 00217 //ETX 00218 }; 00219 00220 00221 #endif 00222 00223