HTGS  v2.0
The Hybrid Task Graph Scheduler
htgs::TaskGraphConf< T, U > Class Template Reference

Manages a group of connected ITasks and their connections. More...

#include <htgs/api/TaskGraphConf.hpp>

Inheritance diagram for htgs::TaskGraphConf< T, U >:
Inheritance graph
Collaboration diagram for htgs::TaskGraphConf< T, U >:
Collaboration graph

Public Member Functions

 TaskGraphConf ()
 Constructs a TaskGraph.
 
 TaskGraphConf (size_t pipelineId, size_t numPipelines, std::string baseAddress)
 Constructs a TaskGraph. More...
 
 ~TaskGraphConf () override
 Destructor, handles releasing all ITask memory that is managed by the TaskGraph.
 
AnyTaskGraphConfcopy () override
 Creates an exact copy of this task graph. More...
 
TaskGraphConf< T, U > * copy (size_t pipelineId, size_t numPipelines)
 Creates a mirror copy of the TaskGraph with the specified pipelineId and number of pipelines. More...
 
TaskGraphConf< T, U > * copy (size_t pipelineId, size_t numPipelines, std::shared_ptr< Connector< T >> input, std::shared_ptr< Connector< U >> output, std::string baseAddress)
 Creates a mirror copy of the TaskGraph with the specified pipelineId and number of pipelines, and updates the input and output connectors for the graph copy. More...
 
template<class V , class W , class X >
void addEdge (ITask< V, W > *producer, ITask< W, X > *consumer)
 Adds an edge to the graph, where one task produces data for a consumer task. More...
 
template<class V , class IRuleType , class W , class X >
void addRuleEdge (Bookkeeper< V > *bookkeeper, std::shared_ptr< IRuleType > rule, ITask< W, X > *consumer)
 Creates a rule edge that is managed by a bookkeeper. More...
 
template<class V , class W , class X >
void addRuleEdge (Bookkeeper< V > *bookkeeper, IRule< V, W > *iRule, ITask< W, X > *consumer)
 Creates a rule edge that is managed by a bookkeeper. More...
 
template<class V , class IMemoryAllocatorType >
void addCudaMemoryManagerEdge (std::string name, AnyITask *getMemoryTask, std::shared_ptr< IMemoryAllocatorType > allocator, size_t memoryPoolSize, MMType type, int *gpuIds)
 Adds a CudaMemoryManager edge with the specified name to the TaskGraphConf. More...
 
template<class V >
void addCudaMemoryManagerEdge (std::string name, AnyITask *getMemoryTask, IMemoryAllocator< V > *allocator, size_t memoryPoolSize, MMType type, int *gpuIds)
 Adds a CudaMemoryManager edge with the specified name to the TaskGraphConf. More...
 
template<class V >
void addRuleEdgeAsGraphProducer (Bookkeeper< V > *bookkeeper, IRule< V, U > *iRule)
 
template<class V >
void addCustomMemoryManagerEdge (AnyITask *getMemoryTask, MemoryManager< V > *memoryManager)
 Adds a custom MemoryManager with the specified name to the TaskGraphConf. More...
 
template<class V , class IMemoryAllocatorType >
void addMemoryManagerEdge (std::string name, AnyITask *getMemoryTask, std::shared_ptr< IMemoryAllocatorType > allocator, size_t memoryPoolSize, MMType type)
 Adds a MemoryManager edge with the specified name to the TaskGraphConf. More...
 
template<class V >
void addMemoryManagerEdge (std::string name, AnyITask *getMemoryTask, IMemoryAllocator< V > *allocator, size_t memoryPoolSize, MMType type)
 Adds a MemoryManager edge with the specified name to the TaskGraphConf. More...
 
std::shared_ptr< AnyConnectorgetInputConnector () override
 Pure virtual function that gets the task manager that is consuming data from the graph's input. More...
 
std::shared_ptr< AnyConnectorgetOutputConnector () override
 Virtual function that gets the connector used for graph output. More...
 
void updateTaskManagersAddressingAndPipelines ()
 Updates the task managers addresses, pipelineIds and the number of pipelines for all tasks in the TaskGraph. More...
 
void incrementGraphProducer ()
 Sets the input connector for the task graph. More...
 
void finishedProducingData ()
 Decrements the input connector and wakes up any consumer of the graph's input if the input connector is finished producing data. More...
 
template<class W >
void setGraphConsumerTask (ITask< T, W > *task)
 Sets the task that is consuming data from the input of the graph. More...
 
template<class W >
void addGraphProducerTask (ITask< W, U > *task)
 Sets the task that is producing data for the output of the graph. More...
 
void produceData (T *data)
 Produces data for the input of the TaskGraph. More...
 
void produceData (std::shared_ptr< T > data)
 Produces data for the input of the TaskGraph. More...
 
void produceData (std::list< std::shared_ptr< T >> *dataList)
 Adds a list of data into the TaskGraph Must specify the TaskGraph input using addGraphInputConsumer() and use incrementGraphInputProducer() to indicate an input stream is feeding data to the TaskGraph. More...
 
std::shared_ptr< U > consumeData ()
 Consumes data from the output of a TaskGraph. More...
 
std::shared_ptr< U > pollData (size_t microTimeout)
 Polls for data from the output of the TaskGraph. More...
 
bool isOutputTerminated ()
 Checks if the output of the TaskGraph has finished producing data. More...
 
void setOutputConnector (std::shared_ptr< AnyConnector > connector)
 Sets the output connector for the task graph configuration. More...
 
void setInputConnector (std::shared_ptr< AnyConnector > connector)
 Sets the input connector for the task graph configuration. More...
 
template<class V >
void releaseMemory (m_data_t< V > memory)
 Releases memory back to its memory manager. More...
 
std::string genCustomDotForTasks (ProfileUtils *profileUtils, int colorFlag)
 Generates the custom dot profiles for all tasks in this graph. More...
 
std::string genDotGraphEdgesWithoutConnectors (std::map< AnyTaskManager *, TaskManagerProfile *> *allTaskManagerProfiles, int flags)
 Generates the edges between tasks without connectors. More...
 
std::string genDotGraph (int flags, int colorFlag, std::string graphTitle="", std::string customTitleText="") override
 Generates the dot graph as a string.
 
void debug ()
 Provides debug output for the TaskGraphConf. More...
 
ExecutionPipeline< T, U > * createExecutionPipeline (size_t numPipelines, std::string name="Execution Pipeline", bool waitForInit=true)
 Wraps this task graph into an execution pipeline task, which will then be used to duplicate and execute across multiple GPUs. More...
 
TGTask< T, U > * createTaskGraphTask (std::string name="TGTask", bool waitForInit=true)
 Wraps this task graph into a TGTask. More...
 
GraphEdge< T > * getGraphConsumerEdge () const
 
std::list< GraphEdge< U > * > * getGraphProducerEdges () const
 
- Public Member Functions inherited from htgs::AnyTaskGraphConf
 AnyTaskGraphConf (size_t pipelineId, size_t numPipelines, std::string baseAddress)
 Constructs the AnyTaskGraphConf. More...
 
virtual ~AnyTaskGraphConf ()
 Destructor.
 
std::list< AnyTaskManager * > * getTaskManagers ()
 Virtual function that initiates updating the task graph communicator. More...
 
void gatherProfilingData (std::map< AnyTaskManager *, TaskManagerProfile *> *taskManagerProfiles)
 Gathers profiling data for this task graph's task managers, which is added into the task manager profiles map. More...
 
template<class V , class W >
std::shared_ptr< IRule< V, W > > getIRule (IRule< V, W > *iRule)
 Gets the shared_ptr reference for a particular IRule. More...
 
template<class V >
std::shared_ptr< IMemoryAllocator< V > > getMemoryAllocator (IMemoryAllocator< V > *allocator)
 Gets the shared_ptr reference for a particular IMemoryAllocator. More...
 
void initialize ()
 Initializes the task graph just prior to spawning threads.
 
virtual void finishedSetup ()
 Called when the task graph has finished setting up its tasks and launched all threads for the graph.
 
void shutdown ()
 Called when all the threads in this graph have finished executing.
 
void waitForInitialization ()
 Waits for all task managers to finish initializing. More...
 
std::condition_variable * getInitializationCondition ()
 Notifies the task graph to check if all task managers have been initialized or not. More...
 
std::mutex * getInitializationMutex ()
 Gets the initialization mutex, used for signaling when initialization is done. More...
 
TaskNameConnectorMapgetTaskConnectorNameMap () const
 Gets the task name connector map that maps the task name to its input connector. More...
 
template<class T , class U >
ITask< T, U > * getCopy (ITask< T, U > *orig)
 Gets the copy for an ITask based on some original ITask reference. More...
 
AnyITaskgetCopy (AnyITask *orig)
 Gets the copy for an AnyITask based on some original AnyITask reference. More...
 
template<class T , class U >
TaskManager< T, U > * getTaskManager (ITask< T, U > *task)
 Gets the task manager that is responsible for a particular ITask. More...
 
void addTaskManager (AnyTaskManager *taskManager)
 Adds a task manager to the task graph. More...
 
void printProfile ()
 Prints profile data to console for all task managers.
 
size_t getPipelineId ()
 Gets the pipeline ID for the task graph configuration. More...
 
size_t getNumPipelines ()
 Gets the number of pipelines that exist for this task graph. More...
 
void writeDotToFile (std::string file, int flags=0, std::string graphTitle="", std::string customTitleText="")
 Writes the dot representation of the task graph to disk with additional options such as profiling. More...
 
std::string getAddress ()
 Gets the address for the task graph. More...
 
size_t getNumberOfSubGraphs () const
 Gets the number of sub graphs within this task graph. More...
 
unsigned long long int getGraphComputeTime () const
 Gets the total time the graph was computing. More...
 
unsigned long long int getGraphCreationTime () const
 Gets the total time the graph was getting created. More...
 
std::string genDotGraphContent (int flags)
 Generate the content only of the graph (excludes all graph definitions and attributes)
 
void copyTasks (std::list< AnyTaskManager *> *tasks)
 Creates a copy of each task from the list of AnyTaskManagers passed as a parameter. More...
 
AnyTaskManagergetTaskManagerCopy (AnyITask *iTask)
 Gets the task manager copy for a given ITask. More...
 
bool hasTask (AnyITask *task)
 Checks whether an ITask is in the graph or not. More...
 

Private Attributes

std::list< EdgeDescriptor * > * edges
 The list of edges for the graph, represented by edge descriptors to define how the edges are copied/added.
 
GraphEdge< T > * graphConsumerEdge
 The consumer accessing the TaskGraph's input connector.
 
std::list< GraphEdge< U > * > * graphProducerEdges
 The list of producers that are outputting data to the TaskGraph's output connector.
 
std::shared_ptr< Connector< T > > input
 The input connector for the TaskGraph.
 
std::shared_ptr< Connector< U > > output
 The output connector for the TaskGraph.
 

Detailed Description

template<class T, class U>
class htgs::TaskGraphConf< T, U >

Manages a group of connected ITasks and their connections.

Each ITask that is added into the TaskGraphConf is stored in the TaskGraphConf's metadata to allow for quick copying using copy().

The main methods for adding each ITask into the graph are addEdge(), addRuleEdge(), addMemoryManagerEdge(), addCudaMemoryManagerEdge(), setGraphConsumerTask(), and addGraphProducerTask()

When using these methods, the TaskGraphConf builds a TaskManager, which manages an ITask. Parameters for customizing the thread pool, polling abilities, etc., are specified in the ITask constructors: ITask::ITask()

Special memory edge functions are provided. For normal CPU memory edges use: addMemoryManagerEdge()

For Cuda memory use: addCudaMemoryManagerEdge()

Every TaskGraphConf has an input and output type (T and U). If a TaskGraph does not have an input or output type, then the data type can be specified as VoidData. There can be only one task consuming data from the graph. If multiple tasks need to process data from the input, then add a bookkeeper as the first task and rules to distribute data. There can be any number of tasks producing output data for the graph.

To add data into the input of a TaskGraph use the produceData() function. Once finished producing data for the graph, use the finishedProducingData() function to indicate a data input stream is is closing. If additional data streams are added as input for the graph, then use the incrementGraphProducer() function. By default a task graph starts with one producer for the graph for the main thread, if there are no producers (such as the first task in the graph begins processing immediately), then call finishedProducingData().

To process the output of a TaskGraph use the consumeData() function. To determine if data is no longer being produced by a TaskGraph use the isOutputTerminated() function. The output of the consumeData function could produce nullptr data when the graph is closing.

Example Usage:

int numLoadThreads = 2;
int numMulThreads = 20;
LoadMatrixTask *loadMatrixTask = new LoadMatrixTask(numLoadThreads, blockSize, width, height);
ScalarMultiplyTask *scalMulTask = new ScalarMultiplyTask(numMulThreads, blockSize, width, height);
MatrixLoadRule *loadRule = new MatrixLoadRule(width/blockSize, height/blockSize);
// Add tasks to graph
taskGraph->addEdge(loadMatrixTask, bkTask);
taskGraph->addRuleEdge(bkTask, loadRule, scalMulTask);
// Add memory edges
MatrixAllocator *matrixAlloc = new MatrixAllocator(blockSize, blockSize);
int poolSize = 50;
taskGraph->addMemoryManagerEdge("MatrixA", loadMatrixTask, matrixAlloc, 50);
taskGraph->addMemoryManagerEdge("MatrixB", loadMatrixTask, matrixAlloc, 50);
// Setup graph input/output
taskGraph->setGraphConsumerTask(loadMatrixTask);
taskGraph->addGraphProducerTask(scalMulTask);
// Setup runtime and execute
runtime->executeRuntime();
// Add input to graph
for (blockRow = 0; blockRow < blockHeight; blockRow++)
{
for(blockCol = 0; blockCol < blockWidth; blockCol++)
{
// Request to multiply BlockedA[blockRow, blockCol] .* BlockedB[blockRow, blockCol]
taskGraph->produceData(new MatrixBlockRequest(blockRow, blockCol, "MatrixA"));
taskGraph->produceData(new MatrixBlockRequest(blockRow, blockCol, "MatrixB"));
}
}
// Indicate finished producing data
taskGraph->finishedProducingData();
// Process taskGraph output
while (!taskGraph->isOutputTerminated())
{
std::shared_ptr<MatrixBlockRequest> mbr = taskGraph->consumeData();
if (mbr != nullptr)
{
// ... apply post-processing
}
}
runtime->waitForRuntime();
Template Parameters
Tthe input data type for the TaskGraph, T must derive from IData.
Uthe output data type for the TaskGraph, U must derive from IData.

Constructor & Destructor Documentation

◆ TaskGraphConf()

template<class T, class U>
htgs::TaskGraphConf< T, U >::TaskGraphConf ( size_t  pipelineId,
size_t  numPipelines,
std::string  baseAddress 
)
inline

Constructs a TaskGraph.

Parameters
pipelineIdthe pipelineId for this graph
numPipelinesthe number of pipelines for the graph
baseAddressthe base address for the task graph to build upon for multiple levels of execution pipelines

Member Function Documentation

◆ addCudaMemoryManagerEdge() [1/2]

template<class T, class U>
template<class V , class IMemoryAllocatorType >
void htgs::TaskGraphConf< T, U >::addCudaMemoryManagerEdge ( std::string  name,
AnyITask getMemoryTask,
std::shared_ptr< IMemoryAllocatorType >  allocator,
size_t  memoryPoolSize,
MMType  type,
int *  gpuIds 
)
inline

Adds a CudaMemoryManager edge with the specified name to the TaskGraphConf.

This will create a CudaMemoryManager that is bound to some Cuda GPU based on the pipelineId of the TaskGraphConf.

Parameters
namethe name of the memory edge, should be unique compared to all memory edges added to the TaskGraphConf and any TaskGraphConf within an ExecutionPipeline
getMemoryTaskthe ITask that is getting memory
allocatorthe allocator describing how memory is allocated (should allocate Cuda memory)
memoryPoolSizethe size of the memory pool that is allocated by the CudaMemoryManager
typethe type of memory manager
gpuIdsthe array Cuda GPU Ids
Note
the memoryPoolSize can cause out of memory errors for the GPU if the allocator->size() * memoryPoolSize exceeds the total GPU memory
Template Parameters
Vthe type of memory; i.e. 'cufftDoubleComplex *'

◆ addCudaMemoryManagerEdge() [2/2]

template<class T, class U>
template<class V >
void htgs::TaskGraphConf< T, U >::addCudaMemoryManagerEdge ( std::string  name,
AnyITask getMemoryTask,
IMemoryAllocator< V > *  allocator,
size_t  memoryPoolSize,
MMType  type,
int *  gpuIds 
)
inline

Adds a CudaMemoryManager edge with the specified name to the TaskGraphConf.

This will create a CudaMemoryManager that is bound to some Cuda GPU based on the pipelineId of the TaskGraphConf.

Parameters
namethe name of the memory edge, should be unique compared to all memory edges added to the TaskGraphConf and any TaskGraphConf within an ExecutionPipeline
getMemoryTaskthe ITask that is getting memory
allocatorthe allocator describing how memory is allocated (should allocate Cuda memory)
memoryPoolSizethe size of the memory pool that is allocated by the CudaMemoryManager
typethe type of memory manager e
gpuIdsthearray of requested GPU Ids
Note
the memoryPoolSize can cause out of memory errors for the GPU if the allocator->size() * memoryPoolSize exceeds the total GPU memory
Template Parameters
Vthe type of memory; i.e. 'cufftDoubleComplex *'

◆ addCustomMemoryManagerEdge()

template<class T, class U>
template<class V >
void htgs::TaskGraphConf< T, U >::addCustomMemoryManagerEdge ( AnyITask getMemoryTask,
MemoryManager< V > *  memoryManager 
)
inline

Adds a custom MemoryManager with the specified name to the TaskGraphConf.

This will create a custom memory manager

Template Parameters
V
Parameters
getMemoryTask
memoryManager

◆ addEdge()

template<class T, class U>
template<class V , class W , class X >
void htgs::TaskGraphConf< T, U >::addEdge ( ITask< V, W > *  producer,
ITask< W, X > *  consumer 
)
inline

Adds an edge to the graph, where one task produces data for a consumer task.

Template Parameters
Vthe input type for the producer task
Wthe output/input types for the producer/consumer tasks
Xthe output type for the consumer task
Parameters
producerthe task that is producing data
consumerthe task that consumes the data from the producer task

◆ addGraphProducerTask()

template<class T, class U>
template<class W >
void htgs::TaskGraphConf< T, U >::addGraphProducerTask ( ITask< W, U > *  task)
inline

Sets the task that is producing data for the output of the graph.

Template Parameters
Wthe input type of the task
Parameters
taskthe task that produces data that is added as output for the graph.
Note
There can be multiple tasks that produces for the graph.

◆ addMemoryManagerEdge() [1/2]

template<class T, class U>
template<class V , class IMemoryAllocatorType >
void htgs::TaskGraphConf< T, U >::addMemoryManagerEdge ( std::string  name,
AnyITask getMemoryTask,
std::shared_ptr< IMemoryAllocatorType >  allocator,
size_t  memoryPoolSize,
MMType  type 
)
inline

Adds a MemoryManager edge with the specified name to the TaskGraphConf.

Parameters
namethe name of the memory edge, should be unique compared to all memory edges added to the TaskGraphConf and any TaskGraphConf within an ExecutionPipeline
getMemoryTaskthe ITask that is getting memory
allocatorthe allocator describing how memory is allocated
memoryPoolSizethe size of the memory pool that is allocated by the MemoryManager
typethe type of memory manager
Note
the memoryPoolSize can cause out of memory errors for the system if the allocator->size() * memoryPoolSize exceeds the total system memory
Template Parameters
Vthe type of memory; i.e., 'double'
Note
Use this function if the rule connecting the bookkeeper and consumer are shared among multiple graphs that you create.

◆ addMemoryManagerEdge() [2/2]

template<class T, class U>
template<class V >
void htgs::TaskGraphConf< T, U >::addMemoryManagerEdge ( std::string  name,
AnyITask getMemoryTask,
IMemoryAllocator< V > *  allocator,
size_t  memoryPoolSize,
MMType  type 
)
inline

Adds a MemoryManager edge with the specified name to the TaskGraphConf.

Parameters
namethe name of the memory edge, should be unique compared to all memory edges added to the TaskGraphConf and any TaskGraphConf within an ExecutionPipeline
getMemoryTaskthe ITask that is getting memory
allocatorthe allocator describing how memory is allocated
memoryPoolSizethe size of the memory pool that is allocated by the MemoryManager
typethe type of memory manager
Note
the memoryPoolSize can cause out of memory errors for the system if the allocator->size() * memoryPoolSize exceeds the total system memory
Template Parameters
Vthe type of memory; i.e., 'double'

◆ addRuleEdge() [1/2]

template<class T, class U>
template<class V , class IRuleType , class W , class X >
void htgs::TaskGraphConf< T, U >::addRuleEdge ( Bookkeeper< V > *  bookkeeper,
std::shared_ptr< IRuleType >  rule,
ITask< W, X > *  consumer 
)
inline

Creates a rule edge that is managed by a bookkeeper.

Template Parameters
Vthe input type for the bookkeeper and rule
IRuleTypethe IRule that determines when to produce data for the edge (must match the input types of both the bookkeeper and the consumer task)
Wthe output/input type for the rule/consumer task
Xthe output type for the consumer task
Parameters
bookkeeperthe bookkeeper task that manages this edge
rulethe rule that determines when to produce data for the edge
consumerthe consumer of the rule
Note
Use this function if the rule connecting the bookkeeper and consumer are shared among multiple graphs that you create.

◆ addRuleEdge() [2/2]

template<class T, class U>
template<class V , class W , class X >
void htgs::TaskGraphConf< T, U >::addRuleEdge ( Bookkeeper< V > *  bookkeeper,
IRule< V, W > *  iRule,
ITask< W, X > *  consumer 
)
inline

Creates a rule edge that is managed by a bookkeeper.

Template Parameters
Vthe input type for the bookkeeper and rule
Wthe output/input type for the rule/consumer task
Xthe output type for the consumer task
Parameters
bookkeeperthe bookkeeper task that manages this edge
iRulethe rule that determines when to produce data for the edge
consumerthe consumer of the rule

◆ consumeData()

template<class T, class U>
std::shared_ptr<U> htgs::TaskGraphConf< T, U >::consumeData ( )
inline

Consumes data from the output of a TaskGraph.

It is possible for consumeData to return nullptr if the last Task has finished. Therefore, when consuming data from a TaskGraph it is important to have a check for nullptr prior to processing that data.

Returns
one data element from the output of the TaskGraph or nullptr if the last task is closing.
Note
The task producing data for the TaskGraph will send nullptr to the connector, so the thread consuming data should check for nullptr prior to processing the data.

◆ copy() [1/3]

template<class T, class U>
AnyTaskGraphConf* htgs::TaskGraphConf< T, U >::copy ( )
inlineoverridevirtual

Creates an exact copy of this task graph.

Returns
a copy of the task graph.

Implements htgs::AnyTaskGraphConf.

◆ copy() [2/3]

template<class T, class U>
TaskGraphConf<T, U>* htgs::TaskGraphConf< T, U >::copy ( size_t  pipelineId,
size_t  numPipelines 
)
inline

Creates a mirror copy of the TaskGraph with the specified pipelineId and number of pipelines.

Parameters
pipelineIdthe pipeline Id
numPipelinesthe number of pipelines
Returns
the copy of the task graph

◆ copy() [3/3]

template<class T, class U>
TaskGraphConf<T, U>* htgs::TaskGraphConf< T, U >::copy ( size_t  pipelineId,
size_t  numPipelines,
std::shared_ptr< Connector< T >>  input,
std::shared_ptr< Connector< U >>  output,
std::string  baseAddress 
)
inline

Creates a mirror copy of the TaskGraph with the specified pipelineId and number of pipelines, and updates the input and output connectors for the graph copy.

Parameters
pipelineIdthe pipeline Id
numPipelinesthe number of pipelines
inputthe input connector to be used for the graph's input
outputthe output connector to be used for the graph's output
baseAddressthe base address for the task graph to build upon for multiple levels of execution pipelines
Returns
the copy of the task graph

◆ createExecutionPipeline()

template<class T, class U>
ExecutionPipeline<T, U>* htgs::TaskGraphConf< T, U >::createExecutionPipeline ( size_t  numPipelines,
std::string  name = "Execution Pipeline",
bool  waitForInit = true 
)
inline

Wraps this task graph into an execution pipeline task, which will then be used to duplicate and execute across multiple GPUs.

Parameters
numPipelinesthe number of pipeline to spawn
waitForInitWaits for all tasks in the graphs to finish initializing before the ExecutionPipeline returns from its initialize
Returns
the execution pipeline task
Note
In order to decompose data to each pipeline, you must add rules to the execution pipeline task.
Do not interact with or alter this TaskGraphConf after the ExecutionPipeline has been launched using a TaskGraphRuntime.

◆ createTaskGraphTask()

template<class T, class U>
TGTask<T, U>* htgs::TaskGraphConf< T, U >::createTaskGraphTask ( std::string  name = "TGTask",
bool  waitForInit = true 
)
inline

Wraps this task graph into a TGTask.

This will improve visualization of multiple graphs that interact with eachother. In addition the input/outputs of the TGTask, as connected in a new graph, will be incorporated into the task graph you use with the TGTask.

Parameters
waitForInitWaits for all tasks in the graph to finish initializing before the TGTask returns from its initialize
Returns
the task graph task
Note
Do not interact with or alter this TaskGraphConf after the TGTask has been launched.
Do not produce data into the TaskGraphConf that was used with the TGTask.

◆ debug()

template<class T, class U>
void htgs::TaskGraphConf< T, U >::debug ( )
inline

Provides debug output for the TaskGraphConf.

Note
#define DEBUG_FLAG to enable debugging

◆ finishedProducingData()

template<class T, class U>
void htgs::TaskGraphConf< T, U >::finishedProducingData ( )
inline

Decrements the input connector and wakes up any consumer of the graph's input if the input connector is finished producing data.

Note
This should be called by the main thread when all data is finished being produced for this task graph.

◆ genCustomDotForTasks()

template<class T, class U>
std::string htgs::TaskGraphConf< T, U >::genCustomDotForTasks ( ProfileUtils profileUtils,
int  colorFlag 
)
inline

Generates the custom dot profiles for all tasks in this graph.

Parameters
profileUtilsthe profile utils for color coding tasks
colorFlagthe color flag that was specified
Returns
the additional custom dot file content

◆ genDotGraphEdgesWithoutConnectors()

template<class T, class U>
std::string htgs::TaskGraphConf< T, U >::genDotGraphEdgesWithoutConnectors ( std::map< AnyTaskManager *, TaskManagerProfile *> *  allTaskManagerProfiles,
int  flags 
)
inline

Generates the edges between tasks without connectors.

Parameters
allTaskManagerProfilesall of the task managers for all graphs and its sub-graphs
Returns
the dot representation of the connection between task managers

◆ getInputConnector()

template<class T, class U>
std::shared_ptr<AnyConnector> htgs::TaskGraphConf< T, U >::getInputConnector ( )
inlineoverridevirtual

Pure virtual function that gets the task manager that is consuming data from the graph's input.

Returns
the task manager that is consuming data from the graph's input. Gets the list of task managers that are producing data for the graph's output
the list of task managers that are producing data for the graph's output. Virtual function that gets the connector used for graph input
the connector used for graph input

Implements htgs::AnyTaskGraphConf.

◆ getOutputConnector()

template<class T, class U>
std::shared_ptr<AnyConnector> htgs::TaskGraphConf< T, U >::getOutputConnector ( )
inlineoverridevirtual

Virtual function that gets the connector used for graph output.

Returns
the connector used for graph output

Implements htgs::AnyTaskGraphConf.

◆ incrementGraphProducer()

template<class T, class U>
void htgs::TaskGraphConf< T, U >::incrementGraphProducer ( )
inline

Sets the input connector for the task graph.

Parameters
inputthe input connector Sets the output connector for the task graph
outputthe output connector Increments the number of producers for the task graph.
Note
The input connector is automatically incremented when creating a graph, so this should only be called if additional sources will be producing data other than the main function.

◆ isOutputTerminated()

template<class T, class U>
bool htgs::TaskGraphConf< T, U >::isOutputTerminated ( )
inline

Checks if the output of the TaskGraph has finished producing data.

Returns
whether the output is finished or not
Return values
TRUEif the output is no longer producing data
FALSEif the output is not finished producing data

◆ pollData()

template<class T, class U>
std::shared_ptr<U> htgs::TaskGraphConf< T, U >::pollData ( size_t  microTimeout)
inline

Polls for data from the output of the TaskGraph.

Parameters
microTimeoutthe timeout time in microseconds
Returns
the data or nullptr if the timeout period expires.

◆ produceData() [1/3]

template<class T, class U>
void htgs::TaskGraphConf< T, U >::produceData ( T *  data)
inline

Produces data for the input of the TaskGraph.

Must specify the TaskGraph input using addGraphInputConsumer() and use incrementGraphInputProducer() to indicate an input stream is feeding data to the TaskGraph

Parameters
datathe data being added to the TaskGraph input
Note
The data being passed will be wrapped into a std::shared_ptr<T>(data)

◆ produceData() [2/3]

template<class T, class U>
void htgs::TaskGraphConf< T, U >::produceData ( std::shared_ptr< T >  data)
inline

Produces data for the input of the TaskGraph.

Must specify the TaskGraph input using addGraphInputConsumer() and use incrementGraphInputProducer() to indicate an input stream is feeding data to the TaskGraph

Parameters
datathe data being added to the TaskGraph input

◆ produceData() [3/3]

template<class T, class U>
void htgs::TaskGraphConf< T, U >::produceData ( std::list< std::shared_ptr< T >> *  dataList)
inline

Adds a list of data into the TaskGraph Must specify the TaskGraph input using addGraphInputConsumer() and use incrementGraphInputProducer() to indicate an input stream is feeding data to the TaskGraph.

Parameters
dataListthe list of data to be added.

◆ releaseMemory()

template<class T, class U>
template<class V >
void htgs::TaskGraphConf< T, U >::releaseMemory ( m_data_t< V >  memory)
inline

Releases memory back to its memory manager.

Template Parameters
Vthe type of memory data
Parameters
memorythe memory
Note
The m_data_t must have originated within this task graph.

◆ setGraphConsumerTask()

template<class T, class U>
template<class W >
void htgs::TaskGraphConf< T, U >::setGraphConsumerTask ( ITask< T, W > *  task)
inline

Sets the task that is consuming data from the input of the graph.

Template Parameters
Wthe output type of the task
Parameters
taskthe task that consumes data that is added into the graph.
Note
Only one task consumes data from the graph. If multiple tasks need data from the graph, then a bookkeeper should be added to distribute data among the multiple tasks.

◆ setInputConnector()

template<class T, class U>
void htgs::TaskGraphConf< T, U >::setInputConnector ( std::shared_ptr< AnyConnector connector)
inline

Sets the input connector for the task graph configuration.

Parameters
connectorthe input connector

◆ setOutputConnector()

template<class T, class U>
void htgs::TaskGraphConf< T, U >::setOutputConnector ( std::shared_ptr< AnyConnector connector)
inline

Sets the output connector for the task graph configuration.

Parameters
connectorthe output connector

◆ updateTaskManagersAddressingAndPipelines()

template<class T, class U>
void htgs::TaskGraphConf< T, U >::updateTaskManagersAddressingAndPipelines ( )
inlinevirtual

Updates the task managers addresses, pipelineIds and the number of pipelines for all tasks in the TaskGraph.

Note
This function should only be called by the HTGS API

Implements htgs::AnyTaskGraphConf.


The documentation for this class was generated from the following files: