Skip to content

Commit

Permalink
Merge pull request #36607 from AdrianoDee/fix_phase2_patatrack
Browse files Browse the repository at this point in the history
Fixing Phase-II Patatrack Failures
  • Loading branch information
cmsbuild authored Jan 10, 2022
2 parents 365e99a + 5179447 commit 3eb7dae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
18 changes: 13 additions & 5 deletions CUDADataFormats/TrackingRecHit/test/TrackingRecHit2DCUDA_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "HeterogeneousCore/CUDAUtilities/interface/copyAsync.h"
#include "HeterogeneousCore/CUDAUtilities/interface/requireDevices.h"
#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h"
#include "Geometry/TrackerGeometryBuilder/interface/pixelTopology.h"

namespace testTrackingRecHit2D {

Expand All @@ -16,18 +17,25 @@ int main() {
cudaCheck(cudaStreamCreateWithFlags(&stream, cudaStreamNonBlocking));

auto nHits = 200;
auto nModules = 2000;
// inner scope to deallocate memory before destroying the stream
{
TrackingRecHit2DGPU tkhit(nHits, nModules, 0, nullptr, nullptr, stream);

TrackingRecHit2DGPU tkhit(nHits, false, 0, nullptr, nullptr, stream);
testTrackingRecHit2D::runKernels(tkhit.view());

TrackingRecHit2DHost tkhitH(nHits, nModules, 0, nullptr, nullptr, stream, &tkhit);
TrackingRecHit2DGPU tkhitPhase2(nHits, true, 0, nullptr, nullptr, stream);
testTrackingRecHit2D::runKernels(tkhitPhase2.view());

TrackingRecHit2DHost tkhitH(nHits, false, 0, nullptr, nullptr, stream, &tkhit);
cudaStreamSynchronize(stream);
assert(tkhitH.view());
assert(tkhitH.view()->nHits() == unsigned(nHits));
assert(tkhitH.view()->nMaxModules() == unsigned(nModules));
assert(tkhitH.view()->nMaxModules() == phase1PixelTopology::numberOfModules);

TrackingRecHit2DHost tkhitHPhase2(nHits, true, 0, nullptr, nullptr, stream, &tkhit);
cudaStreamSynchronize(stream);
assert(tkhitHPhase2.view());
assert(tkhitHPhase2.view()->nHits() == unsigned(nHits));
assert(tkhitHPhase2.view()->nMaxModules() == phase2PixelTopology::numberOfModules);
}

cudaCheck(cudaStreamDestroy(stream));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class SiPixelPhase2DigiToClusterCUDA : public edm::stream::EDProducer<edm::Exter
edm::WaitingTaskWithArenaHolder waitingTaskHolder) override;
void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;

const edm::EDGetTokenT<edm::DetSetVector<PixelDigi>> pixelDigiToken_;
const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
const edm::EDGetTokenT<edm::DetSetVector<PixelDigi>> pixelDigiToken_;

edm::EDPutTokenT<cms::cuda::Product<SiPixelDigisCUDA>> digiPutToken_;
edm::EDPutTokenT<cms::cuda::Product<SiPixelDigiErrorsCUDA>> digiErrorPutToken_;
Expand All @@ -71,7 +71,8 @@ class SiPixelPhase2DigiToClusterCUDA : public edm::stream::EDProducer<edm::Exter
};

SiPixelPhase2DigiToClusterCUDA::SiPixelPhase2DigiToClusterCUDA(const edm::ParameterSet& iConfig)
: pixelDigiToken_(consumes<edm::DetSetVector<PixelDigi>>(iConfig.getParameter<edm::InputTag>("InputDigis"))),
: geomToken_(esConsumes()),
pixelDigiToken_(consumes<edm::DetSetVector<PixelDigi>>(iConfig.getParameter<edm::InputTag>("InputDigis"))),
digiPutToken_(produces<cms::cuda::Product<SiPixelDigisCUDA>>()),
clusterPutToken_(produces<cms::cuda::Product<SiPixelClustersCUDA>>()),
includeErrors_(iConfig.getParameter<bool>("IncludeErrors")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ namespace gpuCalibPixel {
if (invalidModuleId == id[i])
continue;

printf("%d %d %d \n", id[i], adc[i]);
constexpr int mode = (Phase2ReadoutMode < -1 ? -1 : Phase2ReadoutMode);

if constexpr (mode < 0)
Expand Down

0 comments on commit 3eb7dae

Please sign in to comment.