Hedgehog
3.1.0
A library to generate hybrid pipeline workflow systems
|
Abstract Task specialized for CUDA computation. More...
#include "abstract_cuda_task.h"
Public Member Functions | |
AbstractCUDATask (std::string const &name, size_t numberThreads, bool enablePeerAccess, bool automaticStart=false) | |
AbstractCUDATask full constructor. | |
AbstractCUDATask (std::string const name="CudaTask", size_t numberThreads=1) | |
Main constructor for a AbstractCUDATask. | |
AbstractCUDATask (std::shared_ptr< hh::core::CoreTask< Separator, AllTypes... > > coreTask, bool enablePeerAccess) | |
Custom core task constructor. | |
~AbstractCUDATask () override | |
Default destructor. | |
void | initialize () final |
Initialize an AbstractCUDATask to bind it to a CUDA device, and do the peer access if enabled. At the end will call AbstractCUDATask::initializeCuda. | |
void | shutdown () final |
Shutdown an AbstractCUDATask to destroy the task's CUDA stream created during AbstractCUDATask::initialize. First calls AbstractCUDATask::shutdownCuda. | |
virtual void | initializeCuda () |
Virtual initialization step, where user defined data structure can be initialized. | |
virtual void | shutdownCuda () |
Virtual shutdown step, where user defined data structure can be destroyed. | |
bool | enablePeerAccess () const |
Accessor for peer access choice. | |
cudaStream_t | stream () const |
Getter for CUDA task's stream. | |
bool | hasPeerAccess (int peerDeviceId) |
Accessor for peer access enabled for a specific device id. | |
![]() | |
AbstractTask () | |
Default constructor (Task with one thread named "Task") | |
AbstractTask (std::string const &name, size_t const numberThreads=1, bool const automaticStart=false) | |
AbstractTask main constructor. | |
AbstractTask (std::shared_ptr< hh::core::CoreTask< Separator, AllTypes... > > coreTask) | |
Construct a task from a user-defined core. | |
~AbstractTask () override=default | |
Default task destructor. | |
size_t | graphId () const |
Belonging graph id accessor. | |
bool | canTerminate () const override |
Default termination rule, it terminates if there is no predecessor connection and there is no input data. | |
![]() | |
TaskNode (std::shared_ptr< hh::core::abstraction::TaskNodeAbstraction > core) | |
Constructor using a core. | |
~TaskNode () override=default | |
Default destructor. | |
std::shared_ptr< AbstractMemoryManager > const & | memoryManager () const |
Memory manager accessor. | |
void | connectMemoryManager (std::shared_ptr< AbstractMemoryManager > mm) |
Connect a memory manager to a task. | |
std::shared_ptr< ManagedMemory > | getManagedMemory () |
Get a managed memory for the memory manager attached to the task, can block if none are available at the time of the call. | |
virtual void | initialize () |
initialize step for the task | |
virtual void | shutdown () |
shutdown step for the task | |
virtual std::string | extraPrintingInformation () const |
Print extra information for the task. | |
![]() | |
Node (std::shared_ptr< hh::core::abstraction::NodeAbstraction > core) | |
Constructor's node. | |
virtual | ~Node ()=default |
Default destructor. | |
std::shared_ptr< hh::core::abstraction::NodeAbstraction > const & | core () const |
Core accessor. | |
std::string | name () const |
Node's name accessor. | |
![]() | |
CanTerminate ()=default | |
Default constructor. | |
virtual | ~CanTerminate ()=default |
Default destructor. | |
virtual bool | canTerminate () const =0 |
Termination condition. | |
![]() | |
Cleanable ()=default | |
Default constructor. | |
~Cleanable ()=default | |
Default destructor. | |
virtual void | clean () |
Clean a node. | |
![]() | |
Copyable (size_t const numberThreads) | |
Copyable constructor, set the number of threads for a node. | |
virtual | ~Copyable ()=default |
Default destructor. | |
size_t | numberThreads () const |
Number of threads accessor. | |
std::vector< AbstractTask< Separator, AllTypes... > const * > | group () const |
Get the group of nodes that hold the current nodes. | |
virtual std::shared_ptr< AbstractTask< Separator, AllTypes... > > | copy () |
Copy method called to either create a group of node or duplicate a node when an execution pipeline is created. | |
Private Attributes | |
bool | enablePeerAccess_ = false |
Enable CUDA Peer Access through all CUDA devices available. | |
std::unordered_set< int > | peerDeviceIds_ = {} |
Sparse matrix of linked CUDA devices. | |
cudaStream_t | stream_ = {} |
CUDA stream linked to the task. | |
Additional Inherited Members | |
![]() | |
std::shared_ptr< hh::core::CoreTask< Separator, AllTypes... > > const & | coreTask () const |
Accessor to the core task. | |
int | deviceId () |
Accessor to device id linked to the task (default 0 for CPU task) | |
Abstract Task specialized for CUDA computation.
At initialization, the device is set to the task (cudaSetDevice), and a stream is created and bound to the task (cudaStreamCreate). During shutdown, the stream is destroyed (cudaStreamDestroy).
Separator | Separator position between input types and output types |
AllTypes | List of input and output types |
Definition at line 46 of file abstract_cuda_task.h.
|
inline |
AbstractCUDATask full constructor.
name | Task name |
numberThreads | Number of threads for the task |
enablePeerAccess | Enable peer access for NVIDIA GPUs |
automaticStart | Flag for automatic start (Cf. AbstractTask) |
Definition at line 58 of file abstract_cuda_task.h.
|
inlineexplicit |
Main constructor for a AbstractCUDATask.
name | Name of the AbstractCUDATask |
numberThreads | Number of thread for this task (default 1) |
Definition at line 68 of file abstract_cuda_task.h.
|
inline |
Custom core task constructor.
coreTask | Custom core to use |
enablePeerAccess | Enable per access for NVIDIA GPUs |
Definition at line 74 of file abstract_cuda_task.h.
|
inlineoverride |
Default destructor.
Definition at line 82 of file abstract_cuda_task.h.
|
inline |
Accessor for peer access choice.
Definition at line 136 of file abstract_cuda_task.h.
|
inline |
Accessor for peer access enabled for a specific device id.
peerDeviceId | Device id to test |
Definition at line 145 of file abstract_cuda_task.h.
|
inlinefinalvirtual |
Initialize an AbstractCUDATask to bind it to a CUDA device, and do the peer access if enabled. At the end will call AbstractCUDATask::initializeCuda.
Reimplemented from hh::behavior::TaskNode.
Definition at line 90 of file abstract_cuda_task.h.
|
inlinevirtual |
Virtual initialization step, where user defined data structure can be initialized.
Definition at line 129 of file abstract_cuda_task.h.
|
inlinefinalvirtual |
Shutdown an AbstractCUDATask to destroy the task's CUDA stream created during AbstractCUDATask::initialize. First calls AbstractCUDATask::shutdownCuda.
Reimplemented from hh::behavior::TaskNode.
Definition at line 123 of file abstract_cuda_task.h.
|
inlinevirtual |
Virtual shutdown step, where user defined data structure can be destroyed.
Definition at line 132 of file abstract_cuda_task.h.
|
inline |
Getter for CUDA task's stream.
Definition at line 140 of file abstract_cuda_task.h.
|
private |
Enable CUDA Peer Access through all CUDA devices available.
Definition at line 48 of file abstract_cuda_task.h.
|
private |
Sparse matrix of linked CUDA devices.
Definition at line 49 of file abstract_cuda_task.h.
|
private |
CUDA stream linked to the task.
Definition at line 50 of file abstract_cuda_task.h.