1204 int& totalSeedOffset = alpaka::declareSharedVar<int, __COUNTER__>(acc);
1205 int& totalSeedFracOffset = alpaka::declareSharedVar<int, __COUNTER__>(acc);
1209 pfClusteringVars.nTopos() = 0;
1210 pfClusteringVars.nRHFracs() = 0;
1211 totalSeedOffset = 0;
1212 totalSeedFracOffset = 0;
1213 pfClusteringVars.pcrhFracSize() = 0;
1216 alpaka::syncBlockThreads(acc);
1220 for (
int rhIdx = alpaka::getIdx<alpaka::Block, alpaka::Threads>(acc)[0u]; rhIdx < nRH;
1221 rhIdx += alpaka::getWorkDiv<alpaka::Block, alpaka::Threads>(acc)[0u]) {
1222 pfClusteringVars[rhIdx].rhIdxToSeedIdx() = -1;
1223 int topoId = pfClusteringVars[rhIdx].pfrh_topoId();
1228 if (topoId == rhIdx) {
1230 pfClusteringVars[topoIdx].topoIds() =
1234 if (pfClusteringVars[rhIdx].pfrh_isSeed()) {
1240 alpaka::syncBlockThreads(acc);
1243 for (
int topoId = alpaka::getIdx<alpaka::Block, alpaka::Threads>(acc)[0u]; topoId < nRH;
1244 topoId += alpaka::getWorkDiv<alpaka::Block, alpaka::Threads>(acc)[0u]) {
1245 if (pfClusteringVars[topoId].topoSeedCount() > 0) {
1248 pfClusteringVars[topoId].topoSeedOffsets() =
offset;
1251 alpaka::syncBlockThreads(acc);
1255 for (
int rhIdx = alpaka::getIdx<alpaka::Block, alpaka::Threads>(acc)[0u]; rhIdx < nRH;
1256 rhIdx += alpaka::getWorkDiv<alpaka::Block, alpaka::Threads>(acc)[0u]) {
1257 int topoId = pfClusteringVars[rhIdx].pfrh_topoId();
1258 if (pfClusteringVars[rhIdx].pfrh_isSeed()) {
1261 int seedIdx = pfClusteringVars[topoId].topoSeedOffsets() +
k;
1262 if ((
unsigned int)seedIdx >= *nSeeds)
1263 printf(
"Warning(contraction) %8d > %8d should not happen, check topoId: %d has %d rh\n",
1268 pfClusteringVars[seedIdx].topoSeedList() = rhIdx;
1269 pfClusteringVars[rhIdx].rhIdxToSeedIdx() = seedIdx;
1270 clusterView[seedIdx].topoId() = topoId;
1271 clusterView[seedIdx].seedRHIdx() = rhIdx;
1272 clusterView[seedIdx].depth() =
pfRecHits[rhIdx].depth();
1276 alpaka::syncBlockThreads(acc);
1279 for (
int rhIdx = alpaka::getIdx<alpaka::Block, alpaka::Threads>(acc)[0u]; rhIdx < nRH;
1280 rhIdx += alpaka::getWorkDiv<alpaka::Block, alpaka::Threads>(acc)[0u]) {
1281 pfClusteringVars[rhIdx].rhCount() = 1;
1283 int topoId = pfClusteringVars[rhIdx].pfrh_topoId();
1284 if (pfClusteringVars[rhIdx].pfrh_isSeed() && topoId > -1) {
1289 pfClusteringVars[rhIdx].seedFracOffsets() =
offset;
1292 clusterView[pfClusteringVars[rhIdx].rhIdxToSeedIdx()].rhfracOffset() =
1293 pfClusteringVars[rhIdx].seedFracOffsets();
1294 clusterView[pfClusteringVars[rhIdx].rhIdxToSeedIdx()].rhfracSize() =
1295 pfClusteringVars[topoId].topoRHCount() - pfClusteringVars[topoId].topoSeedCount() + 1;
1299 alpaka::syncBlockThreads(acc);
1302 pfClusteringVars.pcrhFracSize() = totalSeedFracOffset;
1303 pfClusteringVars.nRHFracs() = totalSeedFracOffset;
1304 clusterView.nRHFracs() = totalSeedFracOffset;
1305 *nRHF = totalSeedFracOffset;
1306 clusterView.nSeeds() = *nSeeds;
1307 clusterView.nTopos() = pfClusteringVars.nTopos();
1309 if (pfClusteringVars.pcrhFracSize() > 200000)
1310 printf(
"At the end of topoClusterContraction, found large *pcrhFracSize = %d\n",
1311 pfClusteringVars.pcrhFracSize());
T1 atomicAdd(T1 *a, T2 b)