ATLAS Offline Software
Loading...
Searching...
No Matches
DataHolders.h
Go to the documentation of this file.
1//
2// Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3//
4// Dear emacs, this is -*- c++ -*-
5//
6
7#ifndef CALORECGPU_DATAHOLDERS_H
8#define CALORECGPU_DATAHOLDERS_H
9
10#include <vector>
11
12#include "Helpers.h"
13#include "CUDAFriendlyClasses.h"
14
15#define CALORECGPU_USE_PINNED_MEMORY 1
16
17namespace CaloRecGPU
18{
19
41
50 {
51 static constexpr int num_moments = 72;
52 bool array[num_moments + 1]{};
53 //Initialize to false.
54 //(We could consider using
55 //some form of bitset here,
56 //but I'm not sure there would be
57 //a significant performance difference...)
58
59 static int moment_to_linear(const int moment);
60
61 bool & operator[] (const int moment);
62
63 bool operator[] (const int moment) const;
64
65 static MomentsOptionsArray all();
66 };
67
73 {
74 public:
75
79 void importCells(const void * cell_collection, const std::vector<int> & extra_cells_to_fill = {});
80
85 void importClusters(const void * cluster_collection,
86 const MomentsOptionsArray & moments_to_add,
87 const bool output_tags = true,
88 const bool consider_shared_cells = true,
89 const bool output_moments = false,
90 const bool output_extra_moments = false,
91 const std::vector<int> & extra_cells_to_fill = {});
92
100 void sendToGPU(const MomentsOptionsArray & moments_to_add,
101 const bool full_copy = false,
102 const bool clear_CPU = false,
103 const bool synchronize = false,
105
114 void returnToCPU(const MomentsOptionsArray & moments_to_add,
115 const bool full_copy = false,
116 const bool clear_GPU = false,
117 const bool synchronize = false,
119 const bool also_return_cells = false);
120
132 void exportClusters(void * cluster_collection,
133 const void * cell_collection_link,
134 const MomentsOptionsArray & moments_to_add,
135 const bool sort_clusters = true,
136 const bool save_uncalibrated = true,
137 const bool output_extra_moments = false,
138 const std::vector<int> & extra_cells_to_fill = {},
139 size_t * time_measurements = nullptr);
140
152 void returnAndExportClusters(void * cluster_collection,
153 const void * cell_collection_link,
154 const MomentsOptionsArray & moments_to_add,
155 const bool sort_clusters = true,
156 const bool save_uncalibrated = true,
157 const bool output_extra_moments = false,
158 const std::vector<int> & extra_cells_to_fill = {},
159 size_t * time_measurements = nullptr,
161
162 void allocate(const bool also_GPU = true);
163
164 void clear_GPU();
165
166#if CALORECGPU_USE_PINNED_MEMORY
167
170
171#else
172
175
176#endif
177
180
181 };
182
183}
184
185#endif //CALORECGPU_DATAHOLDERS_H
Holds CPU and GPU versions of the geometry and cell noise information, which are assumed to be consta...
Definition DataHolders.h:27
CaloRecGPU::Helpers::CPU_object< CaloRecGPU::GeometryArr > m_geometry
Definition DataHolders.h:32
void sendToGPU(const bool clear_CPU=true)
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::CellNoiseArr > m_cell_noise_dev
Definition DataHolders.h:38
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::GeometryArr > m_geometry_dev
Definition DataHolders.h:36
CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellNoiseArr > m_cell_noise
Definition DataHolders.h:34
Holds the mutable per-event information (clusters and cells) and provides utilities to convert betwee...
Definition DataHolders.h:73
CaloRecGPU::Helpers::CUDA_pinned_CPU_object< CaloRecGPU::CellInfoArr > m_cell_info
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::CellInfoArr > m_cell_info_dev
CaloRecGPU::Helpers::CUDA_pinned_CPU_object< CaloRecGPU::ClusterInfoArr > m_clusters
void allocate(const bool also_GPU=true)
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::ClusterInfoArr > m_clusters_dev
void returnAndExportClusters(void *cluster_collection, const void *cell_collection_link, const MomentsOptionsArray &moments_to_add, const bool sort_clusters=true, const bool save_uncalibrated=true, const bool output_extra_moments=false, const std::vector< int > &extra_cells_to_fill={}, size_t *time_measurements=nullptr, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream={})
We are using a void* for API to make this able to compile on the GPU without Athena-specific dependen...
SimpleHolder< T, MemoryContext::CUDAGPU, true > CUDA_object
Holds an object of type T in CUDA GPU memory.
SimpleHolder< T, MemoryContext::CUDAPinnedCPU, true > CUDA_pinned_CPU_object
Holds an object of type T in CUDA GPU memory.
SimpleHolder< T, MemoryContext::CPU, true > CPU_object
Holds an object of type T in CPU memory.
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
Holds an array of bools to represent the different moments that may be calculated and transferred to/...
Definition DataHolders.h:50
bool array[num_moments+1]
Definition DataHolders.h:52
static MomentsOptionsArray all()
static int moment_to_linear(const int moment)
bool & operator[](const int moment)
static constexpr int num_moments
Definition DataHolders.h:51