3 #include <alpaka/alpaka.hpp> 27 using digis_type = std::vector<uint16_t>;
28 using dids_type = std::vector<uint32_t>;
35 auto const ebSize =
static_cast<uint32_t
>(uncalibRecHitsDevEB.const_view().metadata().size());
36 auto const totalChannels = ebSize +
static_cast<uint32_t
>(uncalibRecHitsDevEE.const_view().metadata().size());
43 uint32_t
constexpr nchannels_per_block = 32;
44 auto constexpr threads_1d = kMaxSamples * nchannels_per_block;
46 auto workDivPrep1D = cms::alpakatools::make_workdiv<Acc1D>(blocks_1d, threads_1d);
49 alpaka::exec<Acc1D>(
queue,
52 digisDevEB.const_view(),
53 digisDevEE.const_view(),
54 uncalibRecHitsDevEB.view(),
55 uncalibRecHitsDevEE.view(),
56 conditionsDev.const_view(),
58 reinterpret_cast<::ecal::multifit::SampleGainVector*>(scratch.gainsNoiseDevBuf.data()),
59 scratch.hasSwitchToGain6DevBuf.data(),
60 scratch.hasSwitchToGain1DevBuf.data(),
61 scratch.isSaturatedDevBuf.data(),
62 scratch.acStateDevBuf.data(),
70 Vec2D const blocks_2d{1u, totalChannels};
71 Vec2D const threads_2d{kMaxSamples, kMaxSamples};
72 auto workDivPrep2D = cms::alpakatools::make_workdiv<Acc2D>(blocks_2d, threads_2d);
73 alpaka::exec<Acc2D>(
queue,
76 digisDevEB.const_view(),
77 digisDevEE.const_view(),
78 conditionsDev.const_view(),
80 reinterpret_cast<::ecal::multifit::SampleMatrix*>(scratch.noisecovDevBuf.data()),
81 reinterpret_cast<::ecal::multifit::PulseMatrixType*>(scratch.pulse_matrixDevBuf.data()),
82 scratch.hasSwitchToGain6DevBuf.data(),
83 scratch.hasSwitchToGain1DevBuf.data(),
84 scratch.isSaturatedDevBuf.data());
102 auto const blocks_time_init = blocks_1d;
103 auto const threads_time_init = threads_1d;
104 auto workDivTimeCompInit1D = cms::alpakatools::make_workdiv<Acc1D>(blocks_time_init, threads_time_init);
105 alpaka::exec<Acc1D>(
queue,
106 workDivTimeCompInit1D,
108 digisDevEB.const_view(),
109 digisDevEE.const_view(),
110 conditionsDev.const_view(),
111 scratch.sample_valuesDevBuf.value().data(),
112 scratch.sample_value_errorsDevBuf.value().data(),
113 scratch.ampMaxErrorDevBuf.value().data(),
114 scratch.useless_sample_valuesDevBuf.value().data(),
115 scratch.pedestal_numsDevBuf.value().data());
124 auto const threadsFixMGPA = threads_1d;
126 auto workDivTimeFixMGPAslew1D = cms::alpakatools::make_workdiv<Acc1D>(blocksFixMGPA, threadsFixMGPA);
127 alpaka::exec<Acc1D>(
queue,
128 workDivTimeFixMGPAslew1D,
130 digisDevEB.const_view(),
131 digisDevEE.const_view(),
132 conditionsDev.const_view(),
133 scratch.sample_valuesDevBuf.value().data(),
134 scratch.sample_value_errorsDevBuf.value().data(),
135 scratch.useless_sample_valuesDevBuf.value().data());
138 auto const threads_nullhypot = threads_1d;
139 auto const blocks_nullhypot = blocks_1d;
140 auto workDivTimeNullhypot1D = cms::alpakatools::make_workdiv<Acc1D>(blocks_nullhypot, threads_nullhypot);
141 alpaka::exec<Acc1D>(
queue,
142 workDivTimeNullhypot1D,
144 scratch.sample_valuesDevBuf.value().data(),
145 scratch.sample_value_errorsDevBuf.value().data(),
146 scratch.useless_sample_valuesDevBuf.value().data(),
147 scratch.chi2sNullHypotDevBuf.value().data(),
148 scratch.sum0sNullHypotDevBuf.value().data(),
149 scratch.sumAAsNullHypotDevBuf.value().data(),
152 constexpr uint32_t nchannels_per_block_makeratio = kMaxSamples;
154 nchannels_per_block_makeratio * (nchannels_per_block_makeratio - 1) / 2;
155 constexpr auto threads_makeratio = nthreads_per_channel * nchannels_per_block_makeratio;
156 auto const blocks_makeratio =
158 auto workDivTimeMakeRatio1D = cms::alpakatools::make_workdiv<Acc1D>(blocks_makeratio, threads_makeratio);
159 alpaka::exec<Acc1D>(
queue,
160 workDivTimeMakeRatio1D,
162 digisDevEB.const_view(),
163 digisDevEE.const_view(),
164 scratch.sample_valuesDevBuf.value().data(),
165 scratch.sample_value_errorsDevBuf.value().data(),
166 scratch.useless_sample_valuesDevBuf.value().data(),
167 scratch.pedestal_numsDevBuf.value().data(),
168 scratch.sumAAsNullHypotDevBuf.value().data(),
169 scratch.sum0sNullHypotDevBuf.value().data(),
170 scratch.tMaxAlphaBetasDevBuf.value().data(),
171 scratch.tMaxErrorAlphaBetasDevBuf.value().data(),
172 scratch.accTimeMaxDevBuf.value().data(),
173 scratch.accTimeWgtDevBuf.value().data(),
174 scratch.tcStateDevBuf.value().data(),
175 paramsDev.const_view(),
181 auto const threads_findamplchi2 = threads_1d;
182 auto const blocks_findamplchi2 = blocks_1d;
183 auto workDivTimeFindAmplChi21D = cms::alpakatools::make_workdiv<Acc1D>(blocks_findamplchi2, threads_findamplchi2);
184 alpaka::exec<Acc1D>(
queue,
185 workDivTimeFindAmplChi21D,
187 digisDevEB.const_view(),
188 digisDevEE.const_view(),
189 scratch.sample_valuesDevBuf.value().data(),
190 scratch.sample_value_errorsDevBuf.value().data(),
191 scratch.useless_sample_valuesDevBuf.value().data(),
192 scratch.tMaxAlphaBetasDevBuf.value().data(),
193 scratch.tMaxErrorAlphaBetasDevBuf.value().data(),
194 scratch.accTimeMaxDevBuf.value().data(),
195 scratch.accTimeWgtDevBuf.value().data(),
196 scratch.sumAAsNullHypotDevBuf.value().data(),
197 scratch.sum0sNullHypotDevBuf.value().data(),
198 scratch.chi2sNullHypotDevBuf.value().data(),
199 scratch.tcStateDevBuf.value().data(),
200 scratch.ampMaxAlphaBetaDevBuf.value().data(),
201 scratch.ampMaxErrorDevBuf.value().data(),
202 scratch.timeMaxDevBuf.value().data(),
203 scratch.timeErrorDevBuf.value().data(),
204 paramsDev.const_view());
206 auto const threads_timecorr = 32;
208 auto workDivCorrFinal1D = cms::alpakatools::make_workdiv<Acc1D>(blocks_timecorr, threads_timecorr);
209 alpaka::exec<Acc1D>(
queue,
212 digisDevEB.const_view(),
213 digisDevEE.const_view(),
214 uncalibRecHitsDevEB.view(),
215 uncalibRecHitsDevEE.view(),
216 conditionsDev.const_view(),
217 scratch.timeMaxDevBuf.value().data(),
218 scratch.timeErrorDevBuf.value().data(),
void minimization_procedure(Queue &queue, InputProduct const &digisDevEB, InputProduct const &digisDevEE, OutputProduct &uncalibRecHitsDevEB, OutputProduct &uncalibRecHitsDevEE, EventDataForScratchDevice &scratch, EcalMultifitConditionsDevice const &conditionsDev, ConfigurationParameters const &configParams, uint32_t const totalChannels)
type timeFitLimitsSecondEB
PortableCollection< EcalMultifitParametersSoA > EcalMultifitParametersDevice
type outOfTimeThreshG12mEE
type outOfTimeThreshG12pEE
PortableCollection< EcalMultifitConditionsSoA > EcalMultifitConditionsDevice
bool shouldRunTimingComputation
type outOfTimeThreshG61mEE
type outOfTimeThreshG12mEB
Eigen::Matrix< data_type, SampleVectorSize, 1 > SampleVector
type outOfTimeThreshG61pEB
EcalDigiDeviceCollection InputProduct
Eigen::Matrix< char, SampleVectorSize, 1 > SampleGainVector
void launchKernels(Queue &queue, InputProduct const &digisDevEB, InputProduct const &digisDevEE, OutputProduct &uncalibRecHitsDevEB, OutputProduct &uncalibRecHitsDevEE, EcalMultifitConditionsDevice const &conditionsDev, EcalMultifitParametersDevice const ¶msDev, ConfigurationParameters const &configParams)
EcalUncalibratedRecHitDeviceCollection OutputProduct
type outOfTimeThreshG61mEB
type timeFitLimitsFirstEE
type outOfTimeThreshG61pEE
type outOfTimeThreshG12pEB
type timeFitLimitsSecondEE
type timeFitLimitsFirstEB
Eigen::Matrix< char, SampleVectorSize, 1 > BXVectorType
static constexpr int MAXSAMPLES