ATLAS Offline Software
|
Service managing a fixed number of CUDA streams for an application. More...
#include <StreamPoolSvc.h>
Public Member Functions | |
Interface inherited from @c IService | |
virtual StatusCode | initialize () override |
Initialise the service. More... | |
virtual StatusCode | finalize () override |
Finalise the service. More... | |
Interface inherited from @c AthCUDA::IStreamPoolSvc | |
virtual bool | isEmpty () const override |
Check whether any streams are available for the job. More... | |
virtual StreamHolder | getAvailableStream () override |
Get a stream from the pool. More... | |
virtual void | yieldStream (StreamHolder &stream) override |
Put a given stream back into the pool. More... | |
Private Attributes | |
Service properties | |
Gaudi::Property< unsigned int > | m_nStreams |
The number of streams to use. More... | |
Implementation variable(s) | |
std::unique_ptr< StreamPoolSvcImpl > | m_impl |
The object implementing the interaction with CUDA. More... | |
Service managing a fixed number of CUDA streams for an application.
The service provides streams to the callers by endlessly looping over the available queue of streams that it allocates during the initialisation.
Definition at line 31 of file StreamPoolSvc.h.
|
overridevirtual |
|
overridevirtual |
Get a stream from the pool.
Note that the returned holder may point to a null memory address, in case no streams are available at the moment of the call.
Definition at line 54 of file StreamPoolSvc.cxx.
|
overridevirtual |
|
overridevirtual |
Check whether any streams are available for the job.
This is a thread-safe way to check whether any CUDA streams are available at runtime.
true
if the service will under no circumstances return a valid stream, false
if it might Definition at line 49 of file StreamPoolSvc.cxx.
|
overridevirtual |
Put a given stream back into the pool.
This is a function called by AthCUDA::StreamHolder
behind the scenes when it goes out of scope. It should not be called by hand.
stream | The stream holder whose stream is to be put back into the pool |
Definition at line 68 of file StreamPoolSvc.cxx.
|
private |
The object implementing the interaction with CUDA.
Definition at line 95 of file StreamPoolSvc.h.
|
private |
The number of streams to use.
Definition at line 86 of file StreamPoolSvc.h.