From 5f84f6152237260aeb32317c3fdc6cac4603d5d7 Mon Sep 17 00:00:00 2001 From: Gard Spreemann Date: Tue, 26 Jun 2018 15:52:02 +0200 Subject: --help --- geom_matching/wasserstein/mpi/main.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/geom_matching/wasserstein/mpi/main.cpp b/geom_matching/wasserstein/mpi/main.cpp index fa8c62b..c3b4e09 100644 --- a/geom_matching/wasserstein/mpi/main.cpp +++ b/geom_matching/wasserstein/mpi/main.cpp @@ -32,6 +32,8 @@ void print_help(const std::string & invocation) std::cout << " Mandatory. Output file name. Plain text." << std::endl; std::cout << " --chunk, -c c" << std::endl; std::cout << " Optional. Size of work chunk to send off to each computational node. Too small a value yields a lot of overhead, too large a value can cause an unbalanced load. Increase if there are many small computations. Default: 100." << std::endl; + std::cout << " --help, -h" << std::endl; + std::cout << " Print this help text." << std::endl; } void arg_fail(const std::string & invocation, int rank, const std::string & message) @@ -85,7 +87,7 @@ int main(int argc, char ** argv) if (world_size < 2) { - arg_fail(invocation, world_rank, "Currently there is no support for running with just one process."); + arg_fail(invocation, world_rank, "Currently there is no support for running with just one process. Please run at least 2 MPI jobs."); } char processor_name_tmp[MPI_MAX_PROCESSOR_NAME]; @@ -189,6 +191,17 @@ int main(int argc, char ** argv) else arg_fail(invocation, world_rank, "Missing argument for --chunk."); } + else if (arg == std::string("--help") || arg == std::string("-h")) + { + if (world_rank == 0) + print_help(invocation); + MPI_Finalize(); + exit(0); + } + else + { + arg_fail(invocation, world_rank, "Incorrect argument."); + } } -- cgit v1.2.3