dragon.native.machine

The Dragon native machine interface provides hardware related functionality.

These calls return various hardware properties of the system(s), like the number of processors or a list of all nodes.

Functions

cpu_count()

Return the number of CPUs in this system.

current()

Return a node object for this process.

Classes

Node

System

System abstraction representing the collection of nodes in the Dragon runtime.

cpu_count() → int[source]

Return the number of CPUs in this system.

Returns:

integer representing the number of cpus

class Node[source]

Bases: object

__init__(ident: str)[source]

A class abstracting the current hardware node.

Parameters:

ident (str or int) – name or h_uid of the node to request.

property name: str

Return the Dragon name of this node. Use Node.hostname for the hostname.

Returns:

The name of the node

Return type:

str

property h_uid: int

The unique global identifier of this node.

Returns:

the h_uid

Return type:

int

property ip: str

Return the IPv4 address of this node

Returns:

The addres

Return type:

str

property num_cpus: int

Return the number of CPUs of this node.

Returns:

The number of CPUs

Return type:

int

property num_gpus: int

Return a the number of GPUs on this node

Returns:

The number of GPUs

Return type:

list[int]

property physical_mem: int

Return the physical memory of this node.

Returns:

Physical memory in bytes

Return type:

int

property gpus: list[int]

Return a list of GPU visible devices on this node

Returns:

list of GPU visible devices

Return type:

list[int]

property gpu_vendor: str

Return the name of the GPU Vendor on this node

Returns:

GPU vendor name

Return type:

str

property gpu_env_str: str

Return the environment variable used by GPU Vendor to define GPU affinity

Returns:

GPU environment variable string

Return type:

str

property cpus: list[int]

Return the CPUs available on this node

Returns:

list of CPUs

Return type:

list[int]

property hostname: str

Host name of the node in the network.

This is not the Dragon internal name (Node.name) for this node.

Returns:

The hostname

Return type:

str

property is_primary: bool

Returns true if this is the primary node for the runtime. The primary node is important in that it is the node with global services.

Returns:

is the primary node

Return type:

bool

current() → Node[source]

Return a node object for this process.

current() can be imported from the top-level Dragon or dragon.native.machine modules.

from dragon import current

or

from dragon.native.machine import current
Returns:

Node object

Return type:

Node

class System[source]

Bases: object

System abstraction representing the collection of nodes in the Dragon runtime. Provides access to node information, primary node, and policies for CPU and GPU placement.

System can be imported from the top-level Dragon or dragon.native.machine modules.

from dragon import System

or

from dragon.native.machine import System
__init__()[source]

A stub of a system abstraction

property nodes
property nnodes: int
property primary_node: Node
property restarted: bool

Helper function to check environment and determine if the runtime was previously restarted

Returns:

true if the runtime was restarted

Return type:

bool

hostname_policies() → list[Policy][source]

Generate a list of policies that use all of the nodes in the allocation specified by hostname

Returns:

a list of policies where each policy specifies hostname placement and the hostname, without duplication

Return type:

list[Policy]

gpu_policies() → list[Policy][source]

Generate a list of policies that use all of the GPUs in the allocation

Returns:

a list of policies where each policy specifies hostname placement, the hostname, and a gpu on the node, without duplication

Return type:

list

static cpu_count() → int[source]

Return the number of CPUs in this system.

Returns:

integer representing the number of cpus

Return type:

int