Skip to content

Commit

Permalink
Require allocated type to have only a trivial constructor for make_de…
Browse files Browse the repository at this point in the history
…vice_unique and make_host_unique (#204)
  • Loading branch information
makortel authored and fwyzard committed Dec 29, 2020
1 parent 094270a commit 6f23b9c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions CUDADataFormats/SiPixelCluster/interface/SiPixelClustersCUDA.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ class SiPixelClustersCUDA {
friend SiPixelClustersCUDA;

private:
uint32_t const *moduleStart_ = nullptr;
int32_t const *clus_ = nullptr;
uint32_t const *clusInModule_ = nullptr;
uint32_t const *moduleId_ = nullptr;
uint32_t const *clusModuleStart_ = nullptr;
uint32_t const *moduleStart_;
int32_t const *clus_;
uint32_t const *clusInModule_;
uint32_t const *moduleId_;
uint32_t const *clusModuleStart_;
};

DeviceConstView *view() const { return view_d.get(); }
Expand Down
8 changes: 4 additions & 4 deletions CUDADataFormats/SiPixelDigi/interface/SiPixelDigisCUDA.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class SiPixelDigisCUDA {
friend class SiPixelDigisCUDA;

private:
uint16_t const *xx_ = nullptr;
uint16_t const *yy_ = nullptr;
uint16_t const *adc_ = nullptr;
uint16_t const *moduleInd_ = nullptr;
uint16_t const *xx_;
uint16_t const *yy_;
uint16_t const *adc_;
uint16_t const *moduleInd_;
};

const DeviceConstView *view() const { return view_d.get(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ namespace pixelgpudetails {
if (includeErrors and skipROC)
{
uint32_t rID = getErrRawID(fedId, ww, errorType, cablingMap, debug);
err->emplace_back(rID, ww, errorType, fedId);
err->push_back(pixelgpudetails::error_obj{rID, ww, errorType, fedId});
continue;
}

Expand Down Expand Up @@ -476,7 +476,7 @@ namespace pixelgpudetails {
if (includeErrors) {
if (not rocRowColIsValid(row, col)) {
uint32_t error = conversionError(fedId, 3, debug); //use the device function and fill the arrays
err->emplace_back(rawId, ww, error, fedId);
err->push_back(pixelgpudetails::error_obj{rawId, ww, error, fedId});
if(debug) printf("BPIX1 Error status: %i\n", error);
continue;
}
Expand All @@ -491,7 +491,7 @@ namespace pixelgpudetails {
localPix.col = col;
if (includeErrors and not dcolIsValid(dcol, pxid)) {
uint32_t error = conversionError(fedId, 3, debug);
err->emplace_back(rawId, ww, error, fedId);
err->push_back(pixelgpudetails::error_obj{rawId, ww, error, fedId});
if(debug) printf("Error status: %i %d %d %d %d\n", error, dcol, pxid, fedId, roc);
continue;
}
Expand Down Expand Up @@ -541,7 +541,7 @@ namespace pixelgpudetails {
auto data_d = cs->make_device_unique<pixelgpudetails::error_obj[]>(MAX_FED_WORDS, stream);
cudaCheck(cudaMemsetAsync(data_d.get(), 0x00, MAX_ERROR_SIZE, stream.id()));
auto error_h_tmp = cs->make_host_unique<GPU::SimpleVector<pixelgpudetails::error_obj>>(stream);
new (error_h_tmp.get()) GPU::SimpleVector<pixelgpudetails::error_obj>(MAX_FED_WORDS, data_d.get()); // should make_host_unique() call the constructor as well? note that even if std::make_unique does that, we can't do that in make_device_unique
GPU::make_SimpleVector(error_h_tmp.get(), MAX_FED_WORDS, data_d.get());
assert(error_h_tmp->size() == 0);
assert(error_h_tmp->capacity() == static_cast<int>(MAX_FED_WORDS));

Expand Down Expand Up @@ -579,7 +579,7 @@ namespace pixelgpudetails {
if (includeErrors) {
digis_clusters_h.data = cs->make_host_unique<pixelgpudetails::error_obj[]>(MAX_FED_WORDS, stream);
digis_clusters_h.error = cs->make_host_unique<GPU::SimpleVector<pixelgpudetails::error_obj>>(stream);
new (digis_clusters_h.error.get()) GPU::SimpleVector<pixelgpudetails::error_obj>(MAX_FED_WORDS, digis_clusters_h.data.get());
GPU::make_SimpleVector(digis_clusters_h.error.get(), MAX_FED_WORDS, digis_clusters_h.data.get());
assert(digis_clusters_h.error->size() == 0);
assert(digis_clusters_h.error->capacity() == static_cast<int>(MAX_FED_WORDS));

Expand Down

0 comments on commit 6f23b9c

Please sign in to comment.