Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a CI build for double precision #669

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ jobs:
- Release
- Debug
include:
- platform:
name: CUDA
container: ghcr.io/acts-project/ubuntu2404_cuda:56
cxx_standard: "20"
options: -DTRACCC_CUSTOM_SCALARTYPE=double -DDETRAY_CUSTOM_SCALARTYPE=double -DTRACCC_BUILD_CUDA=TRUE -DCMAKE_CUDA_FLAGS="-std=c++20"
run_tests: false
build: Release
- platform:
name: "SYCL"
container: ghcr.io/acts-project/ubuntu2404_cuda_oneapi:56
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/common/benchmarks/toy_detector_benchmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ToyDetectorBenchmark : public benchmark::Fixture {
traccc::seedfinder_config seeding_cfg;
traccc::seedfilter_config filter_cfg;
traccc::spacepoint_grid_config grid_cfg{seeding_cfg};
traccc::finding_config<float> finding_cfg;
traccc::finding_config finding_cfg;
traccc::fitting_config fitting_cfg;

static constexpr std::array<float, 2> phi_range{
Expand Down
4 changes: 2 additions & 2 deletions core/include/traccc/finding/finding_algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class finding_algorithm

public:
/// Configuration type
using config_type = finding_config<scalar_type>;
using config_type = finding_config;

/// Constructor for the finding algorithm
///
Expand All @@ -81,7 +81,7 @@ class finding_algorithm
finding_algorithm(const config_type& cfg) : m_cfg(cfg) {}

/// Get config object (const access)
const finding_config<scalar_type>& get_config() const { return m_cfg; }
const finding_config& get_config() const { return m_cfg; }

/// Run the algorithm
///
Expand Down
6 changes: 2 additions & 4 deletions core/include/traccc/finding/finding_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
namespace traccc {

/// Configuration struct for track finding
template <typename scalar_t>
struct finding_config {
/// Maxmimum number of branches per seed
unsigned int max_num_branches_per_seed = 10;
Expand All @@ -32,13 +31,12 @@ struct finding_config {
/// Minimum step length that track should make to reach the next surface. It
/// should be set higher than the overstep tolerance not to make it stay on
/// the same surface
scalar_t min_step_length_for_next_surface =
0.5f * detray::unit<scalar_t>::mm;
float min_step_length_for_next_surface = 0.5f * detray::unit<float>::mm;
/// Maximum step counts that track can make to reach the next surface
unsigned int max_step_counts_for_next_surface = 100;

/// Maximum Chi-square that is allowed for branching
scalar_t chi2_max = 30.f;
float chi2_max = 30.f;

/// Propagation configuration
detray::propagation::config propagation{};
Expand Down
100 changes: 50 additions & 50 deletions core/include/traccc/seeding/detail/seeding_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,34 @@ struct seedfinder_config {
// without any spacepoints
// m_config.zMin = -2800.;
// m_config.zMax = 2800.;
scalar zMin = -1186 * unit<scalar>::mm;
scalar zMax = 1186 * unit<scalar>::mm;
scalar rMax = 200 * unit<scalar>::mm;
float zMin = -1186.f * unit<float>::mm;
float zMax = 1186.f * unit<float>::mm;
float rMax = 200.f * unit<float>::mm;
// WARNING: if rMin is smaller than impactMax, the bin size will be 2*pi,
// which will make seeding very slow!
scalar rMin = 33 * unit<scalar>::mm;
float rMin = 33.f * unit<float>::mm;

// Geometry Settings
// Detector ROI
// limiting location of collision region in z
scalar collisionRegionMin = -250 * unit<scalar>::mm;
scalar collisionRegionMax = +250 * unit<scalar>::mm;
scalar phiMin = static_cast<scalar>(-M_PI);
scalar phiMax = static_cast<scalar>(M_PI);
float collisionRegionMin = -250 * unit<float>::mm;
float collisionRegionMax = +250 * unit<float>::mm;
float phiMin = static_cast<float>(-M_PI);
float phiMax = static_cast<float>(M_PI);

// Seed Cuts
// lower cutoff for seeds in MeV
scalar minPt = 500.f * unit<scalar>::MeV;
float minPt = 500.f * unit<float>::MeV;
// cot of maximum theta angle
// equivalent to 2.7 eta (pseudorapidity)
scalar cotThetaMax = 7.40627f;
float cotThetaMax = 7.40627f;
// minimum distance in mm in r between two measurements within one seed
scalar deltaRMin = 1 * unit<scalar>::mm;
float deltaRMin = 1 * unit<float>::mm;
// maximum distance in mm in r between two measurements within one seed
scalar deltaRMax = 60 * unit<scalar>::mm;
float deltaRMax = 60 * unit<float>::mm;

// FIXME: this is not used yet
// scalar upperPtResolutionPerSeed = 20* Acts::GeV;
// float upperPtResolutionPerSeed = 20* Acts::GeV;

// the delta for inverse helix radius up to which compared seeds
// are considered to have a compatible radius. delta of inverse radius
Expand All @@ -59,43 +59,43 @@ struct seedfinder_config {
// compatible

// impact parameter in mm
scalar impactMax = 10. * unit<scalar>::mm;
float impactMax = 10. * unit<float>::mm;
// how many sigmas of scattering angle should be considered?
scalar sigmaScattering = 1.0;
float sigmaScattering = 1.0;
// Upper pt limit for scattering calculation
scalar maxPtScattering = 10 * unit<scalar>::GeV;
float maxPtScattering = 10 * unit<float>::GeV;

// for how many seeds can one SpacePoint be the middle SpacePoint?
int maxSeedsPerSpM = 20;

scalar bFieldInZ = 1.99724f * unit<scalar>::T;
float bFieldInZ = 1.99724f * unit<float>::T;
// location of beam in x,y plane.
// used as offset for Space Points
vector2 beamPos{-.0 * unit<scalar>::mm, -.0 * unit<scalar>::mm};
vector2 beamPos{-.0 * unit<float>::mm, -.0 * unit<float>::mm};

// average radiation lengths of material on the length of a seed. used for
// scattering.
// default is 5%
// TODO: necessary to make amount of material dependent on detector region?
scalar radLengthPerSeed = 0.05f;
float radLengthPerSeed = 0.05f;
// alignment uncertainties, used for uncertainties in the
// non-measurement-plane of the modules
// which otherwise would be 0
// will be added to spacepoint measurement uncertainties (and therefore also
// multiplied by sigmaError)
// FIXME: call align1 and align2
scalar zAlign = 0 * unit<scalar>::mm;
scalar rAlign = 0 * unit<scalar>::mm;
float zAlign = 0 * unit<float>::mm;
float rAlign = 0 * unit<float>::mm;
// used for measurement (+alignment) uncertainties.
// find seeds within 5sigma error ellipse
scalar sigmaError = 5;
float sigmaError = 5;

// derived values, set on Seedfinder construction
scalar highland = 0;
scalar maxScatteringAngle2 = 0;
scalar pTPerHelixRadius = 0;
scalar minHelixDiameter2 = 0;
scalar pT2perRadius = 0;
float highland = 0;
float maxScatteringAngle2 = 0;
float pTPerHelixRadius = 0;
float minHelixDiameter2 = 0;
float pT2perRadius = 0;

// Multiplicator for the number of phi-bins. The minimum number of phi-bins
// depends on min_pt, magnetic field: 2*M_PI/(minPT particle
Expand All @@ -121,11 +121,11 @@ struct seedfinder_config {
// Configure unset parameters
TRACCC_HOST_DEVICE
void setup() {
highland = 13.6f * traccc::unit<traccc::scalar>::MeV *
highland = 13.6f * traccc::unit<float>::MeV *
std::sqrt(radLengthPerSeed) *
(1.f + 0.038f * std::log(radLengthPerSeed));

scalar maxScatteringAngle = highland / minPt;
float maxScatteringAngle = highland / minPt;
maxScatteringAngle2 = maxScatteringAngle * maxScatteringAngle;

pTPerHelixRadius = bFieldInZ;
Expand Down Expand Up @@ -155,29 +155,29 @@ struct spacepoint_grid_config {
phiBinDeflectionCoverage(finder_config.phiBinDeflectionCoverage) {}

// magnetic field in kTesla
scalar bFieldInZ;
float bFieldInZ;
// minimum pT to be found by seedfinder in MeV
scalar minPt;
float minPt;
// maximum extension of sensitive detector layer relevant for seeding as
// distance from x=y=0 (i.e. in r) in mm
scalar rMax;
float rMax;
// maximum extension of sensitive detector layer relevant for seeding in
// positive direction in z in mm
scalar zMax;
float zMax;
// maximum extension of sensitive detector layer relevant for seeding in
// negative direction in z in mm
scalar zMin;
float zMin;
// maximum distance in r from middle space point to bottom or top spacepoint
// in mm
scalar deltaRMax;
float deltaRMax;
// maximum forward direction expressed as cot(theta)
scalar cotThetaMax;
float cotThetaMax;
// impact parameter in mm
scalar impactMax;
float impactMax;
// minimum phi value for phiAxis construction
scalar phiMin = static_cast<scalar>(-M_PI);
float phiMin = static_cast<float>(-M_PI);
// maximum phi value for phiAxis construction
scalar phiMax = static_cast<scalar>(M_PI);
float phiMax = static_cast<float>(M_PI);
// Multiplicator for the number of phi-bins. The minimum number of phi-bins
// depends on min_pt, magnetic field: 2*M_PI/(minPT particle
// phi-deflection). phiBinDeflectionCoverage is a multiplier for this
Expand All @@ -190,15 +190,15 @@ struct spacepoint_grid_config {
struct seedfilter_config {
// the allowed delta between two inverted seed radii for them to be
// considered compatible.
scalar deltaInvHelixDiameter = 0.00003f / unit<scalar>::mm;
float deltaInvHelixDiameter = 0.00003f / unit<float>::mm;
// the impact parameters (d0) is multiplied by this factor and subtracted
// from weight
scalar impactWeightFactor = 1.f;
float impactWeightFactor = 1.f;
// seed weight increased by this value if a compatible seed has been found.
scalar compatSeedWeight = 200.f;
float compatSeedWeight = 200.f;
// minimum distance between compatible seeds to be considered for weight
// boost
scalar deltaRMin = 5.f * unit<scalar>::mm;
float deltaRMin = 5.f * unit<float>::mm;
// in dense environments many seeds may be found per middle space point.
// only seeds with the highest weight will be kept if this limit is reached.
unsigned int maxSeedsPerSpM = 20;
Expand All @@ -210,17 +210,17 @@ struct seedfilter_config {
size_t max_triplets_per_spM = 5;

// seed weight increase
scalar good_spB_min_radius = 150.f * unit<scalar>::mm;
scalar good_spB_weight_increase = 400.f;
scalar good_spT_max_radius = 150.f * unit<scalar>::mm;
scalar good_spT_weight_increase = 200.f;
float good_spB_min_radius = 150.f * unit<float>::mm;
float good_spB_weight_increase = 400.f;
float good_spT_max_radius = 150.f * unit<float>::mm;
float good_spT_weight_increase = 200.f;

// bottom sp cut
scalar good_spB_min_weight = 380.f;
float good_spB_min_weight = 380.f;

// seed cut
scalar seed_min_weight = 200.f;
scalar spB_min_radius = 43.f * unit<scalar>::mm;
float seed_min_weight = 200.f;
float spB_min_radius = 43.f * unit<float>::mm;
};

} // namespace traccc
4 changes: 2 additions & 2 deletions device/cuda/include/traccc/cuda/finding/finding_algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class finding_algorithm

public:
/// Configuration type
using config_type = finding_config<scalar_type>;
using config_type = finding_config;

/// Constructor for the finding algorithm
///
Expand All @@ -85,7 +85,7 @@ class finding_algorithm
vecmem::copy& copy, stream& str);

/// Get config object (const access)
const finding_config<scalar_type>& get_config() const { return m_cfg; }
const finding_config& get_config() const { return m_cfg; }

/// Run the algorithm
///
Expand Down
7 changes: 2 additions & 5 deletions examples/options/include/traccc/options/track_finding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,14 @@
namespace traccc::opts {

/// Configuration for track finding
class track_finding : public interface,
public config_provider<finding_config<float>>,
public config_provider<finding_config<double>> {
class track_finding : public interface, public config_provider<finding_config> {

public:
/// Constructor
track_finding();

/// Configuration conversion operators
operator finding_config<float>() const override;
operator finding_config<double>() const override;
operator finding_config() const override;

private:
/// @name Options
Expand Down
18 changes: 2 additions & 16 deletions examples/options/src/track_finding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,8 @@ track_finding::track_finding() : interface("Track Finding Options") {
"Maximum allowed number of skipped steps per candidate");
}

track_finding::operator finding_config<float>() const {
finding_config<float> out;
out.max_num_branches_per_seed = max_num_branches_per_seed;
out.max_num_branches_per_surface = max_num_branches_per_surface;
out.min_track_candidates_per_track = track_candidates_range[0];
out.max_track_candidates_per_track = track_candidates_range[1];
out.min_step_length_for_next_surface = min_step_length_for_next_surface;
out.max_step_counts_for_next_surface = max_step_counts_for_next_surface;
out.chi2_max = chi2_max;
out.max_num_branches_per_seed = nmax_per_seed;
out.max_num_skipping_per_cand = max_num_skipping_per_cand;
return out;
}

track_finding::operator finding_config<double>() const {
finding_config<double> out;
track_finding::operator finding_config() const {
finding_config out;
out.max_num_branches_per_seed = max_num_branches_per_seed;
out.max_num_branches_per_surface = max_num_branches_per_surface;
out.min_track_candidates_per_track = track_candidates_range[0];
Expand Down
18 changes: 10 additions & 8 deletions simulation/include/traccc/simulation/measurement_smearer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,26 @@ struct measurement_smearer {
if constexpr (std::is_same_v<
typename mask_t::local_frame_type,
detray::line2D<traccc::default_algebra>>) {
iomeas.local0 =
iomeas.local0 = static_cast<float>(
std::max(std::abs(matrix_operator().element(meas, 0u, 0u)) +
offset[0],
static_cast<scalar_type>(0.f));
scalar_type(0.f)));
} else if constexpr (std::is_same_v<typename mask_t::shape,
detray::annulus2D>) {
iomeas.local1 =
matrix_operator().element(meas, 0u, 0u) + offset[0];
iomeas.local1 = static_cast<float>(
matrix_operator().element(meas, 0u, 0u) + offset[0]);
} else {
iomeas.local0 =
matrix_operator().element(meas, 0u, 0u) + offset[0];
iomeas.local0 = static_cast<float>(
matrix_operator().element(meas, 0u, 0u) + offset[0]);
}
} else if (meas_dim == 2u) {
const auto proj = subs.projector<2u>();
matrix_type<2u, 1u> meas = proj * bound_params.vector();

iomeas.local0 = matrix_operator().element(meas, 0u, 0u) + offset[0];
iomeas.local1 = matrix_operator().element(meas, 1u, 0u) + offset[1];
iomeas.local0 = static_cast<float>(
matrix_operator().element(meas, 0u, 0u) + offset[0]);
iomeas.local1 = static_cast<float>(
matrix_operator().element(meas, 1u, 0u) + offset[1]);
}

return;
Expand Down
Loading
Loading