34 int main(
int argc,
char* argv[]) {
41 std::cout <<
"Read " << spacepoints.size()
42 <<
" spacepoints from file: " << cmdl.
spFile << std::endl;
47 std::vector<const TestSpacePoint*> spView;
48 spView.reserve(spacepoints.size());
49 for (
const auto& sp : spacepoints) {
50 spView.push_back(sp.get());
54 auto bottomBinFinder = std::make_shared<Acts::BinFinder<TestSpacePoint>>();
55 auto topBinFinder = std::make_shared<Acts::BinFinder<TestSpacePoint>>();
61 sfConfig.deltaRMin = 5.;
62 sfConfig.deltaRMax = 160.;
63 sfConfig.collisionRegionMin = -250.;
64 sfConfig.collisionRegionMax = 250.;
65 sfConfig.zMin = -2800.;
66 sfConfig.zMax = 2800.;
67 sfConfig.maxSeedsPerSpM = 5;
69 sfConfig.cotThetaMax = 7.40627;
70 sfConfig.sigmaScattering = 1.00000;
71 sfConfig.minPt = 500.;
72 sfConfig.bFieldInZ = 0.00199724;
73 sfConfig.beamPos = {-.5, -.5};
74 sfConfig.impactMax = 10.;
81 sfConfig.maxBlockSize = 256;
85 gridConfig.
bFieldInZ = sfConfig.bFieldInZ;
86 gridConfig.
minPt = sfConfig.minPt;
87 gridConfig.
rMax = sfConfig.rMax;
88 gridConfig.
zMax = sfConfig.zMax;
89 gridConfig.
zMin = sfConfig.zMin;
90 gridConfig.
deltaRMax = sfConfig.deltaRMax;
102 Acts::SpacePointGridCreator::createGrid<TestSpacePoint>(gridConfig);
104 spView.begin(), spView.end(), ct, bottomBinFinder, topBinFinder,
105 std::move(grid), sfConfig);
107 auto spGroup_end = spGroup.
end();
112 sfConfig.seedFilter = std::make_unique<Acts::SeedFilter<TestSpacePoint>>(
113 filterConfig, &hostCuts);
119 sfConfig, filterConfig, deviceCuts);
126 auto start_host = std::chrono::system_clock::now();
128 std::vector<std::vector<Acts::Seed<TestSpacePoint>>> seeds_host;
132 auto spGroup_itr = spGroup.begin();
133 for (std::size_t i = 0;
135 ++i, ++spGroup_itr) {
137 spGroup_itr.bottom(), spGroup_itr.middle(), spGroup_itr.top()));
142 auto end_host = std::chrono::system_clock::now();
143 double time_host = std::chrono::duration_cast<std::chrono::milliseconds>(
144 end_host - start_host)
148 std::cout <<
"Done with the seedfinding on the host" << std::endl;
156 auto start_device = std::chrono::system_clock::now();
158 std::vector<std::vector<Acts::Seed<TestSpacePoint>>> seeds_device;
161 auto spGroup_itr = spGroup.begin();
162 for (std::size_t i = 0;
164 ++i, ++spGroup_itr) {
166 spGroup_itr.bottom(), spGroup_itr.middle(), spGroup_itr.top()));
170 auto end_device = std::chrono::system_clock::now();
171 double time_device = std::chrono::duration_cast<std::chrono::milliseconds>(
172 end_device - start_device)
175 std::cout <<
"Done with the seedfinding on the device" << std::endl;
182 std::size_t nSeeds_host = 0, nSeeds_device = 0;
183 for (
const auto& seeds : seeds_host) {
184 nSeeds_host += seeds.size();
186 for (
const auto& seeds : seeds_device) {
187 nSeeds_device += seeds.size();
192 std::size_t nMatch = 0;
193 double matchPercentage = 0.0;
195 assert(seeds_host.size() == seeds_device.size());
196 for (
size_t i = 0; i < seeds_host.size(); i++) {
198 const auto& seeds_in_host_region = seeds_host[i];
199 const auto& seeds_in_device_region = seeds_device[i];
201 for (
const auto& host_seed : seeds_in_host_region) {
202 assert(host_seed.sp().size() == 3);
204 for (
const auto& device_seed : seeds_in_device_region) {
205 assert(device_seed.sp().size() == 3);
206 if ((*(host_seed.sp()[0]) == *(device_seed.sp()[0])) &&
207 (*(host_seed.sp()[1]) == *(device_seed.sp()[1])) &&
208 (*(host_seed.sp()[2]) == *(device_seed.sp()[2]))) {
215 matchPercentage = (100.0 * nMatch) / nSeeds_host;
219 std::cout << std::endl;
220 std::cout <<
"-------------------------- Results ---------------------------"
222 std::cout <<
"| | Host | Device | Speedup/agreement |"
224 std::cout <<
"--------------------------------------------------------------"
226 std::cout <<
"| Time [s] | " << std::setw(10)
228 << std::setw(10) << time_device <<
" | " << std::setw(10)
231 <<
" |" << std::endl;
232 std::cout <<
"| Seeds | " << std::setw(10)
234 <<
" | " << std::setw(10) << nSeeds_device <<
" | "
237 <<
" |" << std::endl;
238 std::cout <<
"--------------------------------------------------------------"
240 std::cout << std::endl;