Skip to content

Commit

Permalink
Moved LST and Event classes to ALPAKA_ACCELERATOR_NAMESPACE
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed Aug 16, 2024
1 parent 4ff4aaf commit 9f6d612
Show file tree
Hide file tree
Showing 19 changed files with 734 additions and 768 deletions.
4 changes: 2 additions & 2 deletions RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions RecoTracker/LST/plugins/alpaka/LSTProducer.cc
Original file line number Diff line number Diff line change
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
184 changes: 90 additions & 94 deletions RecoTracker/LSTCore/interface/LST.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,105 +8,101 @@
#include <numeric>
#include <alpaka/alpaka.hpp>

namespace lst {
template <typename>
class Event;
namespace ALPAKA_ACCELERATOR_NAMESPACE {
namespace lst {
class Event;

template <typename>
class LST;
class LST {
public:
LST() = default;

template <typename TAcc>
class LST {
public:
LST() = default;
void run(Queue& queue,
bool verbose,
::lst::LSTESData<Device> const* deviceESData,
std::vector<float> const& see_px,
std::vector<float> const& see_py,
std::vector<float> const& see_pz,
std::vector<float> const& see_dxy,
std::vector<float> const& see_dz,
std::vector<float> const& see_ptErr,
std::vector<float> const& see_etaErr,
std::vector<float> const& see_stateTrajGlbX,
std::vector<float> const& see_stateTrajGlbY,
std::vector<float> const& see_stateTrajGlbZ,
std::vector<float> const& see_stateTrajGlbPx,
std::vector<float> const& see_stateTrajGlbPy,
std::vector<float> const& see_stateTrajGlbPz,
std::vector<int> const& see_q,
std::vector<std::vector<int>> const& see_hitIdx,
std::vector<unsigned int> const& ph2_detId,
std::vector<float> const& ph2_x,
std::vector<float> const& ph2_y,
std::vector<float> const& ph2_z,
bool no_pls_dupclean,
bool tc_pls_triplets);
std::vector<std::vector<unsigned int>> const& hits() const { return out_tc_hitIdxs_; }
std::vector<unsigned int> const& len() const { return out_tc_len_; }
std::vector<int> const& seedIdx() const { return out_tc_seedIdx_; }
std::vector<short> const& trackCandidateType() const { return out_tc_trackCandidateType_; }

template <typename TQueue>
void run(TQueue& queue,
bool verbose,
LSTESData<alpaka::Dev<TAcc>> const* deviceESData,
std::vector<float> const& see_px,
std::vector<float> const& see_py,
std::vector<float> const& see_pz,
std::vector<float> const& see_dxy,
std::vector<float> const& see_dz,
std::vector<float> const& see_ptErr,
std::vector<float> const& see_etaErr,
std::vector<float> const& see_stateTrajGlbX,
std::vector<float> const& see_stateTrajGlbY,
std::vector<float> const& see_stateTrajGlbZ,
std::vector<float> const& see_stateTrajGlbPx,
std::vector<float> const& see_stateTrajGlbPy,
std::vector<float> const& see_stateTrajGlbPz,
std::vector<int> const& see_q,
std::vector<std::vector<int>> const& see_hitIdx,
std::vector<unsigned int> const& ph2_detId,
std::vector<float> const& ph2_x,
std::vector<float> const& ph2_y,
std::vector<float> const& ph2_z,
bool no_pls_dupclean,
bool tc_pls_triplets);
std::vector<std::vector<unsigned int>> const& hits() const { return out_tc_hitIdxs_; }
std::vector<unsigned int> const& len() const { return out_tc_len_; }
std::vector<int> const& seedIdx() const { return out_tc_seedIdx_; }
std::vector<short> const& trackCandidateType() const { return out_tc_trackCandidateType_; }
private:
void prepareInput(std::vector<float> const& see_px,
std::vector<float> const& see_py,
std::vector<float> const& see_pz,
std::vector<float> const& see_dxy,
std::vector<float> const& see_dz,
std::vector<float> const& see_ptErr,
std::vector<float> const& see_etaErr,
std::vector<float> const& see_stateTrajGlbX,
std::vector<float> const& see_stateTrajGlbY,
std::vector<float> const& see_stateTrajGlbZ,
std::vector<float> const& see_stateTrajGlbPx,
std::vector<float> const& see_stateTrajGlbPy,
std::vector<float> const& see_stateTrajGlbPz,
std::vector<int> const& see_q,
std::vector<std::vector<int>> const& see_hitIdx,
std::vector<unsigned int> const& ph2_detId,
std::vector<float> const& ph2_x,
std::vector<float> const& ph2_y,
std::vector<float> const& ph2_z);

private:
void prepareInput(std::vector<float> const& see_px,
std::vector<float> const& see_py,
std::vector<float> const& see_pz,
std::vector<float> const& see_dxy,
std::vector<float> const& see_dz,
std::vector<float> const& see_ptErr,
std::vector<float> const& see_etaErr,
std::vector<float> const& see_stateTrajGlbX,
std::vector<float> const& see_stateTrajGlbY,
std::vector<float> const& see_stateTrajGlbZ,
std::vector<float> const& see_stateTrajGlbPx,
std::vector<float> const& see_stateTrajGlbPy,
std::vector<float> const& see_stateTrajGlbPz,
std::vector<int> const& see_q,
std::vector<std::vector<int>> const& see_hitIdx,
std::vector<unsigned int> const& ph2_detId,
std::vector<float> const& ph2_x,
std::vector<float> const& ph2_y,
std::vector<float> const& ph2_z);
void getOutput(Event& event);
std::vector<unsigned int> getHitIdxs(short trackCandidateType,
unsigned int TCIdx,
unsigned int const* TCHitIndices,
unsigned int const* hitIndices);

void getOutput(lst::Event<TAcc>& event);
std::vector<unsigned int> getHitIdxs(short trackCandidateType,
unsigned int TCIdx,
unsigned int const* TCHitIndices,
unsigned int const* hitIndices);
// Input and output vectors
std::vector<float> in_trkX_;
std::vector<float> in_trkY_;
std::vector<float> in_trkZ_;
std::vector<unsigned int> in_hitId_;
std::vector<unsigned int> in_hitIdxs_;
std::vector<unsigned int> in_hitIndices_vec0_;
std::vector<unsigned int> in_hitIndices_vec1_;
std::vector<unsigned int> in_hitIndices_vec2_;
std::vector<unsigned int> in_hitIndices_vec3_;
std::vector<float> in_deltaPhi_vec_;
std::vector<float> in_ptIn_vec_;
std::vector<float> in_ptErr_vec_;
std::vector<float> in_px_vec_;
std::vector<float> in_py_vec_;
std::vector<float> in_pz_vec_;
std::vector<float> in_eta_vec_;
std::vector<float> in_etaErr_vec_;
std::vector<float> in_phi_vec_;
std::vector<int> in_charge_vec_;
std::vector<unsigned int> in_seedIdx_vec_;
std::vector<int> in_superbin_vec_;
std::vector<int8_t> in_pixelType_vec_;
std::vector<char> in_isQuad_vec_;
std::vector<std::vector<unsigned int>> out_tc_hitIdxs_;
std::vector<unsigned int> out_tc_len_;
std::vector<int> out_tc_seedIdx_;
std::vector<short> out_tc_trackCandidateType_;
};

// Input and output vectors
std::vector<float> in_trkX_;
std::vector<float> in_trkY_;
std::vector<float> in_trkZ_;
std::vector<unsigned int> in_hitId_;
std::vector<unsigned int> in_hitIdxs_;
std::vector<unsigned int> in_hitIndices_vec0_;
std::vector<unsigned int> in_hitIndices_vec1_;
std::vector<unsigned int> in_hitIndices_vec2_;
std::vector<unsigned int> in_hitIndices_vec3_;
std::vector<float> in_deltaPhi_vec_;
std::vector<float> in_ptIn_vec_;
std::vector<float> in_ptErr_vec_;
std::vector<float> in_px_vec_;
std::vector<float> in_py_vec_;
std::vector<float> in_pz_vec_;
std::vector<float> in_eta_vec_;
std::vector<float> in_etaErr_vec_;
std::vector<float> in_phi_vec_;
std::vector<int> in_charge_vec_;
std::vector<unsigned int> in_seedIdx_vec_;
std::vector<int> in_superbin_vec_;
std::vector<int8_t> in_pixelType_vec_;
std::vector<char> in_isQuad_vec_;
std::vector<std::vector<unsigned int>> out_tc_hitIdxs_;
std::vector<unsigned int> out_tc_len_;
std::vector<int> out_tc_seedIdx_;
std::vector<short> out_tc_trackCandidateType_;
};

} // namespace lst
} // namespace lst
} // namespace ALPAKA_ACCELERATOR_NAMESPACE

#endif
4 changes: 2 additions & 2 deletions RecoTracker/LSTCore/interface/alpaka/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace lst {

using namespace ALPAKA_ACCELERATOR_NAMESPACE;
using namespace alpaka_common;

// Half precision wrapper functions.
#if defined(FP16_Base)
Expand Down Expand Up @@ -46,7 +46,7 @@ namespace lst {
Vec adjustedThreads = threadsPerBlock;

// special overrides for CPU/host cases
if constexpr (std::is_same_v<Platform, alpaka::PlatformCpu>) {
if constexpr (std::is_same_v<ALPAKA_ACCELERATOR_NAMESPACE::Platform, alpaka::PlatformCpu>) {
adjustedBlocks = Vec::all(static_cast<Idx>(1));

if constexpr (alpaka::accMatchesTags<TAcc, alpaka::TagCpuSerial>) {
Expand Down
Loading

0 comments on commit 9f6d612

Please sign in to comment.