forked from cms-patatrack/pixeltrack-standalone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSiPixelDigisCUDA.cc
50 lines (41 loc) · 2.05 KB
/
SiPixelDigisCUDA.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "CUDADataFormats/SiPixelDigisCUDA.h"
#include "CUDACore/device_unique_ptr.h"
#include "CUDACore/host_unique_ptr.h"
#include "CUDACore/copyAsync.h"
SiPixelDigisCUDA::SiPixelDigisCUDA(size_t maxFedWords, cudaStream_t stream) {
xx_d = cms::cuda::make_device_unique<uint16_t[]>(maxFedWords, stream);
yy_d = cms::cuda::make_device_unique<uint16_t[]>(maxFedWords, stream);
adc_d = cms::cuda::make_device_unique<uint16_t[]>(maxFedWords, stream);
moduleInd_d = cms::cuda::make_device_unique<uint16_t[]>(maxFedWords, stream);
clus_d = cms::cuda::make_device_unique<int32_t[]>(maxFedWords, stream);
pdigi_d = cms::cuda::make_device_unique<uint32_t[]>(maxFedWords, stream);
rawIdArr_d = cms::cuda::make_device_unique<uint32_t[]>(maxFedWords, stream);
auto view = cms::cuda::make_host_unique<DeviceConstView>(stream);
view->xx_ = xx_d.get();
view->yy_ = yy_d.get();
view->adc_ = adc_d.get();
view->moduleInd_ = moduleInd_d.get();
view->clus_ = clus_d.get();
view_d = cms::cuda::make_device_unique<DeviceConstView>(stream);
cms::cuda::copyAsync(view_d, view, stream);
}
cms::cuda::host::unique_ptr<uint16_t[]> SiPixelDigisCUDA::adcToHostAsync(cudaStream_t stream) const {
auto ret = cms::cuda::make_host_unique<uint16_t[]>(nDigis(), stream);
cms::cuda::copyAsync(ret, adc_d, nDigis(), stream);
return ret;
}
cms::cuda::host::unique_ptr<int32_t[]> SiPixelDigisCUDA::clusToHostAsync(cudaStream_t stream) const {
auto ret = cms::cuda::make_host_unique<int32_t[]>(nDigis(), stream);
cms::cuda::copyAsync(ret, clus_d, nDigis(), stream);
return ret;
}
cms::cuda::host::unique_ptr<uint32_t[]> SiPixelDigisCUDA::pdigiToHostAsync(cudaStream_t stream) const {
auto ret = cms::cuda::make_host_unique<uint32_t[]>(nDigis(), stream);
cms::cuda::copyAsync(ret, pdigi_d, nDigis(), stream);
return ret;
}
cms::cuda::host::unique_ptr<uint32_t[]> SiPixelDigisCUDA::rawIdArrToHostAsync(cudaStream_t stream) const {
auto ret = cms::cuda::make_host_unique<uint32_t[]>(nDigis(), stream);
cms::cuda::copyAsync(ret, rawIdArr_d, nDigis(), stream);
return ret;
}