Add boost short options for benchmarks - #1387
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Boost.Program_options short aliases to multiple benchmark executables to make their command lines quicker to type.
Changes:
- Added
,hshort help option across benchmarks. - Added short aliases for common numeric/string parameters (e.g.,
values,n,queries,m,dimension,d, etc.). - Added additional short flags for some benchmark-specific options (e.g.,
predicate-sort,s,buffer,b).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| benchmarks/triangulated_surface_distance/triangulated_surface_distance.cpp | Adds short aliases for help/angle/geometry/n/radius/refinements. |
| benchmarks/distributed_tree_driver/distributed_tree_driver.cpp | Adds short aliases for help/values/queries. |
| benchmarks/cluster/mst.cpp | Adds short aliases for help and several generator parameters. |
| benchmarks/cluster/hdbscan.cpp | Adds short aliases for help and several generator parameters. |
| benchmarks/cluster/distributed_dbscan.cpp | Adds short aliases for help and several distributed DBSCAN parameters. |
| benchmarks/cluster/dbscan.cpp | Adds short aliases for help and several DBSCAN parameters. |
| benchmarks/bvh_driver/bvh_driver.cpp | Adds short aliases for help/values/queries/predicate-sort/buffer. |
| benchmarks/brute_force_vs_bvh/brute_force_vs_bvh.cpp | Adds short aliases for help/dimension/predicates/primitives/repetitions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ( "help,h", "help message" ) | ||
| ( "dimension,d", bpo::value<int>(&dim)->default_value(3), "dimension" ) | ||
| ( "predicates,n", bpo::value<int>(&nqueries)->default_value(5), "number of predicates" ) | ||
| ( "primitives,m", bpo::value<int>(&nprimitives)->default_value(5), "number of primitives" ) |
There was a problem hiding this comment.
| ( "primitives,m", bpo::value<int>(&nprimitives)->default_value(5), "number of primitives" ) | |
| ( "primitives,q", bpo::value<int>(&nprimitives)->default_value(5), "number of primitives" ) |
for "query"
There was a problem hiding this comment.
I was thinking using n for the stuff we construct on, and m for the stuff we search for. Could use p and q instead for primitives and queries, as predicates and primitives start with the same letter.
There was a problem hiding this comment.
I don't feel strongly about it.
| ( "dimension,d", bpo::value<int>(¶ms.dim)->default_value(-1), "dimension of points to generate" ) | ||
| ( "filename,f", bpo::value<std::string>(¶ms.filename), "filename containing data" ) | ||
| ( "max-num-points,N", bpo::value<int>(¶ms.max_num_points)->default_value(-1), "max number of points to read in") | ||
| ( "n,n", bpo::value<int>(¶ms.n)->default_value(10), "number of points to generate" ) |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
benchmarks/distributed_tree_driver/distributed_tree_driver.cpp:315
- This change removes Kokkos::ScopeGuard RAII in favor of manual initialize/finalize. If boost::program_options parsing (or any later code) throws, Kokkos::finalize() will not run. Consider using an RAII guard (e.g., ScopeGuard in an inner scope with MPI_Finalize() after it, or custom guards) to guarantee Kokkos finalization and preserve the required finalize-before-MPI_Finalize order.
Kokkos::initialize(argc, argv);
namespace bpo = boost::program_options;
Parameters params;
std::string precision;
bpo::options_description desc("Allowed options");
// clang-format off
desc.add_options()
( "help,h", "produce help message" )
( "predicates,m", bpo::value<int>(¶ms.n_queries)->default_value(5000), "Number of predicates per MPI rank." )
( "primitives,n", bpo::value<int>(¶ms.n_values)->default_value(20000), "Number of primitives per MPI rank." )
( "neighbors", bpo::value<int>(¶ms.n_neighbors)->default_value(10), "Desired number of results per query." )
( "shift", bpo::value<float>(¶ms.shift)->default_value(1.f), "Shift of the point clouds. '0' means the clouds are built "
"at the same place, while '1' places the clouds next to each"
"other. Negative values and values larger than one "
"mean that the clouds are separated." )
( "partition_dim", bpo::value<int>(¶ms.partition_dim)->default_value(3), "Number of dimension used by the partitioning of the global "
"point cloud. 1 -> local clouds are aligned on a line, 2 -> "
"local clouds form a board, 3 -> local clouds form a box." )
( "precision,p", bpo::value<std::string>(&precision)->default_value("float"), "Precision (float | double)" )
( "do-not-perform-knn-search", "skip kNN search" )
( "do-not-perform-radius-search", "skip radius search" )
( "shift-queries" , "By default, points are reused for the queries. Enabling this option shrinks the local box queries are created "
"in to a third of its size and moves it to the center of the global box. The result is a huge imbalance for the "
"number of queries that need to be processed by each processor.")
;
// clang-format on
bpo::variables_map vm;
bpo::store(bpo::command_line_parser(argc, argv).options(desc).run(), vm);
bpo::notify(vm);
if (is_help_present)
{
if (comm_rank == 0)
std::cout << desc << '\n';
Kokkos::finalize();
MPI_Finalize();
return 0;
| auto *help_it = std::find_if(argv, argv + argc, [](std::string const &x) { | ||
| return x == "--help" || x == "--kokkos-help"; | ||
| }); |
| Kokkos::initialize(argc, argv); | ||
|
|
||
| if (is_help_present) | ||
| { | ||
| Kokkos::finalize(); | ||
| MPI_Finalize(); | ||
| return 0; | ||
| } | ||
|
|
||
| main_<float>(comm); | ||
|
|
||
| Kokkos::finalize(); | ||
| MPI_Finalize(); | ||
|
|
To ease writing command line.
Drive-by change: fixing treatment of help in distributed drivers.