Skip to content

Commit

Permalink
Updated the example applications for the modified "options code".
Browse files Browse the repository at this point in the history
Made all of the applications print their configuration parameters
in a uniform way, using the helper code introduced with the
"options code".
  • Loading branch information
krasznaa committed Mar 5, 2024
1 parent da3f58f commit 93dc0d1
Show file tree
Hide file tree
Showing 16 changed files with 133 additions and 89 deletions.
32 changes: 18 additions & 14 deletions examples/run/alpaka/seeding_example_alpaka.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2023 CERN for the benefit of the ACTS project
* (c) 2023-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand Down Expand Up @@ -61,12 +61,11 @@
using namespace traccc;
namespace po = boost::program_options;

int seq_run(
const traccc::seeding_input_config& /*i_cfg*/,
const traccc::finding_input_config<traccc::scalar>& /*finding_cfg*/,
const traccc::propagation_options<traccc::scalar>& /*propagation_opts*/,
const traccc::common_options& common_opts,
const traccc::detector_input_options& det_opts, bool run_cpu) {
int seq_run(const traccc::seeding_input_options& /*i_cfg*/,
const traccc::finding_input_options& /*finding_cfg*/,
const traccc::propagation_options& /*propagation_opts*/,
const traccc::common_options& common_opts,
const traccc::detector_input_options& det_opts, bool run_cpu) {

using host_detector_type = detray::detector<>;

Expand Down Expand Up @@ -318,9 +317,9 @@ int main(int argc, char* argv[]) {
desc.add_options()("help,h", "Give some help with the program's options");
traccc::common_options common_opts(desc);
traccc::detector_input_options det_opts(desc);
traccc::seeding_input_config seeding_input_cfg(desc);
traccc::finding_input_config<traccc::scalar> finding_input_cfg(desc);
traccc::propagation_options<traccc::scalar> propagation_opts(desc);
traccc::seeding_input_options seeding_input_cfg(desc);
traccc::finding_input_options finding_input_cfg(desc);
traccc::propagation_options propagation_opts(desc);
desc.add_options()("run-cpu", po::value<bool>()->default_value(false),
"run cpu tracking as well");

Expand All @@ -334,12 +333,17 @@ int main(int argc, char* argv[]) {
common_opts.read(vm);
det_opts.read(vm);
seeding_input_cfg.read(vm);
// finding_input_cfg.read(vm);
// propagation_opts.read(vm);
finding_input_cfg.read(vm);
propagation_opts.read(vm);
auto run_cpu = vm["run-cpu"].as<bool>();

std::cout << "Running " << argv[0] << " " << det_opts.detector_file << " "
<< common_opts.input_directory << " " << common_opts.events
// Tell the user what's happening.
std::cout << "\nRunning the tracking chain using Alpaka\n\n"
<< common_opts << "\n"
<< det_opts << "\n"
<< seeding_input_cfg << "\n"
<< finding_input_cfg << "\n"
<< propagation_opts << "\n"
<< std::endl;

return seq_run(seeding_input_cfg, finding_input_cfg, propagation_opts,
Expand Down
21 changes: 13 additions & 8 deletions examples/run/cpu/seeding_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
using namespace traccc;
namespace po = boost::program_options;

int seq_run(const traccc::seeding_input_config& /*i_cfg*/,
const traccc::finding_input_config<traccc::scalar>& finding_cfg,
const traccc::propagation_options<traccc::scalar>& propagation_opts,
int seq_run(const traccc::seeding_input_options& /*i_cfg*/,
const traccc::finding_input_options& finding_cfg,
const traccc::propagation_options& propagation_opts,
const traccc::common_options& common_opts,
const traccc::detector_input_options& det_opts) {

Expand Down Expand Up @@ -272,9 +272,9 @@ int main(int argc, char* argv[]) {
desc.add_options()("help,h", "Give some help with the program's options");
traccc::common_options common_opts(desc);
traccc::detector_input_options det_opts(desc);
traccc::seeding_input_config seeding_input_cfg(desc);
traccc::finding_input_config<traccc::scalar> finding_input_cfg(desc);
traccc::propagation_options<traccc::scalar> propagation_opts(desc);
traccc::seeding_input_options seeding_input_cfg(desc);
traccc::finding_input_options finding_input_cfg(desc);
traccc::propagation_options propagation_opts(desc);

po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
Expand All @@ -289,8 +289,13 @@ int main(int argc, char* argv[]) {
finding_input_cfg.read(vm);
propagation_opts.read(vm);

std::cout << "Running " << argv[0] << " " << det_opts.detector_file << " "
<< common_opts.input_directory << " " << common_opts.events
// Tell the user what's happening.
std::cout << "\nRunning the tracking chain on the host\n\n"
<< common_opts << "\n"
<< det_opts << "\n"
<< seeding_input_cfg << "\n"
<< finding_input_cfg << "\n"
<< propagation_opts << "\n"
<< std::endl;

return seq_run(seeding_input_cfg, finding_input_cfg, propagation_opts,
Expand Down
12 changes: 7 additions & 5 deletions examples/run/cpu/seq_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

namespace po = boost::program_options;

int seq_run(const traccc::full_tracking_input_config& i_cfg,
int seq_run(const traccc::full_tracking_input_options& i_cfg,
const traccc::common_options& common_opts,
const traccc::detector_input_options& det_opts) {

Expand Down Expand Up @@ -162,7 +162,7 @@ int main(int argc, char* argv[]) {
desc.add_options()("help,h", "Give some help with the program's options");
traccc::common_options common_opts(desc);
traccc::detector_input_options det_opts(desc);
traccc::full_tracking_input_config full_tracking_input_cfg(desc);
traccc::full_tracking_input_options full_tracking_input_cfg(desc);

po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
Expand All @@ -175,9 +175,11 @@ int main(int argc, char* argv[]) {
det_opts.read(vm);
full_tracking_input_cfg.read(vm);

std::cout << "Running " << argv[0] << " "
<< full_tracking_input_cfg.detector_file << " "
<< common_opts.input_directory << " " << common_opts.events
// Tell the user what's happening.
std::cout << "\nRunning the full tracking chain on the host\n\n"
<< common_opts << "\n"
<< det_opts << "\n"
<< full_tracking_input_cfg << "\n"
<< std::endl;

return seq_run(full_tracking_input_cfg, common_opts, det_opts);
Expand Down
17 changes: 11 additions & 6 deletions examples/run/cpu/truth_finding_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
using namespace traccc;
namespace po = boost::program_options;

int seq_run(const traccc::finding_input_config<traccc::scalar>& i_cfg,
const traccc::propagation_options<scalar>& propagation_opts,
int seq_run(const traccc::finding_input_options& i_cfg,
const traccc::propagation_options& propagation_opts,
const traccc::common_options& common_opts,
const traccc::detector_input_options& det_opts) {

Expand Down Expand Up @@ -203,8 +203,8 @@ int main(int argc, char* argv[]) {
desc.add_options()("help,h", "Give some help with the program's options");
traccc::common_options common_opts(desc);
traccc::detector_input_options det_opts(desc);
traccc::finding_input_config<traccc::scalar> finding_input_cfg(desc);
traccc::propagation_options<scalar> propagation_opts(desc);
traccc::finding_input_options finding_input_cfg(desc);
traccc::propagation_options propagation_opts(desc);

po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
Expand All @@ -218,8 +218,13 @@ int main(int argc, char* argv[]) {
finding_input_cfg.read(vm);
propagation_opts.read(vm);

std::cout << "Running " << argv[0] << " " << common_opts.input_directory
<< " " << common_opts.events << std::endl;
// Tell the user what's happening.
std::cout << "\nRunning truth track finding on the host\n\n"
<< common_opts << "\n"
<< det_opts << "\n"
<< finding_input_cfg << "\n"
<< propagation_opts << "\n"
<< std::endl;

return seq_run(finding_input_cfg, propagation_opts, common_opts, det_opts);
}
10 changes: 7 additions & 3 deletions examples/run/cpu/truth_fitting_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int main(int argc, char* argv[]) {
desc.add_options()("help,h", "Give some help with the program's options");
traccc::common_options common_opts(desc);
traccc::detector_input_options det_opts(desc);
traccc::propagation_options<scalar> propagation_opts(desc);
traccc::propagation_options propagation_opts(desc);

po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
Expand All @@ -64,8 +64,12 @@ int main(int argc, char* argv[]) {

propagation_opts.read(vm);

std::cout << "Running " << argv[0] << " " << common_opts.input_directory
<< " " << common_opts.events << std::endl;
// Tell the user what's happening.
std::cout << "\nRunning truth track fitting on the host\n\n"
<< common_opts << "\n"
<< det_opts << "\n"
<< propagation_opts << "\n"
<< std::endl;

/// Type declarations
using host_detector_type = detray::detector<detray::default_metadata,
Expand Down
21 changes: 13 additions & 8 deletions examples/run/cuda/seeding_example_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
using namespace traccc;
namespace po = boost::program_options;

int seq_run(const traccc::seeding_input_config& /*i_cfg*/,
const traccc::finding_input_config<traccc::scalar>& finding_cfg,
const traccc::propagation_options<traccc::scalar>& propagation_opts,
int seq_run(const traccc::seeding_input_options& /*i_cfg*/,
const traccc::finding_input_options& finding_cfg,
const traccc::propagation_options& propagation_opts,
const traccc::common_options& common_opts,
const traccc::detector_input_options& det_opts, bool run_cpu) {

Expand Down Expand Up @@ -485,9 +485,9 @@ int main(int argc, char* argv[]) {
desc.add_options()("help,h", "Give some help with the program's options");
traccc::common_options common_opts(desc);
traccc::detector_input_options det_opts(desc);
traccc::seeding_input_config seeding_input_cfg(desc);
traccc::finding_input_config<traccc::scalar> finding_input_cfg(desc);
traccc::propagation_options<traccc::scalar> propagation_opts(desc);
traccc::seeding_input_options seeding_input_cfg(desc);
traccc::finding_input_options finding_input_cfg(desc);
traccc::propagation_options propagation_opts(desc);
desc.add_options()("run-cpu", po::value<bool>()->default_value(false),
"run cpu tracking as well");

Expand All @@ -505,8 +505,13 @@ int main(int argc, char* argv[]) {
propagation_opts.read(vm);
auto run_cpu = vm["run-cpu"].as<bool>();

std::cout << "Running " << argv[0] << " " << det_opts.detector_file << " "
<< common_opts.input_directory << " " << common_opts.events
// Tell the user what's happening.
std::cout << "\nRunning the tracking chain using CUDA\n\n"
<< common_opts << "\n"
<< det_opts << "\n"
<< seeding_input_cfg << "\n"
<< finding_input_cfg << "\n"
<< propagation_opts << "\n"
<< std::endl;

return seq_run(seeding_input_cfg, finding_input_cfg, propagation_opts,
Expand Down
12 changes: 7 additions & 5 deletions examples/run/cuda/seq_example_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

namespace po = boost::program_options;

int seq_run(const traccc::full_tracking_input_config& i_cfg,
int seq_run(const traccc::full_tracking_input_options& i_cfg,
const traccc::common_options& common_opts,
const traccc::detector_input_options& det_opts, bool run_cpu) {

Expand Down Expand Up @@ -308,7 +308,7 @@ int main(int argc, char* argv[]) {
desc.add_options()("help,h", "Give some help with the program's options");
traccc::common_options common_opts(desc);
traccc::detector_input_options det_opts(desc);
traccc::full_tracking_input_config full_tracking_input_cfg(desc);
traccc::full_tracking_input_options full_tracking_input_cfg(desc);
desc.add_options()("run-cpu", po::value<bool>()->default_value(false),
"run cpu tracking as well");

Expand All @@ -324,9 +324,11 @@ int main(int argc, char* argv[]) {
full_tracking_input_cfg.read(vm);
auto run_cpu = vm["run-cpu"].as<bool>();

std::cout << "Running " << argv[0] << " "
<< full_tracking_input_cfg.detector_file << " "
<< common_opts.input_directory << " " << common_opts.events
// Tell the user what's happening.
std::cout << "\nRunning the full tracking chain using CUDA\n\n"
<< common_opts << "\n"
<< det_opts << "\n"
<< full_tracking_input_cfg << "\n"
<< std::endl;

return seq_run(full_tracking_input_cfg, common_opts, det_opts, run_cpu);
Expand Down
17 changes: 11 additions & 6 deletions examples/run/cuda/truth_finding_example_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
using namespace traccc;
namespace po = boost::program_options;

int seq_run(const traccc::finding_input_config<traccc::scalar>& i_cfg,
const traccc::propagation_options<scalar>& propagation_opts,
int seq_run(const traccc::finding_input_options& i_cfg,
const traccc::propagation_options& propagation_opts,
const traccc::common_options& common_opts,
const traccc::detector_input_options& det_opts, bool run_cpu) {

Expand Down Expand Up @@ -360,8 +360,8 @@ int main(int argc, char* argv[]) {
desc.add_options()("help,h", "Give some help with the program's options");
traccc::common_options common_opts(desc);
traccc::detector_input_options det_opts(desc);
traccc::finding_input_config<traccc::scalar> finding_input_cfg(desc);
traccc::propagation_options<scalar> propagation_opts(desc);
traccc::finding_input_options finding_input_cfg(desc);
traccc::propagation_options propagation_opts(desc);
desc.add_options()("run-cpu", po::value<bool>()->default_value(false),
"run cpu tracking as well");

Expand All @@ -379,8 +379,13 @@ int main(int argc, char* argv[]) {
propagation_opts.read(vm);
auto run_cpu = vm["run-cpu"].as<bool>();

std::cout << "Running " << argv[0] << " " << common_opts.input_directory
<< " " << common_opts.events << std::endl;
// Tell the user what's happening.
std::cout << "\nRunning truth track finding using CUDA\n\n"
<< common_opts << "\n"
<< det_opts << "\n"
<< finding_input_cfg << "\n"
<< propagation_opts << "\n"
<< std::endl;

return seq_run(finding_input_cfg, propagation_opts, common_opts, det_opts,
run_cpu);
Expand Down
10 changes: 7 additions & 3 deletions examples/run/cuda/truth_fitting_example_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main(int argc, char* argv[]) {
desc.add_options()("help,h", "Give some help with the program's options");
traccc::common_options common_opts(desc);
traccc::detector_input_options det_opts(desc);
traccc::propagation_options<scalar> propagation_opts(desc);
traccc::propagation_options propagation_opts(desc);
desc.add_options()("run-cpu", po::value<bool>()->default_value(false),
"run cpu tracking as well");

Expand All @@ -78,8 +78,12 @@ int main(int argc, char* argv[]) {
propagation_opts.read(vm);
auto run_cpu = vm["run-cpu"].as<bool>();

std::cout << "Running " << argv[0] << " " << common_opts.input_directory
<< " " << common_opts.events << std::endl;
// Tell the user what's happening.
std::cout << "\nRunning truth track fitting using CUDA\n\n"
<< common_opts << "\n"
<< det_opts << "\n"
<< propagation_opts << "\n"
<< std::endl;

/// Type declarations
using host_detector_type = detray::detector<detray::default_metadata,
Expand Down
13 changes: 8 additions & 5 deletions examples/run/kokkos/seeding_example_kokkos.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2022 CERN for the benefit of the ACTS project
* (c) 2021-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand Down Expand Up @@ -33,7 +33,7 @@

namespace po = boost::program_options;

int seq_run(const traccc::seeding_input_config& /*i_cfg*/,
int seq_run(const traccc::seeding_input_options& /*i_cfg*/,
const traccc::common_options& common_opts,
const traccc::detector_input_options& det_opts, bool run_cpu) {

Expand Down Expand Up @@ -156,7 +156,7 @@ int main(int argc, char* argv[]) {
desc.add_options()("help,h", "Give some help with the program's options");
traccc::common_options common_opts(desc);
traccc::detector_input_options det_opts(desc);
traccc::seeding_input_config seeding_input_cfg(desc);
traccc::seeding_input_options seeding_input_cfg(desc);
desc.add_options()("run-cpu", po::value<bool>()->default_value(false),
"run cpu tracking as well");

Expand All @@ -173,8 +173,11 @@ int main(int argc, char* argv[]) {
seeding_input_cfg.read(vm);
auto run_cpu = vm["run-cpu"].as<bool>();

std::cout << "Running " << argv[0] << " " << det_opts.detector_file << " "
<< common_opts.input_directory << " " << common_opts.events
// Tell the user what's happening.
std::cout << "\nRunning the tracking chain using Kokkos\n\n"
<< common_opts << "\n"
<< det_opts << "\n"
<< seeding_input_cfg << "\n"
<< std::endl;

int ret = seq_run(seeding_input_cfg, common_opts, det_opts, run_cpu);
Expand Down
Loading

0 comments on commit 93dc0d1

Please sign in to comment.