Skip to content

Commit

Permalink
Document constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
makortel committed Jun 14, 2019
1 parent 48819a2 commit 91ec257
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions HeterogeneousCore/CUDACore/interface/CUDAScopedContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,26 @@ class CUDAScopedContextBase {
*/
class CUDAScopedContextAcquire: public CUDAScopedContextBase {
public:
/// Constructor to create a new CUDA stream (no need for context beyond acquire())
explicit CUDAScopedContextAcquire(edm::StreamID streamID, edm::WaitingTaskWithArenaHolder waitingTaskHolder):
CUDAScopedContextBase(streamID),
waitingTaskHolder_{std::move(waitingTaskHolder)}
{}

/// Constructor to create a new CUDA stream, and the context is needed after acquire()
explicit CUDAScopedContextAcquire(edm::StreamID streamID, edm::WaitingTaskWithArenaHolder waitingTaskHolder, CUDAContextState& state):
CUDAScopedContextBase(streamID),
waitingTaskHolder_{std::move(waitingTaskHolder)},
contextState_{&state}
{}

/// Constructor to (possibly) re-use a CUDA stream (no need for context beyond acquire())
explicit CUDAScopedContextAcquire(const CUDAProductBase& data, edm::WaitingTaskWithArenaHolder waitingTaskHolder):
CUDAScopedContextBase(data),
waitingTaskHolder_{std::move(waitingTaskHolder)}
{}

/// Constructor to (possibly) re-use a CUDA stream, and the context is needed after acquire()
explicit CUDAScopedContextAcquire(const CUDAProductBase& data, edm::WaitingTaskWithArenaHolder waitingTaskHolder, CUDAContextState& state):
CUDAScopedContextBase(data),
waitingTaskHolder_{std::move(waitingTaskHolder)},
Expand All @@ -100,14 +104,17 @@ class CUDAScopedContextAcquire: public CUDAScopedContextBase {
*/
class CUDAScopedContextProduce: public CUDAScopedContextBase {
public:
/// Constructor to create a new CUDA stream (non-ExternalWork module)
explicit CUDAScopedContextProduce(edm::StreamID streamID):
CUDAScopedContextBase(streamID)
{}

/// Constructor to (possibly) re-use a CUDA stream (non-ExternalWork module)
explicit CUDAScopedContextProduce(const CUDAProductBase& data):
CUDAScopedContextBase(data)
{}

/// Constructor to re-use the CUDA stream of acquire() (ExternalWork module)
explicit CUDAScopedContextProduce(CUDAContextState& token):
CUDAScopedContextBase(token.device(), std::move(token.streamPtr()))
{}
Expand Down

0 comments on commit 91ec257

Please sign in to comment.