14 size_t chunk = std::accumulate(sz.begin(), sz.end(), 0);
22 std::vector<size_t> cumsum_sizes(sz.size() + 1, 0);
23 std::partial_sum(sz.begin(), sz.end(), cumsum_sizes.begin() + 1);
24 for (
unsigned int i = 1;
i < cumsum_sizes.size(); ++
i)
26 size_t types_size = 0;
28 types_size =
sizeof(
float);
29 else if (
cpos::types[
i - 1] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
30 types_size =
sizeof(int32_t);
31 else if (
cpos::types[
i - 1] == cpos::HeterogeneousHGCalPositionsType::Uint32_t)
32 types_size =
sizeof(uint32_t);
34 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
35 <<
"Wrong HeterogeneousHGCalPositionsMapping type";
36 cumsum_sizes[
i] /= types_size;
39 for (
unsigned int j = 0;
j < sz.size(); ++
j) {
42 const unsigned int jm1 =
j - 1;
43 const size_t shift = cumsum_sizes[
j] - cumsum_sizes[jm1];
48 cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
51 else if (
cpos::types[jm1] == cpos::HeterogeneousHGCalPositionsType::Int32_t and
52 cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
54 else if (
cpos::types[jm1] == cpos::HeterogeneousHGCalPositionsType::Int32_t and
55 cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Uint32_t)
59 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
60 <<
"Wrong HeterogeneousHGCalPositionsMapping type";
67 for (
unsigned int i = cumsum_sizes[
j];
i < cumsum_sizes[
j + 1]; ++
i) {
68 unsigned int index =
i - cumsum_sizes[
j];
72 }
else if (
cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Int32_t) {
75 }
else if (
cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Uint32_t) {
79 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
80 <<
"Wrong HeterogeneousHGCalPositions type";
100 std::vector<size_t> sizes(npointers);
101 for (
unsigned int i = 0;
i < npointers; ++
i) {
102 const unsigned detid_index = 4;
103 const unsigned nlayers_index = 3;
110 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
111 <<
"Wrong HeterogeneousHGCalPositions type (Float)";
112 else if (
cpos::types[
i] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
114 else if (
cpos::types[
i] == cpos::HeterogeneousHGCalPositionsType::Uint32_t)
118 std::vector<size_t> sizes_units(npointers);
119 for (
unsigned int i = 0;
i < npointers; ++
i) {
121 sizes_units[
i] =
sizeof(
float);
122 else if (
cpos::types[
i] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
123 sizes_units[
i] =
sizeof(int32_t);
124 else if (
cpos::types[
i] == cpos::HeterogeneousHGCalPositionsType::Uint32_t)
125 sizes_units[
i] =
sizeof(uint32_t);
129 this->
sizes_.resize(npointers);
130 std::transform(sizes.begin(), sizes.end(), sizes_units.begin(), this->
sizes_.begin(), std::multiplies<size_t>());
150 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
151 <<
"select_pointer_f(heterogeneous): no item (typed " <<
item <<
").";
162 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
163 <<
"select_pointer_f(non-heterogeneous): no item (typed " <<
item <<
").";
178 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
179 <<
"select_pointer_i(heterogeneous): no item (typed " <<
item <<
").";
194 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
195 <<
"select_pointer_i(non-heterogeneous): no item (typed " <<
item <<
").";
204 return cpuObject->
detid;
206 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
207 <<
"select_pointer_u(heterogeneous): no item (typed " <<
item <<
").";
208 return cpuObject->
detid;
216 return cpuObject->
detid;
218 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
219 <<
"select_pointer_u(non-heterogeneous): no item (typed " <<
item <<
").";
220 return cpuObject->
detid;
247 size_t sfloat =
sizeof(
float);
248 size_t sint32 =
sizeof(int32_t);
249 for (
unsigned int j = 0;
j < this->
sizes_.size() - 1; ++
j) {
255 cpos::types[
j + 1] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
258 else if (
cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Int32_t and
259 cpos::types[
j + 1] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
262 else if (
cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Int32_t and
263 cpos::types[
j + 1] == cpos::HeterogeneousHGCalPositionsType::Uint32_t)
273 size_t non_position_memory_size_to_transfer =
277 this->posmap_.zLayer,
278 non_position_memory_size_to_transfer,
279 cudaMemcpyHostToDevice,
286 cudaMemcpyHostToDevice,
300 if (
host !=
nullptr) {
positions::HeterogeneousHGCalPositionsMapping posmap
hgcal_conditions::HeterogeneousHEFCellPositionsConditionsESProduct * device
uint32_t *& select_pointer_u_(cpos::HeterogeneousHGCalPositionsMapping *, const unsigned int &) const
std::vector< std::int32_t > nCellsWaferUChunk
~HeterogeneousHGCalHEFCellPositionsConditions()
cms::cuda::ESProduct< GPUData > gpuData_
void fill_positions(const hgcal_conditions::HeterogeneousHEFCellPositionsConditionsESProduct *)
std::int32_t * nCellsLayer
vecVecTString chunk(vecTString in, Int_t nchunk)
std::vector< float > zLayer
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
const size_t number_position_arrays
void transfer_data_to_heterogeneous_pointers_(const std::vector< size_t > &, cpos::HGCalPositionsMapping *)
cpos::HeterogeneousHGCalPositionsMapping posmap_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::int32_t * nCellsHexagon
std::vector< std::uint32_t > detid
size_t allocate_memory_(const std::vector< size_t > &)
float *& select_pointer_f_(cpos::HeterogeneousHGCalPositionsMapping *, const unsigned int &) const
std::vector< size_t > sizes_
std::size_t nelems_posmap
char data[epos_bytes_allocation]
std::int32_t * nCellsWaferUChunk
HeterogeneousHGCalHEFCellPositionsConditions(cpos::HGCalPositionsMapping *)
static unsigned int const shift
void transfer_data_to_heterogeneous_vars_(const cpos::HGCalPositionsMapping *)
#define cudaCheck(ARG,...)
int32_t *& select_pointer_i_(cpos::HeterogeneousHGCalPositionsMapping *, const unsigned int &) const
std::vector< size_t > calculate_memory_bytes_(cpos::HGCalPositionsMapping *)
hgcal_conditions::HeterogeneousHEFCellPositionsConditionsESProduct const * getHeterogeneousConditionsESProductAsync(cudaStream_t stream) const
std::vector< std::int32_t > nCellsHexagon
std::vector< std::int32_t > nCellsLayer
hgcal_conditions::HeterogeneousHEFCellPositionsConditionsESProduct * host