13 size_t chunk = std::accumulate(sz.begin(), sz.end(), 0);
21 std::vector<size_t> cumsum_sizes(sz.size() + 1, 0);
22 std::partial_sum(sz.begin(), sz.end(), cumsum_sizes.begin() + 1);
23 for (
unsigned int i = 1;
i < cumsum_sizes.size(); ++
i)
25 size_t types_size = 0;
27 types_size =
sizeof(
float);
28 else if (
cpos::types[
i - 1] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
29 types_size =
sizeof(int32_t);
30 else if (
cpos::types[
i - 1] == cpos::HeterogeneousHGCalPositionsType::Uint32_t)
31 types_size =
sizeof(uint32_t);
33 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
34 <<
"Wrong HeterogeneousHGCalPositionsMapping type";
35 cumsum_sizes[
i] /= types_size;
38 for (
unsigned int j = 0;
j < sz.size(); ++
j) {
41 const unsigned int jm1 =
j - 1;
42 const size_t shift = cumsum_sizes[
j] - cumsum_sizes[jm1];
47 cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
50 else if (
cpos::types[jm1] == cpos::HeterogeneousHGCalPositionsType::Int32_t and
51 cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
53 else if (
cpos::types[jm1] == cpos::HeterogeneousHGCalPositionsType::Int32_t and
54 cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Uint32_t)
58 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
59 <<
"Wrong HeterogeneousHGCalPositionsMapping type";
66 for (
unsigned int i = cumsum_sizes[
j];
i < cumsum_sizes[
j + 1]; ++
i) {
67 unsigned int index =
i - cumsum_sizes[
j];
71 }
else if (
cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Int32_t) {
74 }
else if (
cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Uint32_t) {
78 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
79 <<
"Wrong HeterogeneousHGCalPositions type";
99 std::vector<size_t> sizes(npointers);
100 for (
unsigned int i = 0;
i < npointers; ++
i) {
101 const unsigned detid_index = 4;
102 const unsigned nlayers_index = 3;
109 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
110 <<
"Wrong HeterogeneousHGCalPositions type (Float)";
111 else if (
cpos::types[
i] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
113 else if (
cpos::types[
i] == cpos::HeterogeneousHGCalPositionsType::Uint32_t)
117 std::vector<size_t> sizes_units(npointers);
118 for (
unsigned int i = 0;
i < npointers; ++
i) {
120 sizes_units[
i] =
sizeof(
float);
121 else if (
cpos::types[
i] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
122 sizes_units[
i] =
sizeof(int32_t);
123 else if (
cpos::types[
i] == cpos::HeterogeneousHGCalPositionsType::Uint32_t)
124 sizes_units[
i] =
sizeof(uint32_t);
128 this->
sizes_.resize(npointers);
129 std::transform(sizes.begin(), sizes.end(), sizes_units.begin(), this->
sizes_.begin(), std::multiplies<size_t>());
149 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
150 <<
"select_pointer_f(heterogeneous): no item (typed " <<
item <<
").";
161 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
162 <<
"select_pointer_f(non-heterogeneous): no item (typed " <<
item <<
").";
177 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
178 <<
"select_pointer_i(heterogeneous): no item (typed " <<
item <<
").";
193 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
194 <<
"select_pointer_i(non-heterogeneous): no item (typed " <<
item <<
").";
203 return cpuObject->
detid;
205 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
206 <<
"select_pointer_u(heterogeneous): no item (typed " <<
item <<
").";
207 return cpuObject->
detid;
215 return cpuObject->
detid;
217 throw cms::Exception(
"HeterogeneousHGCalHEFCellPositionsConditions")
218 <<
"select_pointer_u(non-heterogeneous): no item (typed " <<
item <<
").";
219 return cpuObject->
detid;
246 size_t sfloat =
sizeof(
float);
247 size_t sint32 =
sizeof(int32_t);
248 for (
unsigned int j = 0;
j < this->
sizes_.size() - 1; ++
j) {
254 cpos::types[
j + 1] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
257 else if (
cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Int32_t and
258 cpos::types[
j + 1] == cpos::HeterogeneousHGCalPositionsType::Int32_t)
261 else if (
cpos::types[
j] == cpos::HeterogeneousHGCalPositionsType::Int32_t and
262 cpos::types[
j + 1] == cpos::HeterogeneousHGCalPositionsType::Uint32_t)
272 size_t non_position_memory_size_to_transfer =
276 this->posmap_.zLayer,
277 non_position_memory_size_to_transfer,
278 cudaMemcpyHostToDevice,
285 cudaMemcpyHostToDevice,
299 if (
host !=
nullptr) {