Skip to content

Commit

Permalink
ref: Update to detray version 66.1 (#594)
Browse files Browse the repository at this point in the history
feat: cuda navigation validation
oneAPI 2024.1.0 Support, main branch (2024.05.15.)
feat: Add simd intersectors and benchmark them
feat: Move material maps generation to factory, add material maps to new toy detector and remove old toy detector
ref: Allow printing of propagation config and remove templates
Update README.md
fix: navigation and make mask tolerance scaling configurable
  • Loading branch information
niermann999 authored May 27, 2024
1 parent 8d2996c commit 41116c8
Show file tree
Hide file tree
Showing 25 changed files with 38 additions and 87 deletions.
2 changes: 1 addition & 1 deletion core/include/traccc/finding/finding_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct finding_config {
scalar_t chi2_max = 30.f;

/// Propagation configuration
detray::propagation::config<scalar_t> propagation{};
detray::propagation::config propagation{};

/****************************
* GPU-specfic parameters
Expand Down
3 changes: 1 addition & 2 deletions core/include/traccc/fitting/fitting_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
namespace traccc {

/// Configuration struct for track fitting
template <typename scalar_t>
struct fitting_config {

std::size_t n_iterations = 1;

/// Propagation configuration
detray::propagation::config<scalar_t> propagation{};
detray::propagation::config propagation{};
};

} // namespace traccc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class kalman_fitter {
using intersection_type = typename navigator_t::intersection_type;

/// Configuration type
using config_type = fitting_config<scalar_type>;
using config_type = fitting_config;

// Field type
using bfield_type = typename stepper_t::magnetic_field_type;
Expand Down
13 changes: 1 addition & 12 deletions examples/options/include/traccc/options/track_propagation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class track_propagation : public interface {
/// @{

/// Propagation configuration object
detray::propagation::config<float> config;
detray::propagation::config config;

/// @}

Expand All @@ -37,17 +37,6 @@ class track_propagation : public interface {
///
void read(const boost::program_options::variables_map& vm) override;

/// Set up a configuration object based on the command line options
///
/// @param cfg The configuration object to fill
///
void setup(detray::propagation::config<float>& cfg) const;
/// Set up a configuration object based on the command line options
///
/// @param cfg The configuration object to fill
///
void setup(detray::propagation::config<double>& cfg) const;

private:
/// Print the specific options of this class
std::ostream& print_impl(std::ostream& out) const override;
Expand Down
46 changes: 2 additions & 44 deletions examples/options/src/track_propagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,52 +57,10 @@ void track_propagation::read(const po::variables_map&) {
config.navigation.search_window = m_search_window;
}

void track_propagation::setup(detray::propagation::config<float>& cfg) const {

cfg = config;
return;
}

void track_propagation::setup(detray::propagation::config<double>& cfg) const {

cfg.stepping.min_stepsize = config.stepping.min_stepsize;
cfg.stepping.rk_error_tol = config.stepping.rk_error_tol;
cfg.stepping.step_constraint = config.stepping.step_constraint;
cfg.stepping.path_limit = config.stepping.path_limit;
cfg.stepping.max_rk_updates = config.stepping.max_rk_updates;
cfg.stepping.use_mean_loss = config.stepping.use_mean_loss;
cfg.stepping.use_eloss_gradient = config.stepping.use_eloss_gradient;
cfg.stepping.use_field_gradient = config.stepping.use_field_gradient;
cfg.stepping.do_covariance_transport =
config.stepping.do_covariance_transport;

cfg.navigation.min_mask_tolerance = config.navigation.min_mask_tolerance;
cfg.navigation.max_mask_tolerance = config.navigation.max_mask_tolerance;
cfg.navigation.on_surface_tolerance =
config.navigation.on_surface_tolerance;
cfg.navigation.overstep_tolerance = config.navigation.overstep_tolerance;
cfg.navigation.search_window[0] = config.navigation.search_window[0];
cfg.navigation.search_window[1] = config.navigation.search_window[1];
return;
}

std::ostream& track_propagation::print_impl(std::ostream& out) const {

out << " Constraint step size : "
<< config.stepping.step_constraint / detray::unit<float>::mm
<< " [mm]\n"
<< " Overstep tolerance : "
<< config.navigation.overstep_tolerance / detray::unit<float>::um
<< " [um]\n"
<< " Minimum mask tolerance: "
<< config.navigation.min_mask_tolerance / detray::unit<float>::mm
<< " [mm]\n"
<< " Maximum mask tolerance: "
<< config.navigation.max_mask_tolerance / detray::unit<float>::mm
<< " [mm]\n"
<< " Search window : " << config.navigation.search_window[0]
<< " x " << config.navigation.search_window[1] << "\n"
<< " Runge-Kutta tolerance : " << config.stepping.rk_error_tol;
out << config;

return out;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/run/common/throughput_mt.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ int throughput_mt(std::string_view description, int argc, char* argv[],
finding_cfg.max_num_branches_per_seed = finding_opts.nmax_per_seed;
finding_cfg.max_num_skipping_per_cand =
finding_opts.max_num_skipping_per_cand;
propagation_opts.setup(finding_cfg.propagation);
finding_cfg.propagation = propagation_opts.config;

typename FULL_CHAIN_ALG::fitting_algorithm::config_type fitting_cfg;
propagation_opts.setup(fitting_cfg.propagation);
fitting_cfg.propagation = propagation_opts.config;

// Set up the full-chain algorithm(s). One for each thread.
std::vector<FULL_CHAIN_ALG> algs;
Expand Down
4 changes: 2 additions & 2 deletions examples/run/common/throughput_st.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ int throughput_st(std::string_view description, int argc, char* argv[],
finding_cfg.max_num_branches_per_seed = finding_opts.nmax_per_seed;
finding_cfg.max_num_skipping_per_cand =
finding_opts.max_num_skipping_per_cand;
propagation_opts.setup(finding_cfg.propagation);
finding_cfg.propagation = propagation_opts.config;

typename FULL_CHAIN_ALG::fitting_algorithm::config_type fitting_cfg;
propagation_opts.setup(fitting_cfg.propagation);
fitting_cfg.propagation = propagation_opts.config;

// Set up the full-chain algorithm.
std::unique_ptr<FULL_CHAIN_ALG> alg = std::make_unique<FULL_CHAIN_ALG>(
Expand Down
4 changes: 2 additions & 2 deletions examples/run/cpu/seeding_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ int seq_run(const traccc::opts::track_seeding& seeding_opts,
cfg.chi2_max = finding_opts.chi2_max;
cfg.max_num_branches_per_seed = finding_opts.nmax_per_seed;
cfg.max_num_skipping_per_cand = finding_opts.max_num_skipping_per_cand;
propagation_opts.setup(cfg.propagation);
cfg.propagation = propagation_opts.config;

traccc::finding_algorithm<rk_stepper_type, host_navigator_type>
host_finding(cfg);

// Fitting algorithm object
typename traccc::fitting_algorithm<host_fitter_type>::config_type fit_cfg;
propagation_opts.setup(fit_cfg.propagation);
fit_cfg.propagation = propagation_opts.config;

traccc::fitting_algorithm<host_fitter_type> host_fitting(fit_cfg);

Expand Down
4 changes: 2 additions & 2 deletions examples/run/cpu/seq_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ int seq_run(const traccc::opts::input_data& input_opts,
finding_cfg.max_num_branches_per_seed = finding_opts.nmax_per_seed;
finding_cfg.max_num_skipping_per_cand =
finding_opts.max_num_skipping_per_cand;
propagation_opts.setup(finding_cfg.propagation);
finding_cfg.propagation = propagation_opts.config;

fitting_algorithm::config_type fitting_cfg;
propagation_opts.setup(fitting_cfg.propagation);
fitting_cfg.propagation = propagation_opts.config;

// Algorithms
traccc::host::clusterization_algorithm ca(host_mr);
Expand Down
4 changes: 2 additions & 2 deletions examples/run/cpu/truth_finding_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ int seq_run(const traccc::opts::track_finding& finding_opts,
cfg.chi2_max = finding_opts.chi2_max;
cfg.max_num_branches_per_seed = finding_opts.nmax_per_seed;
cfg.max_num_skipping_per_cand = finding_opts.max_num_skipping_per_cand;
propagation_opts.setup(cfg.propagation);
cfg.propagation = propagation_opts.config;

// Finding algorithm object
traccc::finding_algorithm<rk_stepper_type, host_navigator_type>
host_finding(cfg);

// Fitting algorithm object
typename traccc::fitting_algorithm<host_fitter_type>::config_type fit_cfg;
propagation_opts.setup(fit_cfg.propagation);
fit_cfg.propagation = propagation_opts.config;

traccc::fitting_algorithm<host_fitter_type> host_fitting(fit_cfg);

Expand Down
2 changes: 1 addition & 1 deletion examples/run/cpu/truth_fitting_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int main(int argc, char* argv[]) {

// Fitting algorithm object
typename traccc::fitting_algorithm<host_fitter_type>::config_type fit_cfg;
propagation_opts.setup(fit_cfg.propagation);
fit_cfg.propagation = propagation_opts.config;

traccc::fitting_algorithm<host_fitter_type> host_fitting(fit_cfg);

Expand Down
4 changes: 2 additions & 2 deletions examples/run/cuda/seeding_example_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ int seq_run(const traccc::opts::track_seeding& seeding_opts,
cfg.chi2_max = finding_opts.chi2_max;
cfg.max_num_branches_per_seed = finding_opts.nmax_per_seed;
cfg.max_num_skipping_per_cand = finding_opts.max_num_skipping_per_cand;
propagation_opts.setup(cfg.propagation);
cfg.propagation = propagation_opts.config;

// Finding algorithm object
traccc::finding_algorithm<rk_stepper_type, host_navigator_type>
Expand All @@ -202,7 +202,7 @@ int seq_run(const traccc::opts::track_seeding& seeding_opts,

// Fitting algorithm object
typename traccc::fitting_algorithm<host_fitter_type>::config_type fit_cfg;
propagation_opts.setup(fit_cfg.propagation);
fit_cfg.propagation = propagation_opts.config;

traccc::fitting_algorithm<host_fitter_type> host_fitting(fit_cfg);
traccc::cuda::fitting_algorithm<device_fitter_type> device_fitting(
Expand Down
4 changes: 2 additions & 2 deletions examples/run/cuda/seq_example_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ int seq_run(const traccc::opts::detector& detector_opts,
finding_cfg.max_num_branches_per_seed = finding_opts.nmax_per_seed;
finding_cfg.max_num_skipping_per_cand =
finding_opts.max_num_skipping_per_cand;
propagation_opts.setup(finding_cfg.propagation);
finding_cfg.propagation = propagation_opts.config;

host_fitting_algorithm::config_type fitting_cfg;
propagation_opts.setup(fitting_cfg.propagation);
fitting_cfg.propagation = propagation_opts.config;

// Constant B field for the track finding and fitting
const traccc::vector3 field_vec = {0.f, 0.f,
Expand Down
4 changes: 2 additions & 2 deletions examples/run/cuda/truth_finding_example_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ int seq_run(const traccc::opts::track_finding& finding_opts,
cfg.chi2_max = finding_opts.chi2_max;
cfg.max_num_branches_per_seed = finding_opts.nmax_per_seed;
cfg.max_num_skipping_per_cand = finding_opts.max_num_skipping_per_cand;
propagation_opts.setup(cfg.propagation);
cfg.propagation = propagation_opts.config;

// Finding algorithm object
traccc::finding_algorithm<rk_stepper_type, host_navigator_type>
Expand All @@ -177,7 +177,7 @@ int seq_run(const traccc::opts::track_finding& finding_opts,

// Fitting algorithm object
typename traccc::fitting_algorithm<host_fitter_type>::config_type fit_cfg;
propagation_opts.setup(fit_cfg.propagation);
fit_cfg.propagation = propagation_opts.config;

traccc::fitting_algorithm<host_fitter_type> host_fitting(fit_cfg);
traccc::cuda::fitting_algorithm<device_fitter_type> device_fitting(
Expand Down
2 changes: 1 addition & 1 deletion examples/run/cuda/truth_fitting_example_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ int main(int argc, char* argv[]) {

// Fitting algorithm object
typename traccc::fitting_algorithm<host_fitter_type>::config_type fit_cfg;
propagation_opts.setup(fit_cfg.propagation);
fit_cfg.propagation = propagation_opts.config;

traccc::fitting_algorithm<host_fitter_type> host_fitting(fit_cfg);
traccc::cuda::fitting_algorithm<device_fitter_type> device_fitting(
Expand Down
2 changes: 1 addition & 1 deletion examples/simulation/simulate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ int main(int argc, char* argv[]) {
generation_opts.events, host_det, field, std::move(generator),
std::move(smearer_writer_cfg), full_path);

propagation_opts.setup(sim.get_config().propagation);
sim.get_config().propagation = propagation_opts.config;

sim.run();

Expand Down
2 changes: 1 addition & 1 deletion examples/simulation/simulate_telescope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int simulate(const traccc::opts::generation& generation_opts,
writer_type>(
generation_opts.events, det, field, std::move(generator),
std::move(smearer_writer_cfg), full_path);
propagation_opts.setup(sim.get_config().propagation);
sim.get_config().propagation = propagation_opts.config;

sim.run();

Expand Down
4 changes: 2 additions & 2 deletions examples/simulation/simulate_toy_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int simulate(const traccc::opts::generation& generation_opts,
auto field = detray::bfield::create_const_field(B);

// Create the toy geometry
detray::toy_det_config<scalar> toy_cfg{};
detray::toy_det_config toy_cfg{};
toy_cfg.n_brl_layers(4u).n_edc_layers(7u);
// @TODO: Increase the material budget again
toy_cfg.module_mat_thickness(0.11 * detray::unit<scalar>::mm);
Expand Down Expand Up @@ -104,7 +104,7 @@ int simulate(const traccc::opts::generation& generation_opts,
writer_type>(
generation_opts.events, det, field, std::move(generator),
std::move(smearer_writer_cfg), full_path);
propagation_opts.setup(sim.get_config().propagation);
sim.get_config().propagation = propagation_opts.config;

sim.run();

Expand Down
2 changes: 1 addition & 1 deletion examples/simulation/simulate_wire_chamber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int simulate(const traccc::opts::generation& generation_opts,
writer_type>(
generation_opts.events, det, field, std::move(generator),
std::move(smearer_writer_cfg), full_path);
propagation_opts.setup(sim.get_config().propagation);
sim.get_config().propagation = propagation_opts.config;

sim.run();

Expand Down
2 changes: 1 addition & 1 deletion extern/detray/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ message( STATUS "Building Detray as part of the TRACCC project" )

# Declare where to get Detray from.
set( TRACCC_DETRAY_SOURCE
"URL;https://github.com/acts-project/detray/archive/refs/tags/v0.65.1.tar.gz;URL_MD5;fbf57a881565fa6019d79d13409b588f"
"URL;https://github.com/acts-project/detray/archive/refs/tags/v0.66.1.tar.gz;URL_MD5;000a0a36f953f74466c9e889261dd166"
CACHE STRING "Source for Detray, when built as part of this project" )

mark_as_advanced( TRACCC_DETRAY_SOURCE )
Expand Down
2 changes: 1 addition & 1 deletion simulation/include/traccc/simulation/simulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct simulator {
using scalar_type = typename detector_t::scalar_type;

struct config {
detray::propagation::config<scalar_type> propagation;
detray::propagation::config propagation;
};

using algebra_type = typename detector_t::algebra_type;
Expand Down
1 change: 1 addition & 0 deletions tests/common/tests/kalman_fitting_telescope_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class KalmanFittingTelescopeTests : public KalmanFittingTests {
auto writer_cfg = detray::io::detector_writer_config{}
.format(detray::io::format::json)
.replace_files(true)
.write_material(true)
.path(std::get<0>(GetParam()));
detray::io::write_detector(det, name_map, writer_cfg);
}
Expand Down
4 changes: 3 additions & 1 deletion tests/common/tests/kalman_fitting_toy_detector_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class KalmanFittingToyDetectorTests : public KalmanFittingTests {
virtual void SetUp() override {
vecmem::host_memory_resource host_mr;

detray::toy_det_config<scalar> toy_cfg{};
detray::toy_det_config toy_cfg{};
toy_cfg.n_brl_layers(n_barrels).n_edc_layers(n_endcaps).do_check(false);

// Create the toy geometry
Expand All @@ -66,6 +66,8 @@ class KalmanFittingToyDetectorTests : public KalmanFittingTests {
auto writer_cfg = detray::io::detector_writer_config{}
.format(detray::io::format::json)
.replace_files(true)
.write_grids(true)
.write_material(true)
.path(std::get<0>(GetParam()));
detray::io::write_detector(det, name_map, writer_cfg);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/common/tests/kalman_fitting_wire_chamber_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class KalmanFittingWireChamberTests : public KalmanFittingTests {
auto writer_cfg = detray::io::detector_writer_config{}
.format(detray::io::format::json)
.replace_files(true)
.write_grids(true)
.write_material(true)
.path(std::get<0>(GetParam()));
detray::io::write_detector(det, name_map, writer_cfg);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/cpu/test_simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ GTEST_TEST(traccc_simulation, toy_detector_simulation) {
auto field = detray::bfield::create_const_field(B);

// Create geometry
detray::toy_det_config<scalar> toy_cfg{};
detray::toy_det_config toy_cfg{};
const auto [detector, names] = detray::build_toy_detector(host_mr, toy_cfg);

using geo_cxt_t = typename decltype(detector)::geometry_context;
Expand Down

0 comments on commit 41116c8

Please sign in to comment.