Skip to content

Commit

Permalink
Adjusted LST to use LSTCore
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed May 29, 2024
1 parent 4ab60f2 commit 8ced0f1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 31 deletions.
5 changes: 3 additions & 2 deletions RecoTracker/LST/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<use name="DataFormats/Common"/>
<use name="alpaka"/>
<use name="lst_headers"/>
<use name="DataFormats/TrackerRecHit2D"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<flags ALPAKA_BACKENDS="cuda serial"/>
<use name="RecoTracker/LSTCore"/>
<flags CXXFLAGS="-DLST_IS_CMSSW_PACKAGE"/>
<flags ALPAKA_BACKENDS="1"/>
<export>
<lib name="1"/>
</export>
21 changes: 5 additions & 16 deletions RecoTracker/LST/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<use name="MagneticField/Engine"/>
<use name="MagneticField/Records"/>
<use name="RecoTracker/LST"/>
<use name="RecoTracker/LSTCore"/>
<use name="RecoTracker/TkSeedingLayers"/>
<use name="RecoTracker/TkSeedGenerator"/>
<use name="RecoTracker/Record"/>
Expand All @@ -24,30 +25,18 @@
</library>

<!-- alpaka-based portable plugins -->
<library file="alpaka/*.cc" name="RecoTrackerLSTPluginsPortableCpu">
<library file="alpaka/*.cc" name="RecoTrackerLSTPluginsPortable">
<use name="alpaka"/>
<use name="lst_cpu"/>
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Utilities"/>
<use name="HeterogeneousCore/AlpakaCore"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<use name="RecoTracker/LST"/>
<use name="RecoTracker/LSTCore"/>
<use name="RecoTracker/Record"/>
<flags ALPAKA_BACKENDS="serial"/>
<flags CXXFLAGS="-DLST_IS_CMSSW_PACKAGE"/>
<flags ALPAKA_BACKENDS="1"/>
<flags EDM_PLUGIN="1"/>
</library>

<library file="alpaka/*.cc" name="RecoTrackerLSTPluginsPortableCuda">
<use name="alpaka"/>
<use name="lst_cuda"/>
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Utilities"/>
<use name="HeterogeneousCore/AlpakaCore"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<use name="RecoTracker/LST"/>
<use name="RecoTracker/Record"/>
<flags ALPAKA_BACKENDS="cuda"/>
<flags EDM_PLUGIN="1"/>
</library>
22 changes: 12 additions & 10 deletions RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,43 @@
#include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"

// LST includes
#include <SDL/Module.h>
#include <SDL/ModuleMethods.h>
#include <SDL/LST.h>
#include "RecoTracker/LSTCore/interface/alpaka/Module.h"
#include "RecoTracker/LSTCore/interface/alpaka/LST.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {

class LSTModulesDevESProducer : public ESProducer {
public:
LSTModulesDevESProducer(const edm::ParameterSet &iConfig);
LSTModulesDevESProducer(const edm::ParameterSet& iConfig);

static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

std::unique_ptr<SDL::LSTESHostData<SDL::Dev>> produceHost(TrackerRecoGeometryRecord const& iRecord);
std::unique_ptr<SDL::LSTESDeviceData<SDL::Dev>> produceDevice(device::Record<TrackerRecoGeometryRecord> const& iRecord);
std::unique_ptr<SDL::LSTESDeviceData<SDL::Dev>> produceDevice(
device::Record<TrackerRecoGeometryRecord> const& iRecord);

private:
edm::ESGetToken<SDL::LSTESHostData<SDL::Dev>, TrackerRecoGeometryRecord> lstESHostToken_;
};

LSTModulesDevESProducer::LSTModulesDevESProducer(const edm::ParameterSet &iConfig) : ESProducer(iConfig) {
LSTModulesDevESProducer::LSTModulesDevESProducer(const edm::ParameterSet& iConfig) : ESProducer(iConfig) {
setWhatProduced(this, &LSTModulesDevESProducer::produceHost);
auto cc = setWhatProduced(this, &LSTModulesDevESProducer::produceDevice);
lstESHostToken_ = cc.consumes();
}

void LSTModulesDevESProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
void LSTModulesDevESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
descriptions.addWithDefaultLabel(desc);
}

std::unique_ptr<SDL::LSTESHostData<SDL::Dev>> LSTModulesDevESProducer::produceHost(TrackerRecoGeometryRecord const& iRecord) {
std::unique_ptr<SDL::LSTESHostData<SDL::Dev>> LSTModulesDevESProducer::produceHost(
TrackerRecoGeometryRecord const& iRecord) {
return SDL::loadAndFillESHost();
}

std::unique_ptr<SDL::LSTESDeviceData<SDL::Dev>> LSTModulesDevESProducer::produceDevice(device::Record<TrackerRecoGeometryRecord> const& iRecord) {
std::unique_ptr<SDL::LSTESDeviceData<SDL::Dev>> LSTModulesDevESProducer::produceDevice(
device::Record<TrackerRecoGeometryRecord> const& iRecord) {
auto const& lstESHostData = iRecord.get(lstESHostToken_);
SDL::QueueAcc& queue = iRecord.queue();
return SDL::loadAndFillESDevice(queue, &lstESHostData);
Expand Down
2 changes: 1 addition & 1 deletion 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 <SDL/LST.h>
#include "RecoTracker/LSTCore/interface/alpaka/LST.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {

Expand Down
4 changes: 2 additions & 2 deletions RecoTracker/LST/src/alpaka/ES_ModulesDev.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <SDL/LST.h>
#include "RecoTracker/LSTCore/interface/alpaka/LST.h"
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/typelookup.h"

// Temporary hack: The DevHost instantiation is needed in both CPU and GPU plugins,
Expand All @@ -7,4 +7,4 @@ TYPELOOKUP_DATA_REG(SDL::LSTESHostData<SDL::Dev>);
TYPELOOKUP_DATA_REG(SDL::LSTESDeviceData<SDL::DevHost>);
TYPELOOKUP_DATA_REG(ALPAKA_ACCELERATOR_NAMESPACE::ESDeviceProduct<std::unique_ptr<SDL::LSTESHostData<SDL::Dev>>>);
TYPELOOKUP_ALPAKA_TEMPLATED_DATA_REG(SDL::LSTESHostData);
TYPELOOKUP_ALPAKA_TEMPLATED_DATA_REG(SDL::LSTESDeviceData);
TYPELOOKUP_ALPAKA_TEMPLATED_DATA_REG(SDL::LSTESDeviceData);

0 comments on commit 8ced0f1

Please sign in to comment.