Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:45

0001 #include "CUDADataFormats/HGCal/interface/HGCUncalibRecHitDevice.h"
0002 
0003 HGCUncalibRecHitDevice::HGCUncalibRecHitDevice(uint32_t nhits, const cudaStream_t& stream) : nhits_(nhits) {
0004   size_tot_ = std::accumulate(sizes_.begin(), sizes_.end(), 0);  //this might be done at compile time
0005   pad_ = ((nhits - 1) / 32 + 1) * 32;                            //align to warp boundary (assumption: warpSize = 32)
0006   ptr_ = cms::cuda::make_device_unique<std::byte[]>(pad_ * size_tot_, stream);
0007 
0008   defineSoAMemoryLayout_();
0009 }
0010 
0011 void HGCUncalibRecHitDevice::defineSoAMemoryLayout_() {
0012   soa_.amplitude_ = reinterpret_cast<float*>(ptr_.get());
0013   soa_.pedestal_ = soa_.amplitude_ + pad_;
0014   soa_.jitter_ = soa_.pedestal_ + pad_;
0015   soa_.chi2_ = soa_.jitter_ + pad_;
0016   soa_.OOTamplitude_ = soa_.chi2_ + pad_;
0017   soa_.OOTchi2_ = soa_.OOTamplitude_ + pad_;
0018   soa_.flags_ = reinterpret_cast<uint32_t*>(soa_.OOTchi2_ + pad_);
0019   soa_.aux_ = soa_.flags_ + pad_;
0020   soa_.id_ = soa_.aux_ + pad_;
0021 
0022   soa_.nbytes_ = size_tot_;
0023   soa_.nhits_ = nhits_;
0024   soa_.pad_ = pad_;
0025 }