CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cms::cuda::ScopedContextTask Class Reference

#include <ScopedContext.h>

Inheritance diagram for cms::cuda::ScopedContextTask:
cms::cuda::impl::ScopedContextBase

Public Member Functions

template<typename F >
void pushNextTask (F &&f)
 
void replaceWaitingTaskHolder (edm::WaitingTaskWithArenaHolder waitingTaskHolder)
 
 ScopedContextTask (ContextState const *state, edm::WaitingTaskWithArenaHolder waitingTaskHolder)
 Constructor to re-use the CUDA stream of acquire() (ExternalWork module) More...
 
 ~ScopedContextTask ()
 
- Public Member Functions inherited from cms::cuda::impl::ScopedContextBase
int device () const
 
cudaStream_t stream () const
 
const SharedStreamPtrstreamPtr () const
 

Private Attributes

ContextState const * contextState_
 
impl::ScopedContextHolderHelper holderHelper_
 

Additional Inherited Members

- Protected Member Functions inherited from cms::cuda::impl::ScopedContextBase
 ScopedContextBase (edm::StreamID streamID)
 
 ScopedContextBase (const ProductBase &data)
 
 ScopedContextBase (int device, SharedStreamPtr stream)
 

Detailed Description

The aim of this class is to do necessary per-task "initialization" tasks created in ExternalWork acquire():

Definition at line 192 of file ScopedContext.h.

Constructor & Destructor Documentation

◆ ScopedContextTask()

cms::cuda::ScopedContextTask::ScopedContextTask ( ContextState const *  state,
edm::WaitingTaskWithArenaHolder  waitingTaskHolder 
)
inlineexplicit

Constructor to re-use the CUDA stream of acquire() (ExternalWork module)

Definition at line 195 of file ScopedContext.h.

References eostools::move().

196  : ScopedContextBase(state->device(), state->streamPtr()), // don't move, state is re-used afterwards
197  holderHelper_{std::move(waitingTaskHolder)},
198  contextState_{state} {}
ContextState const * contextState_
impl::ScopedContextHolderHelper holderHelper_
def move(src, dest)
Definition: eostools.py:511
ScopedContextBase(edm::StreamID streamID)

◆ ~ScopedContextTask()

cms::cuda::ScopedContextTask::~ScopedContextTask ( )

Member Function Documentation

◆ pushNextTask()

template<typename F >
void cms::cuda::ScopedContextTask::pushNextTask ( F &&  f)
inline

Definition at line 203 of file ScopedContext.h.

References contextState_, f, holderHelper_, and cms::cuda::impl::ScopedContextHolderHelper::pushNextTask().

Referenced by TestCUDAProducerGPUEWTask::addSimpleWork().

203  {
204  holderHelper_.pushNextTask(std::forward<F>(f), contextState_);
205  }
void pushNextTask(F &&f, ContextState const *state)
ContextState const * contextState_
impl::ScopedContextHolderHelper holderHelper_
double f[11][100]

◆ replaceWaitingTaskHolder()

void cms::cuda::ScopedContextTask::replaceWaitingTaskHolder ( edm::WaitingTaskWithArenaHolder  waitingTaskHolder)
inline

Definition at line 207 of file ScopedContext.h.

References holderHelper_, eostools::move(), and cms::cuda::impl::ScopedContextHolderHelper::replaceWaitingTaskHolder().

207  {
209  }
void replaceWaitingTaskHolder(edm::WaitingTaskWithArenaHolder waitingTaskHolder)
Definition: ScopedContext.h:83
impl::ScopedContextHolderHelper holderHelper_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ contextState_

ContextState const* cms::cuda::ScopedContextTask::contextState_
private

Definition at line 213 of file ScopedContext.h.

Referenced by pushNextTask().

◆ holderHelper_

impl::ScopedContextHolderHelper cms::cuda::ScopedContextTask::holderHelper_
private

Definition at line 212 of file ScopedContext.h.

Referenced by pushNextTask(), replaceWaitingTaskHolder(), and ~ScopedContextTask().