Good-bye world There should be no MPI calls after this. (Except maybe MPI_XXX_free()) unless finalized externally.
| 162 | // There should be no MPI calls after this. |
| 163 | // (Except maybe MPI_XXX_free()) unless finalized externally. |
| 164 | void vtkMPIController::Finalize(int finalizedExternally) |
| 165 | { |
| 166 | if (vtkMPIController::Initialized) |
| 167 | { |
| 168 | vtkMPIController::WorldRMICommunicator->Delete(); |
| 169 | vtkMPIController::WorldRMICommunicator = nullptr; |
| 170 | vtkMPICommunicator::WorldCommunicator->Delete(); |
| 171 | vtkMPICommunicator::WorldCommunicator = nullptr; |
| 172 | this->SetCommunicator(nullptr); |
| 173 | if (this->RMICommunicator) |
| 174 | { |
| 175 | this->RMICommunicator->Delete(); |
| 176 | this->RMICommunicator = nullptr; |
| 177 | } |
| 178 | if (finalizedExternally == 0) |
| 179 | { |
| 180 | MPI_Finalize(); |
| 181 | } |
| 182 | vtkMPIController::Initialized = 0; |
| 183 | this->Modified(); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | // Called by SetCommunicator and constructor. It frees but does |
| 188 | // not set RMIHandle (which should not be set by using MPI_Comm_dup |