Class Scheduler

Base Type

Derived Type

class Scheduler : public holoscan::Component

Base class for all schedulers.

This class is the base class for all schedulers including holoscan::MultiThreadScheduler and holoscan::GreedyScheduler. It is used to define the common interface for all schedulers.

Subclassed by holoscan::gxf::GXFScheduler

Public Functions

Scheduler() = default

Scheduler(Scheduler&&) = default

template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<Scheduler, std::decay_t<ArgT>> && (std::is_same_v<Arg, std::decay_t<ArgT>> || std::is_same_v<ArgList, std::decay_t<ArgT>>)>>
inline explicit Scheduler(ArgT &&arg, ArgsT&&... args)

Construct a new Scheduler object.

~Scheduler() override = default

inline Scheduler &id(int64_t id)

Set the Scheduler ID.

Parameters

id – The ID of the scheduler.

Returns

The reference to this scheduler.

inline Scheduler &name(const std::string &name) &

Set the name of the scheduler.

Parameters

name – The name of the scheduler.

Returns

The reference to the scheduler.

inline Scheduler &&name(const std::string &name) &&

Set the name of the scheduler.

Parameters

name – The name of the scheduler.

Returns

The reference to the scheduler.

inline Scheduler &fragment(Fragment *fragment)

Set the fragment of the scheduler.

Parameters

fragment – The pointer to the fragment of the scheduler.

Returns

The reference to the scheduler.

inline Scheduler &spec(const std::shared_ptr<ComponentSpec> &spec)

Set the component specification to the scheduler.

Parameters

spec – The component specification.

Returns

The reference to the scheduler.

inline ComponentSpec *spec()

Get the component specification of the scheduler.

Returns

The pointer to the component specification.

inline std::shared_ptr<ComponentSpec> spec_shared()

Get the shared pointer to the component spec.

Returns

The shared pointer to the component spec.

inline void add_arg(const std::shared_ptr<Resource> &arg)

Add a resource to the scheduler.

Parameters

arg – The resource to add.

inline void add_arg(std::shared_ptr<Resource> &&arg)

Add a resource to the scheduler.

Parameters

arg – The resource to add.

inline std::unordered_map<std::string, std::shared_ptr<Resource>> &resources()

Get the resources of the scheduler.

Returns

The resources of the scheduler.

inline virtual void setup(ComponentSpec &spec)

Define the scheduler specification.

Parameters

spec – The reference to the component specification.

virtual void initialize() override

Initialize the scheduler.

This function is called after the scheduler is created by holoscan::Fragment::make_scheduler().

inline int64_t id() const

Get the identifier of the component.

By default, the identifier is set to -1. It is set to a valid value when the component is initialized.

With the default executor (GXFExecutor), the identifier is set to the GXF component ID.

Returns

The identifier of the component.

inline void add_arg(const Arg &arg)

Add an argument to the component.

Parameters

arg – The argument to add.

inline void add_arg(Arg &&arg)

Add an argument to the component.

Parameters

arg – The argument to add.

inline void add_arg(const ArgList &arg)

Add a list of arguments to the component.

Parameters

arg – The list of arguments to add.

inline void add_arg(ArgList &&arg)

Add a list of arguments to the component.

Parameters

arg – The list of arguments to add.

Protected Attributes

std::shared_ptr<ComponentSpec> spec_

The component specification.

std::unordered_map<std::string, std::shared_ptr<Resource>> resources_

The resources used by the scheduler.

© Copyright 2022-2023, NVIDIA. Last updated on Sep 13, 2023.