32 #include <boost/type_erasure/any_cast.hpp>
40 std::vector<const SpacePoint*> readSP;
43 if (spFile.is_open()) {
46 std::stringstream ss(line);
49 if (linetype ==
"lxyz") {
57 ss >> layer >> x >> y >> z >> varianceR >> varianceZ;
58 r = std::sqrt(x * x + y * y);
59 float f22 = varianceR;
60 float wid = varianceZ;
61 float cov = wid * wid * .08333;
72 new SpacePoint(x, y, z, r, layer, varianceR, varianceZ,
id));
80 template <
typename external_spacepo
int_t>
107 template <
typename external_spacepo
int_t>
113 gridConf.minPt =
config.minPt;
114 gridConf.rMax =
config.rMax;
115 gridConf.zMax =
config.zMax;
116 gridConf.zMin =
config.zMin;
117 gridConf.deltaRMax =
config.deltaRMax;
118 gridConf.cotThetaMax =
config.cotThetaMax;
122 auto main(
int argc,
char** argv) ->
int {
123 auto start_prep = std::chrono::system_clock::now();
126 cmdlTool.
parse(argc, argv);
129 std::cerr <<
"Input file not found\n";
135 auto bottomBinFinder = std::make_shared<Acts::BinFinder<SpacePoint>>(
137 auto topBinFinder = std::make_shared<Acts::BinFinder<SpacePoint>>(
139 auto config = setupSeedfinderConfiguration<SpacePoint>();
143 config.seedFilter = std::make_unique<Acts::SeedFilter<SpacePoint>>(
149 auto covarianceTool = [=](
const SpacePoint& sp,
float ,
154 std::unique_ptr<Acts::SpacePointGrid<SpacePoint>> grid =
155 Acts::SpacePointGridCreator::createGrid<SpacePoint>(
159 spVec.begin(), spVec.end(), covarianceTool, bottomBinFinder, topBinFinder,
162 auto end_prep = std::chrono::system_clock::now();
164 std::chrono::duration<double> elapsec_prep = end_prep - start_prep;
165 double prepTime = elapsec_prep.count();
168 std::cout <<
"read " << spVec.
size() <<
" SP from file "
170 std::cout <<
"Preparation time: " <<
std::to_string(prepTime) << std::endl;
177 auto start_cpu = std::chrono::system_clock::now();
178 uint group_count = 0;
179 std::vector<std::vector<Acts::Seed<SpacePoint>>> seedVector_cpu;
182 for (
auto groupIt = spGroup.begin(); !(groupIt == spGroup.end());
185 groupIt.bottom(), groupIt.middle(), groupIt.top()));
193 auto end_cpu = std::chrono::system_clock::now();
196 std::cout <<
"Analyzed " << group_count <<
" groups for CPU" << std::endl;
203 auto start_sycl = std::chrono::system_clock::now();
206 std::vector<std::vector<Acts::Seed<SpacePoint>>> seedVector_sycl;
208 for (
auto groupIt = spGroup.begin(); !(groupIt == spGroup.end()); ++groupIt) {
210 groupIt.bottom(), groupIt.middle(), groupIt.top()));
216 auto end_sycl = std::chrono::system_clock::now();
219 std::cout <<
"Analyzed " << group_count <<
" groups for SYCL" << std::endl;
222 std::chrono::duration<double> elapsec_cpu = end_cpu - start_cpu;
223 double cpuTime = elapsec_cpu.count();
225 std::chrono::duration<double> elapsec_sycl = end_sycl - start_sycl;
226 double syclTime = elapsec_sycl.count();
236 for (
auto& outVec : seedVector_cpu) {
237 nSeed_cpu += outVec.size();
240 for (
auto& outVec : seedVector_sycl) {
241 nSeed_sycl += outVec.size();
244 for (
size_t i = 0; i < seedVector_cpu.size(); i++) {
245 auto regionVec_cpu = seedVector_cpu[i];
246 auto regionVec_sycl = seedVector_sycl[i];
248 std::vector<std::vector<SpacePoint>> seeds_cpu;
249 std::vector<std::vector<SpacePoint>> seeds_sycl;
251 for (
const auto& sd : regionVec_cpu) {
252 std::vector<SpacePoint> seed_cpu;
253 seed_cpu.push_back(*(sd.sp()[0]));
254 seed_cpu.push_back(*(sd.sp()[1]));
255 seed_cpu.push_back(*(sd.sp()[2]));
256 seeds_cpu.push_back(seed_cpu);
258 for (
const auto& sd : regionVec_sycl) {
259 std::vector<SpacePoint> seed_sycl;
260 seed_sycl.push_back(*(sd.sp()[0]));
261 seed_sycl.push_back(*(sd.sp()[1]));
262 seed_sycl.push_back(*(sd.sp()[2]));
263 seeds_sycl.push_back(seed_sycl);
266 for (
auto seed : seeds_cpu) {
267 for (
auto other : seeds_sycl) {
268 if (seed[0] == other[0] && seed[1] == other[1] &&
269 seed[2] == other[2]) {
279 std::cout << std::endl;
281 <<
"------------------------- Time Metric -------------------------"
283 std::cout << std::setw(textWidth) <<
" Device:";
284 std::cout << std::setw(numWidth) <<
"CPU";
285 std::cout << std::setw(numWidth) <<
"SYCL";
286 std::cout << std::setw(textWidth) <<
"Speedup/ Agreement" << std::endl;
287 std::cout << std::setw(textWidth) <<
" Time (s):";
290 std::cout << std::setw(textWidth) <<
std::to_string(cpuTime / syclTime);
291 std::cout << std::endl;
294 std::cout << std::setw(textWidth) <<
" Seeds found:";
297 std::cout << std::setw(textWidth)
299 std::cout << std::endl;
303 <<
"---------------------------------------------------------------"
305 std::cout << std::endl;
307 std::cout << cpuTime <<
',' << syclTime <<
',' << cpuTime / syclTime <<
','
308 << nSeed_cpu <<
',' << nSeed_sycl <<
',' << nMatch <<
'\n';
311 for (
const auto* S : spVec) {