File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ using namespace std;
1010#include < boost/program_options.hpp>
1111namespace po = boost::program_options;
1212
13+ #ifdef WITH_MPI
14+ #include < mpi.h>
15+ #endif
16+
1317
1418namespace pfasst
1519{
@@ -69,9 +73,27 @@ namespace pfasst
6973 po::store (parsed, options::get_instance ().get_variables_map ());
7074 po::notify (options::get_instance ().get_variables_map ());
7175
76+ #ifdef WITH_MPI
77+ int initialized = 0 ;
78+ MPI_Initialized (&initialized);
79+ assert ((bool )initialized);
80+ int rank = 0 ;
81+ MPI_Comm_rank (MPI_COMM_WORLD, &rank);
82+ #endif
7283 if (options::get_instance ().get_variables_map ().count (" help" )) {
73- cout << print_help () << endl;
74- if (exit_on_help) exit (0 );
84+ #ifdef WITH_MPI
85+ if (rank == 0 ) {
86+ #endif
87+ cout << print_help () << endl;
88+ #ifdef WITH_MPI
89+ }
90+ #endif
91+ if (exit_on_help) {
92+ #ifdef WITH_MPI
93+ MPI_Finalize ();
94+ #endif
95+ exit (0 );
96+ }
7597 }
7698 }
7799
You can’t perform that action at this time.
0 commit comments