legate::mapping::Machine#

class Machine#

Machine descriptor class.

A Machine object describes the machine resource that should be used for a given scope of execution. By default, the scope is given the entire machine resource configured for this process. Then, the client can limit the resource by extracting a portion of the machine and setting it for the scope using MachineTracker. Configuring the scope with an empty machine raises a std::runtime_error exception.

Public Functions

TaskTarget preferred_target() const#

Preferred processor type of this machine descriptor.

Returns:

Task target

ProcessorRange processor_range() const#

Returns the processor range for the preferred processor type in this descriptor.

Returns:

A processor range `

ProcessorRange processor_range(TaskTarget target) const#

Returns the processor range for a given processor type.

If the processor type does not exist in the descriptor, an empty range is returned

Parameters:

target – Processor type to query

Returns:

A processor range

const std::vector<TaskTarget> &valid_targets() const#

Returns the valid task targets within this machine descriptor.

Returns:

Task targets

std::vector<TaskTarget> valid_targets_except(
const std::set<TaskTarget> &to_exclude
) const#

Returns the valid task targets excluding a given set of targets.

Parameters:

to_excludeTask targets to exclude from the query

Returns:

Task targets

std::uint32_t count() const#

Returns the number of preferred processors.

Returns:

Processor count

std::uint32_t count(TaskTarget target) const#

Returns the number of processors of a given type.

Parameters:

target – Processor type to query

Returns:

Processor count

std::string to_string() const#

Converts the machine descriptor to a human-readable string.

Returns:

Machine descriptor in a string

Machine only(TaskTarget target) const#

Extracts the processor range for a given processor type and creates a fresh machine descriptor with it.

If the target does not exist in the machine descriptor, an empty descriptor is returned.

Parameters:

target – Processor type to select

Returns:

Machine descriptor with the chosen processor range

Machine only(const std::vector<TaskTarget> &targets) const#

Extracts the processor ranges for a given set of processor types and creates a fresh machine descriptor with them.

Any of the targets that does not exist will be mapped to an empty processor range in the returned machine descriptor

Parameters:

targets – Processor types to select

Returns:

Machine descriptor with the chosen processor ranges

Machine slice(
std::uint32_t from,
std::uint32_t to,
TaskTarget target,
bool keep_others = false
) const#

Slices the processor range for a given processor type.

Parameters:
  • from – Starting index

  • to – End index

  • target – Processor type to slice

  • keep_others – Optional flag to keep unsliced ranges in the returned machine descriptor

Returns:

Machine descriptor with the chosen procssor range sliced

Machine slice(
std::uint32_t from,
std::uint32_t to,
bool keep_others = false
) const#

Slices the processor range for the preferred processor type of this machine descriptor.

Parameters:
  • from – Starting index

  • to – End index

  • keep_others – Optional flag to keep unsliced ranges in the returned machine descriptor

Returns:

Machine descriptor with the preferred processor range sliced

Machine operator[](TaskTarget target) const#

Selects the processor range for a given processor type and constructs a machine descriptor with it.

This yields the same result as .only(target).

Parameters:

target – Processor type to select

Returns:

Machine descriptor with the chosen processor range

Machine operator[](const std::vector<TaskTarget> &targets) const#

Selects the processor ranges for a given set of processor types and constructs a machine descriptor with them.

This yields the same result as .only(targets).

Parameters:

targets – Processor types to select

Returns:

Machine descriptor with the chosen processor ranges

Machine operator&(const Machine &other) const#

Computes an intersection between two machine descriptors.

Parameters:

otherMachine descriptor to intersect with this descriptor

Returns:

Machine descriptor

bool empty() const#

Indicates whether the machine descriptor is empty.

A machine descriptor is empty when all its processor ranges are empty

Returns:

true The machine descriptor is empty

Returns:

false The machine descriptor is non-empty