Skip to content

Commit 77fd950

Browse files
author
Vakho Tsulaia
committed
TMP commit
Extra checks and printouts
1 parent d704197 commit 77fd950

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

tests/unit_tests/device/cuda/detector_cuda.cpp

+13-2
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,16 @@ TEST(detector_cuda, detector_alignment) {
143143
transform_t{shifted, tf.x(), tf.y(), tf.z()});
144144
}
145145

146+
std::cout << "Comparing translations STEP1" << std::endl;
147+
typename decltype(det_host)::transform_container::context_type ctx{};
148+
for (unsigned int i = 0u; i < 20; i++) {
149+
auto trstatic = det_host.transform_store().at(i,ctx).translation();
150+
auto traligned = tf_store_aligned_host.at(i,ctx).translation();
151+
auto trdiff = traligned - trstatic;
152+
EXPECT_POINT3_NEAR(trdiff, shift, 1e-6);
153+
}
154+
155+
146156
// copy the vector of aligned transforms to the device
147157
// again, use synchronous copy and fixed size buffers
148158
auto tf_buff_aligned =
@@ -173,10 +183,11 @@ TEST(detector_cuda, detector_alignment) {
173183
surfacexf_data_static, surfacexf_data_aligned);
174184

175185
// check that the relevant transforms have been properly shifted
176-
for (unsigned int i = 0u; i < surfacexf_device_static.size(); i++) {
186+
std::cout << "Comparing translations STEP3" << std::endl;
187+
for (unsigned int i = 0u; i < 20; i++) {
177188
auto translation_static = surfacexf_device_static[i].translation();
178189
auto translation_aligned = surfacexf_device_aligned[i].translation();
179190
auto translation_diff = translation_aligned - translation_static;
180-
EXPECT_POINT3_NEAR(translation_diff, shift, 1e-5);
191+
EXPECT_POINT3_NEAR(translation_diff, shift, 1e-6);
181192
}
182193
}

tests/unit_tests/device/cuda/detector_cuda_kernel.cu

+20
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,26 @@ __global__ void detector_alignment_test_kernel(
128128
vecmem::device_vector<transform_t> surfacexf_device_aligned(
129129
surfacexf_data_aligned);
130130

131+
printf("Comparing translations STEP2\n");
132+
for (unsigned int i = 0u; i < 20; i++) {
133+
const auto sf = tracking_surface{det_device_static,
134+
det_device_static.surfaces()[i]};
135+
auto trstat = sf.transform(ctx).translation();
136+
const auto af = tracking_surface{det_device_aligned,
137+
det_device_aligned.surfaces()[i]};
138+
auto tralig = af.transform(ctx).translation();
139+
if(fabs(tralig[0]-trstat[0]-.1f)>1e-6
140+
|| fabs(tralig[1]-trstat[1]-.2f)>1e-6
141+
|| fabs(tralig[2]-trstat[2]-.3f)>1e-6) {
142+
printf("[%f,%f,%f] - [%f,%f,%f] = [%f,%f,%f]\n",
143+
tralig[0],tralig[1],tralig[2],
144+
trstat[0],trstat[1],trstat[2],
145+
fabs(tralig[0]-trstat[0]),
146+
fabs(tralig[1]-trstat[1]),
147+
fabs(tralig[2]-trstat[2]));
148+
}
149+
150+
}
131151
// copy surface transforms into relevant vectors
132152
for (unsigned int i = 0u; i < det_device_static.surfaces().size(); i++) {
133153
const auto sf = tracking_surface{det_device_static,

0 commit comments

Comments
 (0)