Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:33

0001 #ifndef CalibTracker_SiPixelESProducers_interface_SiPixelROCsStatusAndMappingWrapper_h
0002 #define CalibTracker_SiPixelESProducers_interface_SiPixelROCsStatusAndMappingWrapper_h
0003 
0004 #include <set>
0005 
0006 #include <cuda_runtime.h>
0007 
0008 #include "CondFormats/SiPixelObjects/interface/SiPixelROCsStatusAndMapping.h"
0009 #include "HeterogeneousCore/CUDACore/interface/ESProduct.h"
0010 #include "HeterogeneousCore/CUDAUtilities/interface/HostAllocator.h"
0011 #include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h"
0012 
0013 class SiPixelFedCablingMap;
0014 class TrackerGeometry;
0015 class SiPixelQuality;
0016 
0017 class SiPixelROCsStatusAndMappingWrapper {
0018 public:
0019   SiPixelROCsStatusAndMappingWrapper(SiPixelFedCablingMap const &cablingMap,
0020                                      TrackerGeometry const &trackerGeom,
0021                                      SiPixelQuality const *badPixelInfo);
0022   ~SiPixelROCsStatusAndMappingWrapper();
0023 
0024   bool hasQuality() const { return hasQuality_; }
0025 
0026   // returns pointer to GPU memory
0027   const SiPixelROCsStatusAndMapping *getGPUProductAsync(cudaStream_t cudaStream) const;
0028 
0029   // returns pointer to GPU memory
0030   const unsigned char *getModToUnpAllAsync(cudaStream_t cudaStream) const;
0031   cms::cuda::device::unique_ptr<unsigned char[]> getModToUnpRegionalAsync(std::set<unsigned int> const &modules,
0032                                                                           cudaStream_t cudaStream) const;
0033 
0034 private:
0035   const SiPixelFedCablingMap *cablingMap_;
0036   std::vector<unsigned char, cms::cuda::HostAllocator<unsigned char>> modToUnpDefault;
0037   unsigned int size;
0038   bool hasQuality_;
0039 
0040   SiPixelROCsStatusAndMapping *cablingMapHost = nullptr;  // pointer to struct in CPU
0041 
0042   struct GPUData {
0043     ~GPUData();
0044     SiPixelROCsStatusAndMapping *cablingMapDevice = nullptr;  // pointer to struct in GPU
0045   };
0046   cms::cuda::ESProduct<GPUData> gpuData_;
0047 
0048   struct ModulesToUnpack {
0049     ~ModulesToUnpack();
0050     unsigned char *modToUnpDefault = nullptr;  // pointer to GPU
0051   };
0052   cms::cuda::ESProduct<ModulesToUnpack> modToUnp_;
0053 };
0054 
0055 #endif  // CalibTracker_SiPixelESProducers_interface_SiPixelROCsStatusAndMappingWrapper_h