Skip to content

Commit da9ed40

Browse files
authored
VecMem Update, main branch (2026.04.10.) (#1291)
* Updated the project to vecmem 1.24.0. * Switched to creating detector design buffers more easily. Using the code that's now available from vecmem directly.
1 parent 28587fd commit da9ed40

10 files changed

Lines changed: 14 additions & 170 deletions

File tree

examples/run/alpaka/full_chain_algorithm.cpp

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,7 @@ full_chain_algorithm::full_chain_algorithm(
4040
m_field(make_magnetic_field(field, m_queue)),
4141
m_det_descr(det_descr),
4242
m_device_det_descr(
43-
[&]() {
44-
// number of elements in the detector design description
45-
std::vector<unsigned int> sizes(det_descr.size());
46-
for (std::size_t i = 0; i < det_descr.size(); ++i) {
47-
auto this_design = det_descr.at(i);
48-
// now for each element, set the size to the largest size of
49-
// that element across all modules
50-
sizes[i] = std::max(static_cast<unsigned int>(
51-
((this_design.bin_edges_x()).size())),
52-
static_cast<unsigned int>((
53-
(this_design.bin_edges_y()).size())));
54-
}
55-
return sizes;
56-
}(),
43+
vecmem::edm::get_capacities(vecmem::get_data(m_det_descr.get())),
5744
m_cached_device_mr, &m_cached_pinned_host_mr,
5845
vecmem::data::buffer_type::resizable),
5946
m_det_cond(det_cond),
@@ -118,21 +105,7 @@ full_chain_algorithm::full_chain_algorithm(const full_chain_algorithm& parent)
118105
m_field(parent.m_field),
119106
m_det_descr(parent.m_det_descr),
120107
m_device_det_descr(
121-
[&]() {
122-
// number of elements in the detector design description
123-
std::vector<unsigned int> sizes(parent.m_det_descr.get().size());
124-
for (std::size_t i = 0; i < parent.m_det_descr.get().size();
125-
++i) {
126-
auto this_design = parent.m_det_descr.get().at(i);
127-
// now for each element, set the size to the largest size of
128-
// that element across all modules
129-
sizes[i] = std::max(static_cast<unsigned int>(
130-
((this_design.bin_edges_x()).size())),
131-
static_cast<unsigned int>((
132-
(this_design.bin_edges_y()).size())));
133-
}
134-
return sizes;
135-
}(),
108+
vecmem::edm::get_capacities(vecmem::get_data(m_det_descr.get())),
136109
m_cached_device_mr, &m_cached_pinned_host_mr,
137110
vecmem::data::buffer_type::resizable),
138111
m_det_cond(parent.m_det_cond),

examples/run/alpaka/seq_example_alpaka.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,7 @@ int seq_run(const traccc::opts::detector& detector_opts,
9191
traccc::detector_conditions_description::data host_det_cond_data{
9292
vecmem::get_data(host_det_cond)};
9393
traccc::detector_design_description::buffer device_det_descr{
94-
[&]() {
95-
std::vector<unsigned int> sizes(host_det_descr.size());
96-
for (std::size_t i = 0; i < host_det_descr.size(); ++i) {
97-
auto this_design = host_det_descr.at(i);
98-
99-
sizes[i] = std::max(static_cast<unsigned int>(
100-
((this_design.bin_edges_x()).size())),
101-
static_cast<unsigned int>(
102-
((this_design.bin_edges_y()).size())));
103-
}
104-
return sizes;
105-
}(),
94+
vecmem::edm::get_capacities(vecmem::get_data(host_det_descr)),
10695
device_mr, &host_mr, vecmem::data::buffer_type::resizable};
10796
copy.setup(device_det_descr)->wait();
10897
copy(vecmem::get_data(host_det_descr), device_det_descr)->wait();

examples/run/cuda/full_chain_algorithm.cpp

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,7 @@ full_chain_algorithm::full_chain_algorithm(
5757
m_det_descr(det_descr),
5858
m_det_cond(det_cond),
5959
m_device_det_descr(
60-
[&]() {
61-
// number of elements in the detector design description
62-
std::vector<unsigned int> sizes(det_descr.size());
63-
for (std::size_t i = 0; i < det_descr.size(); ++i) {
64-
auto this_design = det_descr.at(i);
65-
// now for each element, set the size to the largest size of
66-
// that element across all modules
67-
sizes[i] = std::max(static_cast<unsigned int>(
68-
((this_design.bin_edges_x()).size())),
69-
static_cast<unsigned int>((
70-
(this_design.bin_edges_y()).size())));
71-
}
72-
return sizes;
73-
}(),
60+
vecmem::edm::get_capacities(vecmem::get_data(m_det_descr.get())),
7461
m_device_mr, &m_host_mr, vecmem::data::buffer_type::resizable),
7562
m_device_det_cond(
7663
static_cast<detector_conditions_description::buffer::size_type>(
@@ -137,21 +124,7 @@ full_chain_algorithm::full_chain_algorithm(const full_chain_algorithm& parent)
137124
m_det_descr(parent.m_det_descr),
138125
m_det_cond(parent.m_det_cond),
139126
m_device_det_descr(
140-
[&]() {
141-
// number of elements in the detector design description
142-
std::vector<unsigned int> sizes(parent.m_det_descr.get().size());
143-
for (std::size_t i = 0; i < parent.m_det_descr.get().size();
144-
++i) {
145-
auto this_design = parent.m_det_descr.get().at(i);
146-
// now for each element, set the size to the largest size of
147-
// that element across all modules
148-
sizes[i] = std::max(static_cast<unsigned int>(
149-
((this_design.bin_edges_x()).size())),
150-
static_cast<unsigned int>((
151-
(this_design.bin_edges_y()).size())));
152-
}
153-
return sizes;
154-
}(),
127+
vecmem::edm::get_capacities(vecmem::get_data(m_det_descr.get())),
155128
m_device_mr, &m_host_mr, vecmem::data::buffer_type::resizable),
156129
m_device_det_cond(
157130
static_cast<detector_conditions_description::buffer::size_type>(

examples/run/cuda/seq_example_cuda.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,7 @@ int seq_run(const traccc::opts::detector& detector_opts,
102102
traccc::detector_conditions_description::data host_det_cond_data{
103103
vecmem::get_data(host_det_cond)};
104104
traccc::detector_design_description::buffer device_det_descr{
105-
[&]() {
106-
// number of elements in the detector design description
107-
std::vector<unsigned int> sizes(host_det_descr.size());
108-
for (std::size_t i = 0; i < host_det_descr.size(); ++i) {
109-
auto this_design = host_det_descr.at(i);
110-
// now for each element, set the size to the largest size of
111-
// that element across all modules
112-
sizes[i] = std::max(static_cast<unsigned int>(
113-
((this_design.bin_edges_x()).size())),
114-
static_cast<unsigned int>(
115-
((this_design.bin_edges_y()).size())));
116-
}
117-
return sizes;
118-
}(),
105+
vecmem::edm::get_capacities(vecmem::get_data(host_det_descr)),
119106
device_mr, &host_mr, vecmem::data::buffer_type::resizable};
120107
copy.setup(device_det_descr)->wait();
121108
copy(host_det_descr_data, device_det_descr)->wait();

examples/run/sycl/full_chain_algorithm.cpp

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,7 @@ full_chain_algorithm::full_chain_algorithm(
4949
m_det_descr(det_descr),
5050
m_det_cond(det_cond),
5151
m_device_det_descr(
52-
[&]() {
53-
// number of elements in the detector design description
54-
std::vector<unsigned int> sizes(det_descr.size());
55-
for (std::size_t i = 0; i < det_descr.size(); ++i) {
56-
auto this_design = det_descr.at(i);
57-
// now for each element, set the size to the largest size of
58-
// that element across all modules
59-
sizes[i] = std::max(static_cast<unsigned int>(
60-
((this_design.bin_edges_x()).size())),
61-
static_cast<unsigned int>((
62-
(this_design.bin_edges_y()).size())));
63-
}
64-
return sizes;
65-
}(),
52+
vecmem::edm::get_capacities(vecmem::get_data(m_det_descr.get())),
6653
m_cached_device_mr, &m_cached_pinned_host_mr,
6754
vecmem::data::buffer_type::resizable),
6855
m_device_det_cond(
@@ -139,21 +126,7 @@ full_chain_algorithm::full_chain_algorithm(const full_chain_algorithm& parent)
139126
m_det_descr(parent.m_det_descr),
140127
m_det_cond(parent.m_det_cond),
141128
m_device_det_descr(
142-
[&]() {
143-
// number of elements in the detector design description
144-
std::vector<unsigned int> sizes(parent.m_det_descr.get().size());
145-
for (std::size_t i = 0; i < parent.m_det_descr.get().size();
146-
++i) {
147-
auto this_design = parent.m_det_descr.get().at(i);
148-
// now for each element, set the size to the largest size of
149-
// that element across all modules
150-
sizes[i] = std::max(static_cast<unsigned int>(
151-
((this_design.bin_edges_x()).size())),
152-
static_cast<unsigned int>((
153-
(this_design.bin_edges_y()).size())));
154-
}
155-
return sizes;
156-
}(),
129+
vecmem::edm::get_capacities(vecmem::get_data(m_det_descr.get())),
157130
m_cached_device_mr, &m_cached_pinned_host_mr,
158131
vecmem::data::buffer_type::resizable),
159132
m_device_det_cond(

examples/run/sycl/seq_example_sycl.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,7 @@ int seq_run(const traccc::opts::detector& detector_opts,
106106
traccc::detector_conditions_description::data host_det_cond_data{
107107
vecmem::get_data(host_det_cond)};
108108
traccc::detector_design_description::buffer device_det_descr{
109-
[&]() {
110-
// number of elements in the detector design description
111-
std::vector<unsigned int> sizes(host_det_descr.size());
112-
for (std::size_t i = 0; i < host_det_descr.size(); ++i) {
113-
auto this_design = host_det_descr.at(i);
114-
// now for each element, set the size to the largest size of
115-
// that element across all modules
116-
sizes[i] = std::max(static_cast<unsigned int>(
117-
((this_design.bin_edges_x()).size())),
118-
static_cast<unsigned int>(
119-
((this_design.bin_edges_y()).size())));
120-
}
121-
return sizes;
122-
}(),
109+
vecmem::edm::get_capacities(vecmem::get_data(host_det_descr)),
123110
device_mr, &host_mr, vecmem::data::buffer_type::resizable};
124111
copy.setup(device_det_descr)->wait();
125112
copy(host_det_descr_data, device_det_descr)->wait();

extern/vecmem/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ message( STATUS "Building VecMem as part of the TRACCC project" )
1313

1414
# Declare where to get VecMem from.
1515
set( TRACCC_VECMEM_SOURCE
16-
"URL;https://github.com/acts-project/vecmem/archive/refs/tags/v1.23.0.tar.gz;URL_MD5;c4b87f88856b5273b89373d880bdc0fd"
16+
"URL;https://github.com/acts-project/vecmem/archive/refs/tags/v1.24.0.tar.gz;URL_MD5;4ca66bf822528e0880581ad107efa911"
1717
CACHE STRING "Source for VecMem, when built as part of this project" )
1818
mark_as_advanced( TRACCC_VECMEM_SOURCE )
1919
FetchContent_Declare( VecMem SYSTEM ${TRACCC_VECMEM_SOURCE} )

tests/alpaka/test_cca.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,7 @@ cca_function_t get_f_with(traccc::clustering_config cfg) {
5555
{device_mr, &pinned_host_mr}, copy, queue, cfg);
5656

5757
traccc::detector_design_description::buffer det_desc_buffer{
58-
[&]() {
59-
std::vector<unsigned int> sizes(det_desc.size());
60-
for (std::size_t i = 0; i < det_desc.size(); ++i) {
61-
auto this_design = det_desc.at(i);
62-
63-
sizes[i] =
64-
std::max(static_cast<unsigned int>(
65-
((this_design.bin_edges_x()).size())),
66-
static_cast<unsigned int>(
67-
((this_design.bin_edges_y()).size())));
68-
}
69-
return sizes;
70-
}(),
58+
vecmem::edm::get_capacities(vecmem::get_data(det_desc)),
7159
device_mr, &host_mr, vecmem::data::buffer_type::resizable};
7260
copy.setup(det_desc_buffer)->wait();
7361
copy(vecmem::get_data(det_desc), det_desc_buffer)->wait();

tests/cuda/test_cca.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,8 @@ cca_function_t get_f_with(traccc::clustering_config cfg) {
4040
stream, cfg);
4141

4242
traccc::detector_design_description::buffer det_descr_buffer{
43-
[&]() {
44-
std::vector<unsigned int> sizes(det_desc.size());
45-
for (std::size_t i = 0; i < det_desc.size(); ++i) {
46-
auto this_design = det_desc.at(i);
47-
// now for each element, set the size to the largest size of
48-
// that element across all modules
49-
sizes[i] =
50-
std::max(static_cast<unsigned int>(
51-
((this_design.bin_edges_x()).size())),
52-
static_cast<unsigned int>(
53-
((this_design.bin_edges_y()).size())));
54-
}
55-
return sizes;
56-
}(),
57-
device_mr, &host_mr, vecmem::data::buffer_type::fixed_size};
43+
vecmem::edm::get_capacities(vecmem::get_data(det_desc)), device_mr,
44+
&host_mr, vecmem::data::buffer_type::fixed_size};
5845
copy.setup(det_descr_buffer)->wait();
5946
copy(vecmem::get_data(det_desc), det_descr_buffer)->wait();
6047
traccc::detector_conditions_description::buffer det_cond_buffer{

tests/sycl/test_cca.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,7 @@ cca_function_t get_f_with(traccc::clustering_config cfg) {
4949
copy, traccc_queue, cfg);
5050

5151
traccc::detector_design_description::buffer det_descr_buffer{
52-
[&]() {
53-
std::vector<unsigned int> sizes(det_desc.size());
54-
for (std::size_t i = 0; i < det_desc.size(); ++i) {
55-
auto this_design = det_desc.at(i);
56-
// now for each element, set the size to the largest
57-
// size of that element across all modules
58-
sizes[i] =
59-
std::max(static_cast<unsigned int>(
60-
((this_design.bin_edges_x()).size())),
61-
static_cast<unsigned int>(
62-
((this_design.bin_edges_y()).size())));
63-
}
64-
return sizes;
65-
}(),
52+
vecmem::edm::get_capacities(vecmem::get_data(det_desc)),
6653
device_mr, &host_mr, vecmem::data::buffer_type::fixed_size};
6754
copy.setup(det_descr_buffer)->wait();
6855
copy(vecmem::get_data(det_desc), det_descr_buffer)->wait();

0 commit comments

Comments
 (0)