MCPcopy Create free account
hub / github.com/Kitware/VTK / main

Function main

Examples/ParallelProcessing/Generic/Cxx/PipelineParallelism.cxx:20–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18#include <iostream>
19
20int main(int argc, char* argv[])
21{
22
23 // Note that this will create a vtkMPIController if MPI
24 // is configured, vtkThreadedController otherwise.
25 vtkMultiProcessController* controller = vtkMultiProcessController::New();
26 controller->Initialize(&argc, &argv);
27
28 // When using MPI, the number of processes is determined
29 // by the external program which launches this application.
30 // However, when using threads, we need to set it ourselves.
31 if (controller->IsA("vtkThreadedController"))
32 {
33 // Set the number of processes to 2 for this example.
34 controller->SetNumberOfProcesses(2);
35 }
36 int numProcs = controller->GetNumberOfProcesses();
37
38 if (numProcs != 2)
39 {
40 std::cerr << "This example requires two processes." << endl;
41 controller->Finalize();
42 controller->Delete();
43 return 1;
44 }
45
46 // Assign the functions and execute them
47 controller->SetMultipleMethod(0, pipe1, 0);
48 controller->SetMultipleMethod(1, pipe2, 0);
49 controller->MultipleMethodExecute();
50
51 // Clean-up and exit
52 controller->Finalize();
53 controller->Delete();
54
55 return 0;
56}

Callers

nothing calls this directly

Calls 9

IsAMethod · 0.80
GetNumberOfProcessesMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
InitializeMethod · 0.45
SetNumberOfProcessesMethod · 0.45
FinalizeMethod · 0.45
SetMultipleMethodMethod · 0.45
MultipleMethodExecuteMethod · 0.45

Tested by

no test coverage detected