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

Function main

Examples/ParallelProcessing/Generic/Cxx/TaskParallelism.cxx:74–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74int main(int argc, char* argv[])
75{
76
77 // Note that this will create a vtkMPIController if MPI
78 // is configured, vtkThreadedController otherwise.
79 vtkMPIController* controller = vtkMPIController::New();
80 controller->Initialize(&argc, &argv);
81
82 // When using MPI, the number of processes is determined
83 // by the external program which launches this application.
84 // However, when using threads, we need to set it ourselves.
85 if (controller->IsA("vtkThreadedController"))
86 {
87 // Set the number of processes to 2 for this example.
88 controller->SetNumberOfProcesses(2);
89 }
90 int numProcs = controller->GetNumberOfProcesses();
91
92 if (numProcs != 2)
93 {
94 std::cerr << "This example requires two processes." << endl;
95 controller->Finalize();
96 controller->Delete();
97 return 1;
98 }
99
100 // Execute the function named "process" on both processes
101 controller->SetSingleMethod(process, 0);
102 controller->SingleMethodExecute();
103
104 // Clean-up and exit
105 controller->Finalize();
106 controller->Delete();
107
108 return 0;
109}

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
SetSingleMethodMethod · 0.45
SingleMethodExecuteMethod · 0.45

Tested by

no test coverage detected