CMS 3D CMS Logo

SiPixelDigiErrorsCUDA.cc
Go to the documentation of this file.
1 #include <cassert>
2 
8 
10  : data_d(cms::cuda::make_device_unique<SiPixelErrorCompact[]>(maxFedWords, stream)),
13  formatterErrors_h(std::move(errors)),
14  nErrorWords_(maxFedWords) {
15  assert(maxFedWords != 0);
16  cms::cuda::memsetAsync(data_d, 0x00, maxFedWords, stream);
17 
18  cms::cuda::make_SimpleVector(error_h.get(), maxFedWords, data_d.get());
19  assert(error_h->empty());
20  assert(error_h->capacity() == static_cast<int>(maxFedWords));
21 
23 }
24 
27 }
28 
30  // On one hand size() could be sufficient. On the other hand, if
31  // someone copies the SimpleVector<>, (s)he might expect the data
32  // buffer to actually have space for capacity() elements.
33  auto data = cms::cuda::make_host_unique<SiPixelErrorCompact[]>(error_h->capacity(), stream);
34 
35  // but transfer only the required amount
36  if (not error_h->empty()) {
38  }
39  auto err = *error_h;
40  err.set_data(data.get());
41  return HostDataError(err, std::move(data));
42 }
void memsetAsync(device::unique_ptr< T > &ptr, T value, cudaStream_t stream)
Definition: memsetAsync.h:12
cms::cuda::host::unique_ptr< SiPixelErrorCompactVector > error_h
SimpleVector< T > make_SimpleVector(int capacity, T *data)
Definition: SimpleVector.h:124
host::impl::make_host_unique_selector< T >::non_array make_host_unique()
std::pair< SiPixelErrorCompactVector, cms::cuda::host::unique_ptr< SiPixelErrorCompact[]> > HostDataError
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
assert(be >=bs)
cms::cuda::device::unique_ptr< SiPixelErrorCompact[]> data_d
cms::cuda::device::unique_ptr< SiPixelErrorCompactVector > error_d
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
Namespace of DDCMS conversion namespace.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
device::impl::make_device_unique_selector< T >::non_array make_device_unique(cudaStream_t stream)
Definition: errors.py:1
void copyErrorToHostAsync(cudaStream_t stream)
std::map< cms_uint32_t, std::vector< SiPixelRawDataError > > SiPixelFormatterErrors
def move(src, dest)
Definition: eostools.py:511
SiPixelDigiErrorsCUDA()=default
HostDataError dataErrorToHostAsync(cudaStream_t stream) const