40 class TaskTimingReportHandle;
74 virtual void configure(TiXmlElement* eTask)
override;
75 void configure(TiXmlElement* eTask,
bool loadParameters);
77 void save(agx::TiXmlElement* parent)
const override;
115 EMPTY_BINDING_LIST = (1<<0),
116 PARAMETER_VALID = (1<<1),
117 PARAMETER_NOT_REQUIRED = (1<<2),
118 PARAMETER_BOUND = (1<<3),
119 PARAMETER_HAS_BOUND_PATH = (1<<4),
120 FORMATS_MATCH = (1<<5),
121 NEED_DEVICE_TRANSFORM = (1<<6),
124 MISSING_BINDING = (1<<7),
125 BINDING_LACKS_TYPE = (1<<8),
126 FORMATS_MISSMATCH = (1<<9),
127 EXTRA_BINDING = (1<<10),
128 INCONSISTEN_PARAMETERS = (1<<11),
132 MATCH_MASK = EMPTY_BINDING_LIST | PARAMETER_VALID | PARAMETER_NOT_REQUIRED | PARAMETER_BOUND | PARAMETER_HAS_BOUND_PATH | FORMATS_MATCH | NEED_DEVICE_TRANSFORM,
135 NO_MATCH_MASK = MISSING_BINDING | BINDING_LACKS_TYPE | FORMATS_MISSMATCH | EXTRA_BINDING | INCONSISTEN_PARAMETERS
159 bool isRunning()
const;
169 bool isEnabled()
const;
276 void print(std::ostream& stream)
const;
321 agx::UInt getNumAccumulationSamples()
const;
380 std::atomic<bool> m_running;
384 Timer m_overheadTimer;
396 Real32 m_accumulatedWallTime;
397 Real32 m_accumulatedComputeCost;
398 Real32 m_accumulatedOverheadTime;
399 UInt m_numAccumulations;
423 BindPath(
const Path& _path, Type _type) : path(_path), type(_type), binding(nullptr) {}
430 Vector<BindPath> m_bindPaths;
431 Path m_bindContextPath;
435 class DisableHelper :
public Referenced
438 DisableHelper(Task *task);
442 void registerSubtask(Task* subtask);
443 void removeSubtask(Task* subtask);
446 virtual ~DisableHelper();
455 UInt32 m_oldNumPostDependencies;
460 DisableHelperRef m_disableHelper;
462 static ProfilingMode s_profilingMode;
498 class SerialJob :
public Job
501 virtual ~SerialJob();
504 virtual void implementation()
override;
546 class PreJob :
public Job
552 virtual void implementation()
override;
555 class PostJob :
public Job
561 virtual void implementation()
override;
564 class DispatchJob :
public Job
567 virtual ~DispatchJob();
570 virtual void implementation()
override;
576 DispatchJob m_dispatchJob;
578 Index m_jobIndexCounter;
591 bool isSequential()
const;
660 void registerSubtask(
Task* subtask);
664 class PreJob :
public Job
670 virtual void implementation()
override;
673 class PostJob :
public Job
679 virtual void implementation()
override;
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGX_DECLARE_VECTOR_TYPES(type)
Only use as member allocated variable.
Abstract representation of a value.
Templated callback with one argument.
A component is an object containing other objects, enabling hierarchical structuring.
static CpuDevice * instance()
An agx::Device is an abstract representation of a device on which data can be stored and processed.
An event with one argument.
An event with two arguments.
An abstract job/workblock representation, which allows work threads to execute arbitrary tasks.
Inheritance with partial specialization due to bug with ref_ptr containers.
A model is an abstract representation of the class of an agx::Object.
Representation of a name string.
agx::Object is a refcounted object with a name.
ParallelTask(const agx::Name &name, const agx::Job::Callback &dispatchCallback, agx::Device *device=agx::CpuDevice::instance())
ParallelTask(const agx::Name &name, agx::Device *device=agx::CpuDevice::instance())
void setDispatch(const agx::Job::Callback &dispatchCallback)
virtual agx::Job * getPreJob() override
virtual agx::Job * getPostJob() override
virtual void setTargetThread(agx::Thread *thread) override
Set a specific thread which must execute this task.
void removeAllJobs()
Remove all jobs (except the original pre/dispatch/post jobs)
void addJob(agx::Job *job)
Add a job to the task.
A representation of a task/kernel parameter, which can be bound using a string path or explicitly to ...
Representation of a path, a list of name components.
SerialTask(const agx::Name &name, const Job::Callback &runCallback, agx::Device *device=agx::CpuDevice::instance())
SerialTask(const agx::Name &name, agx::Device *device=agx::CpuDevice::instance())
virtual agx::Job * getPostJob() override
virtual agx::Job * getPreJob() override
void setDispatch(const Job::Callback &dispatchCallback)
Specify the task dispatch to execute.
virtual void run()
Execution callback.
virtual void setTargetThread(agx::Thread *thread) override
Set a specific thread which must execute this task.
void serialize(bool recursive=false)
Serialize the task.
void setSequential(bool flag)
void removeSubtask(const agx::Name &name)
Remove a subtask by name.
void addSubtaskAfter(agx::Task *subtask, agx::Task *parent)
Add a subtask to be executed after a specified task.
void addSubtaskBetween(agx::Task *subtask, agx::Task *parent, agx::Task *child)
Add a subtask between two existing tasks.
agx::Task * getSubtask(const agx::String &name, size_t index=0)
void addSubtaskBefore(agx::Task *subtask, agx::Task *child)
Add a subtask to be executed before a specified task.
void addSubtaskBefore(agx::Task *subtask, const agx::String &child)
virtual agx::Job * getPreJob() override
void addSubtask(agx::Task *subtask)
Add a subtask.
void addSubtaskBetween(agx::Task *subtask, const agx::String &parent, const agx::String &child)
void addSubtaskAfter(agx::Task *subtask, const agx::String &parent)
virtual void setTargetThread(agx::Thread *thread) override
Set a specific thread which must execute this task.
void removeSubtask(agx::Task *subtask)
Remove a subtask.
virtual agx::Job * getPostJob() override
bool isSequential() const
void removeAllSubtasks()
Remove all subtasks.
void writeDependencyDotGraph() const
TaskGroup(const agx::Name &name, bool isSequential=true, agx::Device *device=agx::CpuDevice::instance())
const agx::TaskRefVector & getSubtasks() const
virtual void traverse(const Callback1< Task * > &callback, bool breadthFirst=true)
A representation of a generic task.
ExecutionEvent completionEvent
Triggered after the task has completed.
virtual void wait()
Block until the task has completed execution.
virtual void rebind() override
void connectToChild(Task *descendant)
agx::Thread * getTargetThread()
const agx::TaskPtrVector & getParents() const
void addParameter(agx::Parameter *parameter, size_t index)
void addDependency(agx::Task *parent)
Add a dependency.
static void setProfilingMode(ProfilingMode mode)
void setEnable(bool flag)
Enable/disable a task.
static Task * load(const String &path, Device *device=CpuDevice::instance())
Event2< Task *, Parameter * > ParameterEvent
void removeDependency(agx::Task *parent)
Remove a dependency.
static Task * load(TiXmlElement *eTask, Device *device)
bool hasDependency(agx::Task *parent) const
ParameterEvent removeParameterEvent
Triggered when a parameter is removed.
static bool hasUnhandledException()
void prepareGlobalResultSorting(size_t numJobs)
virtual void setContext(agx::Object *context) override
void disconnectFromParent(Task *ancestor)
agx::Parameter * getParameter(const agx::Name &name)
ExecutionEvent startEvent
Triggered before the task begins.
virtual void setTargetThread(agx::Thread *thread)
Set a specific thread which must execute this task.
void registerBufferReadersAndWriters()
UInt32 matchParameters(agx::ParameterBindingVector &bindings, bool allowFormatPromotions)
UInt32 matchParameters(const ParameterTable &bindings)
void removeParameter(size_t index)
void save(agx::TiXmlElement *parent) const override
ParameterMatch
Used for tracing mismatched parameter bindings.
static void addConnection(Task *parent, Task *child)
UInt32 matchParameters(const agx::ParameterBindingVector &bindings)
virtual agx::Job * getPostJob()=0
virtual Object * getResourceImpl(const Path &path, agx::Model *model) override
static Task * load(const Path &path, const Name &implementation, agx::ParameterBindingVector ¶meterList, bool allowFormatPromotions, Device *device=CpuDevice::instance())
void dispatchBlocking(Thread *thread)
void setGroup(TaskGroup *group)
void addTriggerPath(const agx::Path &path)
virtual void configure(TiXmlElement *eTask) override
void addDependency(const agx::Path &path)
void unregisterBufferReadersAndWriters()
ParameterEvent addParameterEvent
Triggered when a parameter is added.
void addTriggerPaths(const agx::String &paths)
agx::PointerParameter * getPointerParameter(const agx::Name &name)
const agx::ParameterPtrVector & getParameters() const
agx::Real32 getOverheadTime() const
static void printParameterMatch(UInt32 parameterMatch)
virtual void parameterAddedCallback(Parameter *)
static Task * load(const Path &path, const Name &implementation, Device *device=CpuDevice::instance())
agx::Thread * getDispatchThread()
void addResolvePaths(const agx::String &paths)
static ProfilingMode getProfilingMode()
void enableCallback(agxData::Value *enable)
static void removeConnection(Task *parent, Task *child)
void connectToParent(Task *ancestor)
const agx::TaskPtrVector & getChildren() const
Event1< Task * > ExecutionEvent
virtual agx::Job * getPreJob()=0
void print(std::ostream &stream) const
void printBindings(std::ostream &stream)
virtual void parameterRemovedCallback(Parameter *)
agx::UInt getNumAccumulationSamples() const
static Task * load(const char *path, Device *device=CpuDevice::instance())
static Task * load(const Path &path, const Name &implementation, const agx::ParameterBindingVector ¶meterList, Device *device=CpuDevice::instance())
Task(const agx::Name &name, agx::Device *device=agx::CpuDevice::instance())
Constructor.
void addParameter(agx::Parameter *parameter)
Add a parameter.
static Task * load(const Path &path, Device *device=CpuDevice::instance())
agx::TaskGroup * getGroup()
static void signalUnhandledException()
void endCallback(agx::Real32 computeCost, agx::Real32 overheadCost=0)
void traverse(const Callback1< Task * > &callback, bool breadthFirst=true)
void addDependencies(const agx::String &paths)
agx::Real32 getWallTime() const
Performance statistics.
static agx::Model * ClassModel()
agx::ScalarParameter * getScalarParameter(const agx::Name &name)
void removeParameter(agx::Parameter *parameter)
Remove a parameter.
agx::Real32 getAccumulatedWallTime() const
agx::ArrayParameter * getArrayParameter(const agx::Name &name)
void replace(agx::Task *other)
Replace the task with another task by rerouting the dependencies.
void resetAccumulationTimers(bool recursive=true)
Reset accumulated performance statistics.
void execute()
Execute the task.
virtual void subtaskAddedCallback(Task *)
void setModel(agx::Model *model)
agx::Real32 getAccumulatedComputeCost() const
void configure(TiXmlElement *eTask, bool loadParameters)
agx::Real32 getAccumulatedOverheadTime() const
agx::Real32 getComputeCost() const
agxData::Val< Bool > enableParameter
Enable/disable the task, normally use setEnable/isEnabled instead.
void addResolvePath(const agx::Path &path)
void disconnectFromChild(Task *descendant)
agx::Thread is a representation of an OS specific implementation of a computational thread.
The Timer class permits timing execution speed with the same refinement as the built in hardware cloc...
Vector containing 'raw' data.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::observer_ptr< Object > ObjectObserver
VectorPOD< class Job * > JobPtrVector
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
agx::ref_ptr< Object > ObjectRef