Skip to content

Commit

Permalink
Merge pull request #79 from SegmentLinking/CMSSW_14_1_0_pre3_LST_X_LS…
Browse files Browse the repository at this point in the history
…TCore_realfiles_batch5

Batch 5 for updates to LST integration in cms-sw
  • Loading branch information
slava77 authored Aug 17, 2024
2 parents 77854d9 + fe0d0ac commit ff27cf3
Show file tree
Hide file tree
Showing 41 changed files with 3,291 additions and 3,502 deletions.
19 changes: 8 additions & 11 deletions RecoTracker/LST/interface/LSTOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@
class LSTOutput {
public:
LSTOutput() = default;
LSTOutput(std::vector<std::vector<unsigned int>> const& hitIdx,
std::vector<unsigned int> const& len,
std::vector<int> const& seedIdx,
std::vector<short> const& trackCandidateType) {
hitIdx_ = std::move(hitIdx);
len_ = std::move(len);
seedIdx_ = std::move(seedIdx);
trackCandidateType_ = std::move(trackCandidateType);
}

~LSTOutput() = default;
LSTOutput(std::vector<std::vector<unsigned int>> const hitIdx,
std::vector<unsigned int> const len,
std::vector<int> const seedIdx,
std::vector<short> const trackCandidateType)
: hitIdx_(std::move(hitIdx)),
len_(std::move(len)),
seedIdx_(std::move(seedIdx)),
trackCandidateType_(std::move(trackCandidateType)) {}

enum LSTTCType { T5 = 4, pT3 = 5, pT5 = 7, pLS = 8 };

Expand Down
19 changes: 6 additions & 13 deletions RecoTracker/LST/interface/LSTPhase2OTHitsInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,12 @@
class LSTPhase2OTHitsInput {
public:
LSTPhase2OTHitsInput() = default;
LSTPhase2OTHitsInput(std::vector<unsigned int> const& detId,
std::vector<float> const& x,
std::vector<float> const& y,
std::vector<float> const& z,
std::vector<TrackingRecHit const*> const& hits) {
detId_ = std::move(detId);
x_ = std::move(x);
y_ = std::move(y);
z_ = std::move(z);
hits_ = std::move(hits);
}

~LSTPhase2OTHitsInput() = default;
LSTPhase2OTHitsInput(std::vector<unsigned int> const detId,
std::vector<float> const x,
std::vector<float> const y,
std::vector<float> const z,
std::vector<TrackingRecHit const*> const hits)
: detId_(std::move(detId)), x_(std::move(x)), y_(std::move(y)), z_(std::move(z)), hits_(std::move(hits)) {}

std::vector<unsigned int> const& detId() const { return detId_; }
std::vector<float> const& x() const { return x_; }
Expand Down
63 changes: 30 additions & 33 deletions RecoTracker/LST/interface/LSTPixelSeedInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,36 @@
class LSTPixelSeedInput {
public:
LSTPixelSeedInput() = default;
LSTPixelSeedInput(std::vector<float> const& px,
std::vector<float> const& py,
std::vector<float> const& pz,
std::vector<float> const& dxy,
std::vector<float> const& dz,
std::vector<float> const& ptErr,
std::vector<float> const& etaErr,
std::vector<float> const& stateTrajGlbX,
std::vector<float> const& stateTrajGlbY,
std::vector<float> const& stateTrajGlbZ,
std::vector<float> const& stateTrajGlbPx,
std::vector<float> const& stateTrajGlbPy,
std::vector<float> const& stateTrajGlbPz,
std::vector<int> const& q,
std::vector<std::vector<int>> const& hitIdx) {
px_ = std::move(px);
py_ = std::move(py);
pz_ = std::move(pz);
dxy_ = std::move(dxy);
dz_ = std::move(dz);
ptErr_ = std::move(ptErr);
etaErr_ = std::move(etaErr);
stateTrajGlbX_ = std::move(stateTrajGlbX);
stateTrajGlbY_ = std::move(stateTrajGlbY);
stateTrajGlbZ_ = std::move(stateTrajGlbZ);
stateTrajGlbPx_ = std::move(stateTrajGlbPx);
stateTrajGlbPy_ = std::move(stateTrajGlbPy);
stateTrajGlbPz_ = std::move(stateTrajGlbPz);
q_ = std::move(q);
hitIdx_ = std::move(hitIdx);
}

~LSTPixelSeedInput() = default;
LSTPixelSeedInput(std::vector<float> const px,
std::vector<float> const py,
std::vector<float> const pz,
std::vector<float> const dxy,
std::vector<float> const dz,
std::vector<float> const ptErr,
std::vector<float> const etaErr,
std::vector<float> const stateTrajGlbX,
std::vector<float> const stateTrajGlbY,
std::vector<float> const stateTrajGlbZ,
std::vector<float> const stateTrajGlbPx,
std::vector<float> const stateTrajGlbPy,
std::vector<float> const stateTrajGlbPz,
std::vector<int> const q,
std::vector<std::vector<int>> const hitIdx)
: px_(std::move(px)),
py_(std::move(py)),
pz_(std::move(pz)),
dxy_(std::move(dxy)),
dz_(std::move(dz)),
ptErr_(std::move(ptErr)),
etaErr_(std::move(etaErr)),
stateTrajGlbX_(std::move(stateTrajGlbX)),
stateTrajGlbY_(std::move(stateTrajGlbY)),
stateTrajGlbZ_(std::move(stateTrajGlbZ)),
stateTrajGlbPx_(std::move(stateTrajGlbPx)),
stateTrajGlbPy_(std::move(stateTrajGlbPy)),
stateTrajGlbPz_(std::move(stateTrajGlbPz)),
q_(std::move(q)),
hitIdx_(std::move(hitIdx)) {}

std::vector<float> const& px() const { return px_; }
std::vector<float> const& py() const { return py_; }
Expand Down
6 changes: 3 additions & 3 deletions RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// LST includes
#include "RecoTracker/LSTCore/interface/Module.h"
#include "RecoTracker/LSTCore/interface/LST.h"
#include "RecoTracker/LSTCore/interface/alpaka/LST.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {

Expand All @@ -22,8 +22,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
descriptions.addWithDefaultLabel(desc);
}

std::unique_ptr<lst::LSTESData<DevHost>> produce(TrackerRecoGeometryRecord const& iRecord) {
return lst::loadAndFillESHost();
std::unique_ptr<::lst::LSTESData<DevHost>> produce(TrackerRecoGeometryRecord const& iRecord) {
return ::lst::loadAndFillESHost();
}
};

Expand Down
6 changes: 3 additions & 3 deletions RecoTracker/LST/plugins/alpaka/LSTProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"

#include "RecoTracker/LSTCore/interface/LST.h"
#include "RecoTracker/LSTCore/interface/alpaka/LST.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {

Expand Down Expand Up @@ -87,11 +87,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
private:
edm::EDGetTokenT<LSTPixelSeedInput> lstPixelSeedInputToken_;
edm::EDGetTokenT<LSTPhase2OTHitsInput> lstPhase2OTHitsInputToken_;
device::ESGetToken<lst::LSTESData<Device>, TrackerRecoGeometryRecord> lstESToken_;
device::ESGetToken<::lst::LSTESData<Device>, TrackerRecoGeometryRecord> lstESToken_;
const bool verbose_, nopLSDupClean_, tcpLSTriplets_;
edm::EDPutTokenT<LSTOutput> lstOutputToken_;

lst::LST<Acc3D> lst_;
lst::LST lst_;
};

} // namespace ALPAKA_ACCELERATOR_NAMESPACE
Expand Down
16 changes: 7 additions & 9 deletions RecoTracker/LSTCore/interface/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,21 @@ namespace lst {
using Buf = alpaka::Buf<TDev, TData, alpaka_common::Dim1D, alpaka_common::Idx>;

// Allocation wrapper function to make integration of the caching allocator easier and reduce code boilerplate.
template <typename T, typename TAcc, typename TSize, typename TQueue>
ALPAKA_FN_HOST ALPAKA_FN_INLINE Buf<alpaka::Dev<TAcc>, T> allocBufWrapper(TAcc const& devAccIn,
TSize nElements,
TQueue queue) {
template <typename T, typename TDev, typename TSize, typename TQueue>
ALPAKA_FN_HOST ALPAKA_FN_INLINE Buf<TDev, T> allocBufWrapper(TDev const& dev, TSize nElements, TQueue queue) {
#ifdef CACHE_ALLOC
return cms::alpakatools::allocCachedBuf<T, alpaka_common::Idx>(
devAccIn, queue, alpaka_common::Vec1D(static_cast<alpaka_common::Idx>(nElements)));
dev, queue, alpaka_common::Vec1D(static_cast<alpaka_common::Idx>(nElements)));
#else
return alpaka::allocBuf<T, alpaka_common::Idx>(devAccIn,
return alpaka::allocBuf<T, alpaka_common::Idx>(dev,
alpaka_common::Vec1D(static_cast<alpaka_common::Idx>(nElements)));
#endif
}

// Second allocation wrapper function when queue is not given. Reduces code boilerplate.
template <typename T, typename TAcc, typename TSize>
ALPAKA_FN_HOST ALPAKA_FN_INLINE Buf<alpaka::Dev<TAcc>, T> allocBufWrapper(TAcc const& devAccIn, TSize nElements) {
return alpaka::allocBuf<T, alpaka_common::Idx>(devAccIn,
template <typename T, typename TDev, typename TSize>
ALPAKA_FN_HOST ALPAKA_FN_INLINE Buf<TDev, T> allocBufWrapper(TDev const& dev, TSize nElements) {
return alpaka::allocBuf<T, alpaka_common::Idx>(dev,
alpaka_common::Vec1D(static_cast<alpaka_common::Idx>(nElements)));
}

Expand Down
1 change: 0 additions & 1 deletion RecoTracker/LSTCore/interface/EndcapGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace lst {

EndcapGeometry() = default;
EndcapGeometry(std::string const& filename);
~EndcapGeometry() = default;

void load(std::string const&);
void fillGeoMapArraysExplicit();
Expand Down
4 changes: 2 additions & 2 deletions RecoTracker/LSTCore/interface/EndcapGeometryBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ namespace lst {

template <typename TBuff>
void setData(TBuff const& buf) {
geoMapDetId = alpaka::getPtrNative(buf.geoMapDetId_buf);
geoMapPhi = alpaka::getPtrNative(buf.geoMapPhi_buf);
geoMapDetId = buf.geoMapDetId_buf.data();
geoMapPhi = buf.geoMapPhi_buf.data();
}
};

Expand Down
112 changes: 0 additions & 112 deletions RecoTracker/LSTCore/interface/LST.h

This file was deleted.

22 changes: 11 additions & 11 deletions RecoTracker/LSTCore/interface/LSTESData.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ namespace lst {
uint16_t nLowerModules;
unsigned int nPixels;
unsigned int nEndCapMap;
std::shared_ptr<const ModulesBuffer<TDev>> modulesBuffers;
std::shared_ptr<const EndcapGeometryBuffer<TDev>> endcapGeometryBuffers;
ModulesBuffer<TDev> modulesBuffers;
EndcapGeometryBuffer<TDev> endcapGeometryBuffers;
std::shared_ptr<const PixelMap> pixelMapping;

LSTESData(uint16_t const& nModulesIn,
uint16_t const& nLowerModulesIn,
unsigned int const& nPixelsIn,
unsigned int const& nEndCapMapIn,
std::shared_ptr<const ModulesBuffer<TDev>> const& modulesBuffersIn,
std::shared_ptr<const EndcapGeometryBuffer<TDev>> const& endcapGeometryBuffersIn,
ModulesBuffer<TDev> const& modulesBuffersIn,
EndcapGeometryBuffer<TDev> const& endcapGeometryBuffersIn,
std::shared_ptr<const PixelMap> const& pixelMappingIn)
: nModules(nModulesIn),
nLowerModules(nLowerModulesIn),
Expand All @@ -49,19 +49,19 @@ namespace cms::alpakatools {
template <typename TQueue>
static lst::LSTESData<alpaka::Dev<TQueue>> copyAsync(TQueue& queue,
lst::LSTESData<alpaka_common::DevHost> const& srcData) {
auto deviceModulesBuffers = std::make_shared<lst::ModulesBuffer<alpaka::Dev<TQueue>>>(
alpaka::getDev(queue), srcData.nModules, srcData.nPixels);
deviceModulesBuffers->copyFromSrc(queue, *srcData.modulesBuffers);
auto deviceModulesBuffers =
lst::ModulesBuffer<alpaka::Dev<TQueue>>(alpaka::getDev(queue), srcData.nModules, srcData.nPixels);
deviceModulesBuffers.copyFromSrc(queue, srcData.modulesBuffers);
auto deviceEndcapGeometryBuffers =
std::make_shared<lst::EndcapGeometryBuffer<alpaka::Dev<TQueue>>>(alpaka::getDev(queue), srcData.nEndCapMap);
deviceEndcapGeometryBuffers->copyFromSrc(queue, *srcData.endcapGeometryBuffers);
lst::EndcapGeometryBuffer<alpaka::Dev<TQueue>>(alpaka::getDev(queue), srcData.nEndCapMap);
deviceEndcapGeometryBuffers.copyFromSrc(queue, srcData.endcapGeometryBuffers);

return lst::LSTESData<alpaka::Dev<TQueue>>(srcData.nModules,
srcData.nLowerModules,
srcData.nPixels,
srcData.nEndCapMap,
deviceModulesBuffers,
deviceEndcapGeometryBuffers,
std::move(deviceModulesBuffers),
std::move(deviceEndcapGeometryBuffers),
srcData.pixelMapping);
}
};
Expand Down
Loading

0 comments on commit ff27cf3

Please sign in to comment.