Skip to content

Commit 41bd4f8

Browse files
beomki-yeokrasznaa
authored andcommitted
Add a workflow for double precision build
1 parent 1f79b05 commit 41bd4f8

18 files changed

+118
-126
lines changed

.github/workflows/builds.yml

+7
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ jobs:
5858
- Release
5959
- Debug
6060
include:
61+
- platform:
62+
name: CUDA
63+
container: ghcr.io/acts-project/ubuntu2404_cuda:56
64+
cxx_standard: "20"
65+
options: -DTRACCC_CUSTOM_SCALARTYPE=double -DDETRAY_CUSTOM_SCALARTYPE=double -DTRACCC_BUILD_CUDA=TRUE -DCMAKE_CUDA_FLAGS="-std=c++20"
66+
run_tests: false
67+
build: Release
6168
- platform:
6269
name: "SYCL"
6370
container: ghcr.io/acts-project/ubuntu2404_cuda_oneapi:56

benchmarks/common/benchmarks/toy_detector_benchmark.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ToyDetectorBenchmark : public benchmark::Fixture {
5252
traccc::seedfinder_config seeding_cfg;
5353
traccc::seedfilter_config filter_cfg;
5454
traccc::spacepoint_grid_config grid_cfg{seeding_cfg};
55-
traccc::finding_config<float> finding_cfg;
55+
traccc::finding_config finding_cfg;
5656
traccc::fitting_config fitting_cfg;
5757

5858
static constexpr std::array<float, 2> phi_range{

core/include/traccc/finding/finding_algorithm.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class finding_algorithm
7272

7373
public:
7474
/// Configuration type
75-
using config_type = finding_config<scalar_type>;
75+
using config_type = finding_config;
7676

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

8383
/// Get config object (const access)
84-
const finding_config<scalar_type>& get_config() const { return m_cfg; }
84+
const finding_config& get_config() const { return m_cfg; }
8585

8686
/// Run the algorithm
8787
///

core/include/traccc/finding/finding_config.hpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
namespace traccc {
1515

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

4038
/// Maximum Chi-square that is allowed for branching
41-
scalar_t chi2_max = 30.f;
39+
float chi2_max = 30.f;
4240

4341
/// Propagation configuration
4442
detray::propagation::config propagation{};

core/include/traccc/seeding/detail/seeding_config.hpp

+50-50
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,34 @@ struct seedfinder_config {
2323
// without any spacepoints
2424
// m_config.zMin = -2800.;
2525
// m_config.zMax = 2800.;
26-
scalar zMin = -1186 * unit<scalar>::mm;
27-
scalar zMax = 1186 * unit<scalar>::mm;
28-
scalar rMax = 200 * unit<scalar>::mm;
26+
float zMin = -1186.f * unit<float>::mm;
27+
float zMax = 1186.f * unit<float>::mm;
28+
float rMax = 200.f * unit<float>::mm;
2929
// WARNING: if rMin is smaller than impactMax, the bin size will be 2*pi,
3030
// which will make seeding very slow!
31-
scalar rMin = 33 * unit<scalar>::mm;
31+
float rMin = 33.f * unit<float>::mm;
3232

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

4141
// Seed Cuts
4242
// lower cutoff for seeds in MeV
43-
scalar minPt = 500.f * unit<scalar>::MeV;
43+
float minPt = 500.f * unit<float>::MeV;
4444
// cot of maximum theta angle
4545
// equivalent to 2.7 eta (pseudorapidity)
46-
scalar cotThetaMax = 7.40627f;
46+
float cotThetaMax = 7.40627f;
4747
// minimum distance in mm in r between two measurements within one seed
48-
scalar deltaRMin = 1 * unit<scalar>::mm;
48+
float deltaRMin = 1 * unit<float>::mm;
4949
// maximum distance in mm in r between two measurements within one seed
50-
scalar deltaRMax = 60 * unit<scalar>::mm;
50+
float deltaRMax = 60 * unit<float>::mm;
5151

5252
// FIXME: this is not used yet
53-
// scalar upperPtResolutionPerSeed = 20* Acts::GeV;
53+
// float upperPtResolutionPerSeed = 20* Acts::GeV;
5454

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

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

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

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

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

9393
// derived values, set on Seedfinder construction
94-
scalar highland = 0;
95-
scalar maxScatteringAngle2 = 0;
96-
scalar pTPerHelixRadius = 0;
97-
scalar minHelixDiameter2 = 0;
98-
scalar pT2perRadius = 0;
94+
float highland = 0;
95+
float maxScatteringAngle2 = 0;
96+
float pTPerHelixRadius = 0;
97+
float minHelixDiameter2 = 0;
98+
float pT2perRadius = 0;
9999

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

128-
scalar maxScatteringAngle = highland / minPt;
128+
float maxScatteringAngle = highland / minPt;
129129
maxScatteringAngle2 = maxScatteringAngle * maxScatteringAngle;
130130

131131
pTPerHelixRadius = bFieldInZ;
@@ -155,29 +155,29 @@ struct spacepoint_grid_config {
155155
phiBinDeflectionCoverage(finder_config.phiBinDeflectionCoverage) {}
156156

157157
// magnetic field in kTesla
158-
scalar bFieldInZ;
158+
float bFieldInZ;
159159
// minimum pT to be found by seedfinder in MeV
160-
scalar minPt;
160+
float minPt;
161161
// maximum extension of sensitive detector layer relevant for seeding as
162162
// distance from x=y=0 (i.e. in r) in mm
163-
scalar rMax;
163+
float rMax;
164164
// maximum extension of sensitive detector layer relevant for seeding in
165165
// positive direction in z in mm
166-
scalar zMax;
166+
float zMax;
167167
// maximum extension of sensitive detector layer relevant for seeding in
168168
// negative direction in z in mm
169-
scalar zMin;
169+
float zMin;
170170
// maximum distance in r from middle space point to bottom or top spacepoint
171171
// in mm
172-
scalar deltaRMax;
172+
float deltaRMax;
173173
// maximum forward direction expressed as cot(theta)
174-
scalar cotThetaMax;
174+
float cotThetaMax;
175175
// impact parameter in mm
176-
scalar impactMax;
176+
float impactMax;
177177
// minimum phi value for phiAxis construction
178-
scalar phiMin = static_cast<scalar>(-M_PI);
178+
float phiMin = static_cast<float>(-M_PI);
179179
// maximum phi value for phiAxis construction
180-
scalar phiMax = static_cast<scalar>(M_PI);
180+
float phiMax = static_cast<float>(M_PI);
181181
// Multiplicator for the number of phi-bins. The minimum number of phi-bins
182182
// depends on min_pt, magnetic field: 2*M_PI/(minPT particle
183183
// phi-deflection). phiBinDeflectionCoverage is a multiplier for this
@@ -190,15 +190,15 @@ struct spacepoint_grid_config {
190190
struct seedfilter_config {
191191
// the allowed delta between two inverted seed radii for them to be
192192
// considered compatible.
193-
scalar deltaInvHelixDiameter = 0.00003f / unit<scalar>::mm;
193+
float deltaInvHelixDiameter = 0.00003f / unit<float>::mm;
194194
// the impact parameters (d0) is multiplied by this factor and subtracted
195195
// from weight
196-
scalar impactWeightFactor = 1.f;
196+
float impactWeightFactor = 1.f;
197197
// seed weight increased by this value if a compatible seed has been found.
198-
scalar compatSeedWeight = 200.f;
198+
float compatSeedWeight = 200.f;
199199
// minimum distance between compatible seeds to be considered for weight
200200
// boost
201-
scalar deltaRMin = 5.f * unit<scalar>::mm;
201+
float deltaRMin = 5.f * unit<float>::mm;
202202
// in dense environments many seeds may be found per middle space point.
203203
// only seeds with the highest weight will be kept if this limit is reached.
204204
unsigned int maxSeedsPerSpM = 20;
@@ -210,17 +210,17 @@ struct seedfilter_config {
210210
size_t max_triplets_per_spM = 5;
211211

212212
// seed weight increase
213-
scalar good_spB_min_radius = 150.f * unit<scalar>::mm;
214-
scalar good_spB_weight_increase = 400.f;
215-
scalar good_spT_max_radius = 150.f * unit<scalar>::mm;
216-
scalar good_spT_weight_increase = 200.f;
213+
float good_spB_min_radius = 150.f * unit<float>::mm;
214+
float good_spB_weight_increase = 400.f;
215+
float good_spT_max_radius = 150.f * unit<float>::mm;
216+
float good_spT_weight_increase = 200.f;
217217

218218
// bottom sp cut
219-
scalar good_spB_min_weight = 380.f;
219+
float good_spB_min_weight = 380.f;
220220

221221
// seed cut
222-
scalar seed_min_weight = 200.f;
223-
scalar spB_min_radius = 43.f * unit<scalar>::mm;
222+
float seed_min_weight = 200.f;
223+
float spB_min_radius = 43.f * unit<float>::mm;
224224
};
225225

226226
} // namespace traccc

device/cuda/include/traccc/cuda/finding/finding_algorithm.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class finding_algorithm
7373

7474
public:
7575
/// Configuration type
76-
using config_type = finding_config<scalar_type>;
76+
using config_type = finding_config;
7777

7878
/// Constructor for the finding algorithm
7979
///
@@ -85,7 +85,7 @@ class finding_algorithm
8585
vecmem::copy& copy, stream& str);
8686

8787
/// Get config object (const access)
88-
const finding_config<scalar_type>& get_config() const { return m_cfg; }
88+
const finding_config& get_config() const { return m_cfg; }
8989

9090
/// Run the algorithm
9191
///

examples/options/include/traccc/options/track_finding.hpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,14 @@
2222
namespace traccc::opts {
2323

2424
/// Configuration for track finding
25-
class track_finding : public interface,
26-
public config_provider<finding_config<float>>,
27-
public config_provider<finding_config<double>> {
25+
class track_finding : public interface, public config_provider<finding_config> {
2826

2927
public:
3028
/// Constructor
3129
track_finding();
3230

3331
/// Configuration conversion operators
34-
operator finding_config<float>() const override;
35-
operator finding_config<double>() const override;
32+
operator finding_config() const override;
3633

3734
private:
3835
/// @name Options

examples/options/src/track_finding.cpp

+2-16
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,8 @@ track_finding::track_finding() : interface("Track Finding Options") {
5858
"Maximum allowed number of skipped steps per candidate");
5959
}
6060

61-
track_finding::operator finding_config<float>() const {
62-
finding_config<float> out;
63-
out.max_num_branches_per_seed = max_num_branches_per_seed;
64-
out.max_num_branches_per_surface = max_num_branches_per_surface;
65-
out.min_track_candidates_per_track = track_candidates_range[0];
66-
out.max_track_candidates_per_track = track_candidates_range[1];
67-
out.min_step_length_for_next_surface = min_step_length_for_next_surface;
68-
out.max_step_counts_for_next_surface = max_step_counts_for_next_surface;
69-
out.chi2_max = chi2_max;
70-
out.max_num_branches_per_seed = nmax_per_seed;
71-
out.max_num_skipping_per_cand = max_num_skipping_per_cand;
72-
return out;
73-
}
74-
75-
track_finding::operator finding_config<double>() const {
76-
finding_config<double> out;
61+
track_finding::operator finding_config() const {
62+
finding_config out;
7763
out.max_num_branches_per_seed = max_num_branches_per_seed;
7864
out.max_num_branches_per_surface = max_num_branches_per_surface;
7965
out.min_track_candidates_per_track = track_candidates_range[0];

simulation/include/traccc/simulation/measurement_smearer.hpp

+10-8
Original file line numberDiff line numberDiff line change
@@ -96,24 +96,26 @@ struct measurement_smearer {
9696
if constexpr (std::is_same_v<
9797
typename mask_t::local_frame_type,
9898
detray::line2D<traccc::default_algebra>>) {
99-
iomeas.local0 =
99+
iomeas.local0 = static_cast<float>(
100100
std::max(std::abs(matrix_operator().element(meas, 0u, 0u)) +
101101
offset[0],
102-
static_cast<scalar_type>(0.f));
102+
scalar_type(0.f)));
103103
} else if constexpr (std::is_same_v<typename mask_t::shape,
104104
detray::annulus2D>) {
105-
iomeas.local1 =
106-
matrix_operator().element(meas, 0u, 0u) + offset[0];
105+
iomeas.local1 = static_cast<float>(
106+
matrix_operator().element(meas, 0u, 0u) + offset[0]);
107107
} else {
108-
iomeas.local0 =
109-
matrix_operator().element(meas, 0u, 0u) + offset[0];
108+
iomeas.local0 = static_cast<float>(
109+
matrix_operator().element(meas, 0u, 0u) + offset[0]);
110110
}
111111
} else if (meas_dim == 2u) {
112112
const auto proj = subs.projector<2u>();
113113
matrix_type<2u, 1u> meas = proj * bound_params.vector();
114114

115-
iomeas.local0 = matrix_operator().element(meas, 0u, 0u) + offset[0];
116-
iomeas.local1 = matrix_operator().element(meas, 1u, 0u) + offset[1];
115+
iomeas.local0 = static_cast<float>(
116+
matrix_operator().element(meas, 0u, 0u) + offset[0]);
117+
iomeas.local1 = static_cast<float>(
118+
matrix_operator().element(meas, 1u, 0u) + offset[1]);
117119
}
118120

119121
return;

0 commit comments

Comments
 (0)