Skip to content

Commit

Permalink
use cms::alpakatools::once_per_block
Browse files Browse the repository at this point in the history
  • Loading branch information
slava77devel committed Jul 23, 2024
1 parent fac2958 commit 69debc2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
8 changes: 6 additions & 2 deletions RecoTracker/LSTCore/src/alpaka/MiniDoublet.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef RecoTracker_LSTCore_src_alpaka_MiniDoublet_h
#define RecoTracker_LSTCore_src_alpaka_MiniDoublet_h

#include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h"

#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/Module.h"
#include "RecoTracker/LSTCore/interface/EndcapGeometry.h"
Expand Down Expand Up @@ -994,7 +996,9 @@ namespace lst {

// Declare variables in shared memory and set to 0
int& nTotalMDs = alpaka::declareSharedVar<int, __COUNTER__>(acc);
nTotalMDs = 0;
if (cms::alpakatools::once_per_block(acc)) {
nTotalMDs = 0;
}
alpaka::syncBlockThreads(acc);

// Initialize variables outside of the for loop.
Expand Down Expand Up @@ -1067,7 +1071,7 @@ namespace lst {

// Wait for all threads to finish before reporting final values
alpaka::syncBlockThreads(acc);
if (globalThreadIdx[2] == 0) {
if (cms::alpakatools::once_per_block(acc)) {
rangesInGPU.miniDoubletModuleIndices[*modulesInGPU.nLowerModules] = nTotalMDs;
*rangesInGPU.device_nTotalMDs = nTotalMDs;
}
Expand Down
8 changes: 6 additions & 2 deletions RecoTracker/LSTCore/src/alpaka/Quintuplet.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef RecoTracker_LSTCore_src_alpaka_Quintuplet_h
#define RecoTracker_LSTCore_src_alpaka_Quintuplet_h

#include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h"

#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/Module.h"
#include "RecoTracker/LSTCore/interface/EndcapGeometry.h"
Expand Down Expand Up @@ -3109,8 +3111,10 @@ namespace lst {
// Initialize variables in shared memory and set to 0
int& nEligibleT5Modulesx = alpaka::declareSharedVar<int, __COUNTER__>(acc);
int& nTotalQuintupletsx = alpaka::declareSharedVar<int, __COUNTER__>(acc);
nTotalQuintupletsx = 0;
nEligibleT5Modulesx = 0;
if (cms::alpakatools::once_per_block(acc)) {
nTotalQuintupletsx = 0;
nEligibleT5Modulesx = 0;
}
alpaka::syncBlockThreads(acc);

// Initialize variables outside of the for loop.
Expand Down
6 changes: 5 additions & 1 deletion RecoTracker/LSTCore/src/alpaka/Segment.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef RecoTracker_LSTCore_src_alpaka_Segment_h
#define RecoTracker_LSTCore_src_alpaka_Segment_h

#include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h"

#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/Module.h"
#include "RecoTracker/LSTCore/interface/EndcapGeometry.h"
Expand Down Expand Up @@ -900,7 +902,9 @@ namespace lst {

// Initialize variables in shared memory and set to 0
int& nTotalSegments = alpaka::declareSharedVar<int, __COUNTER__>(acc);
nTotalSegments = 0;
if (cms::alpakatools::once_per_block(acc)) {
nTotalSegments = 0;
}
alpaka::syncBlockThreads(acc);

// Initialize variables outside of the for loop.
Expand Down
6 changes: 5 additions & 1 deletion RecoTracker/LSTCore/src/alpaka/Triplet.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef RecoTracker_LSTCore_src_alpaka_Triplet_h
#define RecoTracker_LSTCore_src_alpaka_Triplet_h

#include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h"

#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/Module.h"

Expand Down Expand Up @@ -997,7 +999,9 @@ namespace lst {

// Initialize variables in shared memory and set to 0
int& nTotalTriplets = alpaka::declareSharedVar<int, __COUNTER__>(acc);
nTotalTriplets = 0;
if (cms::alpakatools::once_per_block(acc)) {
nTotalTriplets = 0;
}
alpaka::syncBlockThreads(acc);

// Initialize variables outside of the for loop.
Expand Down

0 comments on commit 69debc2

Please sign in to comment.