Skip to content

Commit

Permalink
Merge pull request #58 from SegmentLinking/remove_LST_IS_CMSSW_PACKAGE
Browse files Browse the repository at this point in the history
combo of: Remove LST_IS_CMSSW_PACKAGE (#47), configurable dup cleaning (#37), typo in T3 code (#44)
  • Loading branch information
slava77 authored Jul 5, 2024
2 parents a97714a + dc13ac5 commit 4d7e54a
Show file tree
Hide file tree
Showing 32 changed files with 91 additions and 186 deletions.
14 changes: 10 additions & 4 deletions RecoTracker/LST/plugins/alpaka/LSTProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
lstPhase2OTHitsInputToken_{
consumes<LSTPhase2OTHitsInput>(config.getParameter<edm::InputTag>("phase2OTHitsInput"))},
lstESToken_{esConsumes()},
verbose_(config.getParameter<int>("verbose")),
verbose_(config.getParameter<bool>("verbose")),
nopLSDupClean_(config.getParameter<bool>("nopLSDupClean")),
tcpLSTriplets_(config.getParameter<bool>("tcpLSTriplets")),
lstOutputToken_{produces()} {}

void acquire(device::Event const& event, device::EventSetup const& setup) override {
Expand Down Expand Up @@ -61,7 +63,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
phase2OTHits.detId(),
phase2OTHits.x(),
phase2OTHits.y(),
phase2OTHits.z());
phase2OTHits.z(),
nopLSDupClean_,
tcpLSTriplets_);
}

void produce(device::Event& event, device::EventSetup const&) override {
Expand All @@ -74,15 +78,17 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("pixelSeedInput", edm::InputTag{"lstPixelSeedInputProducer"});
desc.add<edm::InputTag>("phase2OTHitsInput", edm::InputTag{"lstPhase2OTHitsInputProducer"});
desc.add<int>("verbose", 0);
desc.add<bool>("verbose", false);
desc.add<bool>("nopLSDupClean", false);
desc.add<bool>("tcpLSTriplets", false);
descriptions.addWithDefaultLabel(desc);
}

private:
edm::EDGetTokenT<LSTPixelSeedInput> lstPixelSeedInputToken_;
edm::EDGetTokenT<LSTPhase2OTHitsInput> lstPhase2OTHitsInputToken_;
device::ESGetToken<SDL::LSTESDeviceData<SDL::Dev>, TrackerRecoGeometryRecord> lstESToken_;
const int verbose_;
const bool verbose_, nopLSDupClean_, tcpLSTriplets_;
edm::EDPutTokenT<LSTOutput> lstOutputToken_;

SDL::LST<SDL::Acc> lst_;
Expand Down
2 changes: 1 addition & 1 deletion RecoTracker/LSTCore/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<use name="boost_header"/>
<use name="root"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<flags CXXFLAGS="-DLST_IS_CMSSW_PACKAGE -DCACHE_ALLOC -DT4FromT3 -DUSE_RZCHI2 -DUSE_T5_DNN -DPT_CUT=0.8 -DDUP_pLS -DDUP_T5 -DDUP_pT5 -DDUP_pT3 -DCrossclean_T5 -DCrossclean_pT3 -Wshadow"/>
<flags CXXFLAGS="-DCACHE_ALLOC -DT4FromT3 -DUSE_RZCHI2 -DUSE_T5_DNN -DPT_CUT=0.8 -DDUP_pLS -DDUP_T5 -DDUP_pT5 -DDUP_pT3 -DCrossclean_T5 -DCrossclean_pT3 -Wshadow"/>
<flags ALPAKA_BACKENDS="1"/>
<export>
<lib name="1"/>
Expand Down
9 changes: 3 additions & 6 deletions RecoTracker/LSTCore/interface/alpaka/LST.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#ifndef LST_H
#define LST_H

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/LSTESData.h"
#else
#include "Constants.h"
#include "LSTESData.h"
#endif

#include <cstdlib>
#include <numeric>
Expand Down Expand Up @@ -47,7 +42,9 @@ namespace SDL {
const std::vector<unsigned int> ph2_detId,
const std::vector<float> ph2_x,
const std::vector<float> ph2_y,
const std::vector<float> ph2_z);
const std::vector<float> ph2_z,
bool no_pls_dupclean,
bool tc_pls_triplets);
std::vector<std::vector<unsigned int>> hits() { return out_tc_hitIdxs_; }
std::vector<unsigned int> len() { return out_tc_len_; }
std::vector<int> seedIdx() { return out_tc_seedIdx_; }
Expand Down
4 changes: 0 additions & 4 deletions RecoTracker/LSTCore/interface/alpaka/LSTESData.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#ifndef LSTESData_H
#define LSTESData_H

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#else
#include "Constants.h"
#endif

#include "HeterogeneousCore/AlpakaInterface/interface/CopyToDevice.h"

Expand Down
4 changes: 0 additions & 4 deletions RecoTracker/LSTCore/interface/alpaka/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@

#include <alpaka/alpaka.hpp>

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#else
#include "Constants.h"
#endif

namespace SDL {
enum SubDet { InnerPixel = 0, Barrel = 5, Endcap = 4 };
Expand Down
4 changes: 0 additions & 4 deletions RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
#include <vector>
#include <stdexcept>

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#else
#include "Constants.h"
#endif

#include "HeterogeneousCore/AlpakaInterface/interface/host.h"

Expand Down
49 changes: 25 additions & 24 deletions RecoTracker/LSTCore/src/alpaka/Event.dev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void SDL::Event<SDL::Acc>::createTriplets() {
}
}

void SDL::Event<SDL::Acc>::createTrackCandidates() {
void SDL::Event<SDL::Acc>::createTrackCandidates(bool no_pls_dupclean, bool tc_pls_triplets) {
if (trackCandidatesInGPU == nullptr) {
trackCandidatesInGPU = new SDL::trackCandidates();
trackCandidatesBuffers = new SDL::trackCandidatesBuffer<Dev>(
Expand Down Expand Up @@ -709,18 +709,18 @@ void SDL::Event<SDL::Acc>::createTrackCandidates() {

alpaka::enqueue(queue, addT5asTrackCandidateInGPUTask);

#ifndef NOPLSDUPCLEAN
Vec const threadsPerBlockCheckHitspLS = createVec(1, 16, 16);
Vec const blocksPerGridCheckHitspLS = createVec(1, MAX_BLOCKS * 4, MAX_BLOCKS / 4);
WorkDiv const checkHitspLS_workDiv =
createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread);
if (!no_pls_dupclean) {
Vec const threadsPerBlockCheckHitspLS = createVec(1, 16, 16);
Vec const blocksPerGridCheckHitspLS = createVec(1, MAX_BLOCKS * 4, MAX_BLOCKS / 4);
WorkDiv const checkHitspLS_workDiv =
createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread);

SDL::checkHitspLS checkHitspLS_kernel;
auto const checkHitspLSTask(alpaka::createTaskKernel<Acc>(
checkHitspLS_workDiv, checkHitspLS_kernel, *modulesBuffers_->data(), *segmentsInGPU, true));
SDL::checkHitspLS checkHitspLS_kernel;
auto const checkHitspLSTask(alpaka::createTaskKernel<Acc>(
checkHitspLS_workDiv, checkHitspLS_kernel, *modulesBuffers_->data(), *segmentsInGPU, true));

alpaka::enqueue(queue, checkHitspLSTask);
#endif
alpaka::enqueue(queue, checkHitspLSTask);
}

Vec const threadsPerBlock_crossCleanpLS = createVec(1, 16, 32);
Vec const blocksPerGrid_crossCleanpLS = createVec(1, 4, 20);
Expand Down Expand Up @@ -751,7 +751,8 @@ void SDL::Event<SDL::Acc>::createTrackCandidates() {
addpLSasTrackCandidateInGPU_kernel,
nLowerModules_,
*trackCandidatesInGPU,
*segmentsInGPU));
*segmentsInGPU,
tc_pls_triplets));

alpaka::enqueue(queue, addpLSasTrackCandidateInGPUTask);

Expand Down Expand Up @@ -990,20 +991,20 @@ void SDL::Event<SDL::Acc>::createQuintuplets() {
}
}

void SDL::Event<SDL::Acc>::pixelLineSegmentCleaning() {
#ifndef NOPLSDUPCLEAN
Vec const threadsPerBlockCheckHitspLS = createVec(1, 16, 16);
Vec const blocksPerGridCheckHitspLS = createVec(1, MAX_BLOCKS * 4, MAX_BLOCKS / 4);
WorkDiv const checkHitspLS_workDiv =
createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread);
void SDL::Event<SDL::Acc>::pixelLineSegmentCleaning(bool no_pls_dupclean) {
if (!no_pls_dupclean) {
Vec const threadsPerBlockCheckHitspLS = createVec(1, 16, 16);
Vec const blocksPerGridCheckHitspLS = createVec(1, MAX_BLOCKS * 4, MAX_BLOCKS / 4);
WorkDiv const checkHitspLS_workDiv =
createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread);

SDL::checkHitspLS checkHitspLS_kernel;
auto const checkHitspLSTask(alpaka::createTaskKernel<Acc>(
checkHitspLS_workDiv, checkHitspLS_kernel, *modulesBuffers_->data(), *segmentsInGPU, false));
SDL::checkHitspLS checkHitspLS_kernel;
auto const checkHitspLSTask(alpaka::createTaskKernel<Acc>(
checkHitspLS_workDiv, checkHitspLS_kernel, *modulesBuffers_->data(), *segmentsInGPU, false));

alpaka::enqueue(queue, checkHitspLSTask);
alpaka::wait(queue);
#endif
alpaka::enqueue(queue, checkHitspLSTask);
alpaka::wait(queue);
}
}

void SDL::Event<SDL::Acc>::createPixelQuintuplets() {
Expand Down
10 changes: 2 additions & 8 deletions RecoTracker/LSTCore/src/alpaka/Event.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
#ifndef Event_cuh
#define Event_cuh

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#include "RecoTracker/LSTCore/interface/alpaka/LST.h"
#else
#include "Constants.h"
#include "Module.h"
#include "LST.h"
#endif

#include "Hit.h"
#include "ModuleMethods.h"
Expand Down Expand Up @@ -148,12 +142,12 @@ namespace SDL {
void createTriplets();
void createPixelTracklets();
void createPixelTrackletsWithMap();
void createTrackCandidates();
void createTrackCandidates(bool no_pls_dupclean, bool tc_pls_triplets);
void createExtendedTracks();
void createQuintuplets();
void createPixelTriplets();
void createPixelQuintuplets();
void pixelLineSegmentCleaning();
void pixelLineSegmentCleaning(bool no_pls_dupclean);

unsigned int getNumberOfHits();
unsigned int getNumberOfHitsByLayer(unsigned int layer);
Expand Down
5 changes: 0 additions & 5 deletions RecoTracker/LSTCore/src/alpaka/Hit.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#ifndef Hit_cuh
#define Hit_cuh

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#else
#include "Constants.h"
#include "Module.h"
#endif

namespace SDL {
struct hits {
Expand Down
5 changes: 0 additions & 5 deletions RecoTracker/LSTCore/src/alpaka/Kernels.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#ifndef Kernels_cuh
#define Kernels_cuh

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#else
#include "Constants.h"
#include "Module.h"
#endif

#include "Hit.h"
#include "MiniDoublet.h"
Expand Down
12 changes: 5 additions & 7 deletions RecoTracker/LSTCore/src/alpaka/LST.dev.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/LST.h"
#else
#include "LST.h"
#endif

#include "Event.h"

Expand Down Expand Up @@ -30,7 +26,9 @@ void SDL::LST<SDL::Acc>::run(SDL::QueueAcc& queue,
const std::vector<unsigned int> ph2_detId,
const std::vector<float> ph2_x,
const std::vector<float> ph2_y,
const std::vector<float> ph2_z) {
const std::vector<float> ph2_z,
bool no_pls_dupclean,
bool tc_pls_triplets) {
auto event = SDL::Event<Acc>(verbose, queue, deviceESData);
prepareInput(see_px,
see_py,
Expand Down Expand Up @@ -135,7 +133,7 @@ void SDL::LST<SDL::Acc>::run(SDL::QueueAcc& queue,
printf("# of Quintuplets produced endcap layer 5: %d\n", event.getNumberOfQuintupletsByLayerEndcap(4));
}

event.pixelLineSegmentCleaning();
event.pixelLineSegmentCleaning(no_pls_dupclean);

event.createPixelQuintuplets();
if (verbose)
Expand All @@ -145,7 +143,7 @@ void SDL::LST<SDL::Acc>::run(SDL::QueueAcc& queue,
if (verbose)
printf("# of Pixel T3s produced: %d\n", event.getNumberOfPixelTriplets());

event.createTrackCandidates();
event.createTrackCandidates(no_pls_dupclean, tc_pls_triplets);
if (verbose) {
printf("# of TrackCandidates produced: %d\n", event.getNumberOfTrackCandidates());
printf(" # of Pixel TrackCandidates produced: %d\n", event.getNumberOfPixelTrackCandidates());
Expand Down
4 changes: 0 additions & 4 deletions RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/LSTESData.h"
#else
#include "LSTESData.h"
#endif

#include "EndcapGeometry.h"
#include "ModuleConnectionMap.h"
Expand Down
5 changes: 0 additions & 5 deletions RecoTracker/LSTCore/src/alpaka/MiniDoublet.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#ifndef MiniDoublet_cuh
#define MiniDoublet_cuh

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#else
#include "Constants.h"
#include "Module.h"
#endif

#include "EndcapGeometry.h"
#include "Hit.h"
Expand Down
4 changes: 0 additions & 4 deletions RecoTracker/LSTCore/src/alpaka/ModuleConnectionMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
#include <sstream>
#include <algorithm>

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#else
#include "Constants.h"
#endif

namespace SDL {
//FIXME: move to non-alpaka single arch build
Expand Down
5 changes: 0 additions & 5 deletions RecoTracker/LSTCore/src/alpaka/ModuleMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
#include <map>
#include <iostream>

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#else
#include "Constants.h"
#include "Module.h"
#endif

#include "TiltedGeometry.h"
#include "EndcapGeometry.h"
Expand Down
5 changes: 0 additions & 5 deletions RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#ifndef NeuralNetwork_cuh
#define NeuralNetwork_cuh

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#else
#include "Constants.h"
#include "Module.h"
#endif

#include "NeuralNetworkWeights.h"
#include "Segment.h"
Expand Down
4 changes: 0 additions & 4 deletions RecoTracker/LSTCore/src/alpaka/PixelMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
#include <vector>
#include <cstdint>

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#else
#include "Constants.h"
#endif

namespace SDL {
// PixelMap is never allocated on the device.
Expand Down
10 changes: 0 additions & 10 deletions RecoTracker/LSTCore/src/alpaka/PixelTriplet.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#ifndef PixelTriplet_cuh
#define PixelTriplet_cuh

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#else
#include "Constants.h"
#include "Module.h"
#endif

#include "Triplet.h"
#include "Segment.h"
Expand Down Expand Up @@ -1835,13 +1830,8 @@ namespace SDL {
#ifndef PixelQuintuplet_cuh
#define PixelQuintuplet_cuh

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#else
#include "Constants.h"
#include "Module.h"
#endif

#include "Segment.h"
#include "MiniDoublet.h"
Expand Down
Loading

0 comments on commit 4d7e54a

Please sign in to comment.