| 132 | } |
| 133 | |
| 134 | int ParallelResampling(int argc, char* argv[]) |
| 135 | { |
| 136 | // This is here to avoid false leak messages from vtkDebugLeaks when |
| 137 | // using mpich. It appears that the root process which spawns all the |
| 138 | // main processes waits in MPI_Init() and calls exit() when |
| 139 | // the others are done, causing apparent memory leaks for any objects |
| 140 | // created before MPI_Init(). |
| 141 | MPI_Init(&argc, &argv); |
| 142 | |
| 143 | // Note that this will create a vtkMPIController if MPI |
| 144 | // is configured, vtkThreadedController otherwise. |
| 145 | vtkMPIController* contr = vtkMPIController::New(); |
| 146 | contr->Initialize(&argc, &argv, 1); |
| 147 | |
| 148 | int retVal = 1; |
| 149 | |
| 150 | vtkMultiProcessController::SetGlobalController(contr); |
| 151 | |
| 152 | int me = contr->GetLocalProcessId(); |
| 153 | |
| 154 | if (!contr->IsA("vtkMPIController")) |
| 155 | { |
| 156 | if (me == 0) |
| 157 | { |
| 158 | std::cout << "DistributedData test requires MPI" << std::endl; |
| 159 | } |
| 160 | contr->Delete(); |
| 161 | return retVal; // is this the right error val? TODO |
| 162 | } |
| 163 | |
| 164 | MyProcess* p = MyProcess::New(); |
| 165 | p->SetArgs(argc, argv); |
| 166 | contr->SetSingleProcessObject(p); |
| 167 | contr->SingleMethodExecute(); |
| 168 | |
| 169 | retVal = p->GetReturnValue(); |
| 170 | p->Delete(); |
| 171 | |
| 172 | contr->Finalize(); |
| 173 | contr->Delete(); |
| 174 | |
| 175 | return !retVal; |
| 176 | } |
nothing calls this directly
no test coverage detected