Skip to content

Commit 87421d8

Browse files
committed
Add a CI build for double precision
1 parent 8740109 commit 87421d8

10 files changed

+56
-45
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

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;

simulation/include/traccc/simulation/smearing_writer.hpp

+20-20
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ struct smearing_writer : detray::actor {
7474
const auto mom = track.mom();
7575

7676
particle.particle_id = particle_id;
77-
particle.vx = pos[0];
78-
particle.vy = pos[1];
79-
particle.vz = pos[2];
80-
particle.vt = track.time();
81-
particle.px = mom[0];
82-
particle.py = mom[1];
83-
particle.pz = mom[2];
84-
particle.q = track.charge();
77+
particle.vx = static_cast<float>(pos[0]);
78+
particle.vy = static_cast<float>(pos[1]);
79+
particle.vz = static_cast<float>(pos[2]);
80+
particle.vt = static_cast<float>(track.time());
81+
particle.px = static_cast<float>(mom[0]);
82+
particle.py = static_cast<float>(mom[1]);
83+
particle.pz = static_cast<float>(mom[2]);
84+
particle.q = static_cast<float>(track.charge());
8585

8686
m_particle_writer.append(particle);
8787
}
@@ -122,13 +122,13 @@ struct smearing_writer : detray::actor {
122122

123123
hit.particle_id = writer_state.particle_id;
124124
hit.geometry_id = sf.barcode().value();
125-
hit.tx = pos[0];
126-
hit.ty = pos[1];
127-
hit.tz = pos[2];
128-
hit.tt = track.time();
129-
hit.tpx = mom[0];
130-
hit.tpy = mom[1];
131-
hit.tpz = mom[2];
125+
hit.tx = static_cast<float>(pos[0]);
126+
hit.ty = static_cast<float>(pos[1]);
127+
hit.tz = static_cast<float>(pos[2]);
128+
hit.tt = static_cast<float>(track.time());
129+
hit.tpx = static_cast<float>(mom[0]);
130+
hit.tpy = static_cast<float>(mom[1]);
131+
hit.tpz = static_cast<float>(mom[2]);
132132

133133
writer_state.m_hit_writer.append(hit);
134134

@@ -140,11 +140,11 @@ struct smearing_writer : detray::actor {
140140
meas.geometry_id = hit.geometry_id;
141141
auto stddev_0 = writer_state.m_meas_smearer.stddev[0];
142142
auto stddev_1 = writer_state.m_meas_smearer.stddev[1];
143-
meas.var_local0 = stddev_0 * stddev_0;
144-
meas.var_local1 = stddev_1 * stddev_1;
145-
meas.phi = bound_params.phi();
146-
meas.theta = bound_params.theta();
147-
meas.time = bound_params.time();
143+
meas.var_local0 = static_cast<float>(stddev_0 * stddev_0);
144+
meas.var_local1 = static_cast<float>(stddev_1 * stddev_1);
145+
meas.phi = static_cast<float>(bound_params.phi());
146+
meas.theta = static_cast<float>(bound_params.theta());
147+
meas.time = static_cast<float>(bound_params.time());
148148

149149
// Set local_key and smeared_local
150150
sf.template visit_mask<measurement_kernel>(

tests/common/tests/kalman_fitting_test.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ void KalmanFittingTests::ndf_tests(
9999

100100
// Check if the number of degree of freedoms is equal to (the sum of
101101
// measurement dimensions - 5)
102-
ASSERT_FLOAT_EQ(fit_res.ndf, dim_sum - 5.f);
102+
ASSERT_FLOAT_EQ(static_cast<float>(fit_res.ndf),
103+
static_cast<float>(dim_sum) - 5.f);
103104

104105
// The number of track states is supposed to be eqaul to the number
105106
// of measurements unless KF failes in the middle of propagation

tests/cpu/test_ckf_sparse_tracks_telescope.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ TEST_P(CkfSparseTrackTelescopeTests, Run) {
191191
* Success rate test
192192
********************/
193193

194-
scalar success_rate =
195-
static_cast<scalar>(n_success) / (n_truth_tracks * n_events);
194+
float success_rate =
195+
static_cast<float>(n_success) / (n_truth_tracks * n_events);
196196

197197
ASSERT_FLOAT_EQ(success_rate, 1.00f);
198198
}

tests/cpu/test_kalman_fitter_telescope.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ TEST_P(KalmanFittingTelescopeTests, Run) {
165165
* Success rate test
166166
********************/
167167

168-
scalar success_rate =
169-
static_cast<scalar>(n_success) / (n_truth_tracks * n_events);
168+
float success_rate =
169+
static_cast<float>(n_success) / (n_truth_tracks * n_events);
170170

171171
ASSERT_FLOAT_EQ(success_rate, 1.00f);
172172
}

tests/cpu/test_kalman_fitter_wire_chamber.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ TEST_P(KalmanFittingWireChamberTests, Run) {
104104
// Set constrained step size to 1 mm
105105
sim.get_config().propagation.stepping.step_constraint = step_constraint;
106106
sim.get_config().propagation.navigation.min_mask_tolerance =
107-
25.f * detray::unit<scalar>::um;
107+
25.f * detray::unit<float>::um;
108108
sim.get_config().propagation.navigation.search_window = search_window;
109109

110110
sim.run();
@@ -118,7 +118,8 @@ TEST_P(KalmanFittingWireChamberTests, Run) {
118118

119119
// Fitting algorithm object
120120
typename traccc::fitting_algorithm<host_fitter_type>::config_type fit_cfg;
121-
fit_cfg.propagation.navigation.min_mask_tolerance = mask_tolerance;
121+
fit_cfg.propagation.navigation.min_mask_tolerance =
122+
static_cast<float>(mask_tolerance);
122123
fit_cfg.propagation.navigation.search_window = search_window;
123124
fitting_algorithm<host_fitter_type> fitting(fit_cfg);
124125

tests/cpu/test_simulation.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ GTEST_TEST(traccc_simulation, toy_detector_simulation) {
116116

117117
// Lift step size constraints
118118
sim.get_config().propagation.stepping.step_constraint =
119-
std::numeric_limits<scalar>::max();
119+
std::numeric_limits<float>::max();
120120
sim.get_config().propagation.navigation.search_window = {3u, 3u};
121121

122122
// Do the simulation
@@ -269,7 +269,7 @@ TEST_P(TelescopeDetectorSimulation, telescope_detector_simulation) {
269269

270270
// Lift step size constraints
271271
sim.get_config().propagation.stepping.step_constraint =
272-
std::numeric_limits<scalar>::max();
272+
std::numeric_limits<float>::max();
273273

274274
// Run simulation
275275
sim.run();

tests/cpu/test_spacepoint_formation.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ TEST(spacepoint_formation, cpu) {
6565

6666
// Check the results
6767
EXPECT_EQ(spacepoints.size(), 2u);
68-
EXPECT_FLOAT_EQ(spacepoints[0].global[0], 20.f);
69-
EXPECT_FLOAT_EQ(spacepoints[0].global[1], 7.f);
70-
EXPECT_FLOAT_EQ(spacepoints[0].global[2], 2.f);
71-
EXPECT_FLOAT_EQ(spacepoints[1].global[0], 180.f);
72-
EXPECT_FLOAT_EQ(spacepoints[1].global[1], 10.f);
73-
EXPECT_FLOAT_EQ(spacepoints[1].global[2], 15.f);
68+
EXPECT_FLOAT_EQ(static_cast<float>(spacepoints[0].global[0]), 20.f);
69+
EXPECT_FLOAT_EQ(static_cast<float>(spacepoints[0].global[1]), 7.f);
70+
EXPECT_FLOAT_EQ(static_cast<float>(spacepoints[0].global[2]), 2.f);
71+
EXPECT_FLOAT_EQ(static_cast<float>(spacepoints[1].global[0]), 180.f);
72+
EXPECT_FLOAT_EQ(static_cast<float>(spacepoints[1].global[1]), 10.f);
73+
EXPECT_FLOAT_EQ(static_cast<float>(spacepoints[1].global[2]), 15.f);
7474
}

tests/cuda/test_kalman_fitter_telescope.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ TEST_P(KalmanFittingTelescopeTests, Run) {
210210
* Success rate test
211211
********************/
212212

213-
scalar success_rate =
214-
static_cast<scalar>(n_success) / (n_truth_tracks * n_events);
213+
float success_rate =
214+
static_cast<float>(n_success) / (n_truth_tracks * n_events);
215215

216216
ASSERT_FLOAT_EQ(success_rate, 1.00f);
217217
}

0 commit comments

Comments
 (0)