CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
TestPortableTranscriber Class Reference
Inheritance diagram for TestPortableTranscriber:
edm::stream::EDProducer< edm::ExternalWork >

Public Member Functions

void acquire (edm::Event const &event, edm::EventSetup const &setup, edm::WaitingTaskWithArenaHolder task) override
 
void produce (edm::Event &event, edm::EventSetup const &) override
 
 TestPortableTranscriber (edm::ParameterSet const &config)
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::ExternalWork >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const edm::EDGetTokenT< cms::cuda::Product< cudatest::TestDeviceCollection > > deviceToken_
 
cudatest::TestHostCollection hostProduct_
 
const edm::EDPutTokenT< cudatest::TestHostCollectionhostToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::ExternalWork >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 17 of file TestPortableTranscriber.cc.

Constructor & Destructor Documentation

◆ TestPortableTranscriber()

TestPortableTranscriber::TestPortableTranscriber ( edm::ParameterSet const &  config)
inline

Definition at line 19 of file TestPortableTranscriber.cc.

20  : deviceToken_{consumes(config.getParameter<edm::InputTag>("source"))}, hostToken_{produces()} {}
Definition: config.py:1
const edm::EDGetTokenT< cms::cuda::Product< cudatest::TestDeviceCollection > > deviceToken_
const edm::EDPutTokenT< cudatest::TestHostCollection > hostToken_

Member Function Documentation

◆ acquire()

void TestPortableTranscriber::acquire ( edm::Event const &  event,
edm::EventSetup const &  setup,
edm::WaitingTaskWithArenaHolder  task 
)
inlineoverride

Definition at line 22 of file TestPortableTranscriber.cc.

References cms::cuda::PortableHostCollection< T >::buffer(), cms::cuda::PortableDeviceCollection< T >::bufferSize(), cms::cuda::PortableDeviceCollection< T >::const_buffer(), cms::cuda::copyAsync(), deviceToken_, hostProduct_, input, eostools::move(), and TrackValidation_cff::task.

22  {
23  // create a context reusing the same device and queue as the producer of the input collection
24  auto const& input = event.get(deviceToken_);
26 
27  cudatest::TestDeviceCollection const& deviceProduct = ctx.get(input);
28 
29  // allocate a host product based on the metadata of the device product
30  hostProduct_ = cudatest::TestHostCollection{deviceProduct->metadata().size(), ctx.stream()};
31 
32  // copy the content of the device product to the host product
33  cms::cuda::copyAsync(hostProduct_.buffer(), deviceProduct.const_buffer(), deviceProduct.bufferSize(), ctx.stream());
34 
35  // do not wait for the asynchronous operation to complete
36  }
const edm::EDGetTokenT< cms::cuda::Product< cudatest::TestDeviceCollection > > deviceToken_
static std::string const input
Definition: EdmProvDump.cc:50
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
def move(src, dest)
Definition: eostools.py:511
cudatest::TestHostCollection hostProduct_

◆ fillDescriptions()

static void TestPortableTranscriber::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

◆ produce()

void TestPortableTranscriber::produce ( edm::Event event,
edm::EventSetup const &   
)
inlineoverride

Definition at line 38 of file TestPortableTranscriber.cc.

References hostProduct_, hostToken_, and eostools::move().

38  {
39  // produce() is called once the asynchronous operation has completed, so there is no need for an explicit wait
40  event.emplace(hostToken_, std::move(hostProduct_));
41  }
const edm::EDPutTokenT< cudatest::TestHostCollection > hostToken_
def move(src, dest)
Definition: eostools.py:511
cudatest::TestHostCollection hostProduct_

Member Data Documentation

◆ deviceToken_

const edm::EDGetTokenT<cms::cuda::Product<cudatest::TestDeviceCollection> > TestPortableTranscriber::deviceToken_
private

Definition at line 50 of file TestPortableTranscriber.cc.

Referenced by acquire().

◆ hostProduct_

cudatest::TestHostCollection TestPortableTranscriber::hostProduct_
private

Definition at line 54 of file TestPortableTranscriber.cc.

Referenced by acquire(), and produce().

◆ hostToken_

const edm::EDPutTokenT<cudatest::TestHostCollection> TestPortableTranscriber::hostToken_
private

Definition at line 51 of file TestPortableTranscriber.cc.

Referenced by produce().