Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
HeterogeneousCore
CUDACore
interface
ContextState.h
Go to the documentation of this file.
1
#ifndef HeterogeneousCore_CUDACore_ContextState_h
2
#define HeterogeneousCore_CUDACore_ContextState_h
3
4
#include "
HeterogeneousCore/CUDAUtilities/interface/SharedStreamPtr.h
"
5
6
#include <memory>
7
8
namespace
cms {
9
namespace
cuda
{
15
class
ContextState
{
16
public
:
17
ContextState
() =
default
;
18
~ContextState
() =
default
;
19
20
ContextState
(
const
ContextState
&) =
delete
;
21
ContextState
&
operator=
(
const
ContextState
&) =
delete
;
22
ContextState
(
ContextState
&&) =
delete
;
23
ContextState
&
operator=
(
ContextState
&& other) =
delete
;
24
25
private
:
26
friend
class
ScopedContextAcquire
;
27
friend
class
ScopedContextProduce
;
28
friend
class
ScopedContextTask
;
29
30
void
set
(
int
device
,
SharedStreamPtr
stream
) {
31
throwIfStream
();
32
device_
=
device
;
33
stream_
=
std::move
(stream);
34
}
35
36
int
device
()
const
{
return
device_
; }
37
38
const
SharedStreamPtr
&
streamPtr
()
const
{
39
throwIfNoStream
();
40
return
stream_
;
41
}
42
43
SharedStreamPtr
releaseStreamPtr
() {
44
throwIfNoStream
();
45
// This function needs to effectively reset stream_ (i.e. stream_
46
// must be empty after this function). This behavior ensures that
47
// the SharedStreamPtr is not hold for inadvertedly long (i.e. to
48
// the next event), and is checked at run time.
49
return
std::move
(
stream_
);
50
}
51
52
void
throwIfStream
()
const
;
53
void
throwIfNoStream
()
const
;
54
55
SharedStreamPtr
stream_
;
56
int
device_
;
57
};
58
}
// namespace cuda
59
}
// namespace cms
60
61
#endif
ecalDigis_cff.cuda
tuple cuda
Definition:
ecalDigis_cff.py:35
cms::cuda::ContextState::streamPtr
const SharedStreamPtr & streamPtr() const
Definition:
ContextState.h:38
cms::cuda::ScopedContextTask
Definition:
ScopedContext.h:192
cms::cuda::ContextState::device_
int device_
Definition:
ContextState.h:56
cms::cuda::ContextState::~ContextState
~ContextState()=default
cms::cuda::ContextState::stream_
SharedStreamPtr stream_
Definition:
ContextState.h:55
cms::cuda::stream
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
Definition:
HistoContainer.h:51
cms::cuda::SharedStreamPtr
std::shared_ptr< std::remove_pointer_t< cudaStream_t >> SharedStreamPtr
Definition:
SharedStreamPtr.h:14
cms::cuda::ScopedContextAcquire
Definition:
ScopedContext.h:101
cms::cuda::ContextState::ContextState
ContextState()=default
eostools.move
def move
Definition:
eostools.py:511
cms::cuda::ContextState
Definition:
ContextState.h:15
cms::cuda::ContextState::set
void set(int device, SharedStreamPtr stream)
Definition:
ContextState.h:30
cms::cuda::ContextState::releaseStreamPtr
SharedStreamPtr releaseStreamPtr()
Definition:
ContextState.h:43
cms::cuda::ContextState::operator=
ContextState & operator=(const ContextState &)=delete
SharedStreamPtr.h
cms::cuda::ContextState::device
int device() const
Definition:
ContextState.h:36
cms::cuda::ScopedContextProduce
Definition:
ScopedContext.h:149
cms::cuda::ContextState::throwIfStream
void throwIfStream() const
Definition:
ContextState.cc:5
cms::cuda::ContextState::throwIfNoStream
void throwIfNoStream() const
Definition:
ContextState.cc:11
Generated for CMSSW Reference Manual by
1.8.5