Network topology-aware scheduling in AWS PCS
The instances in an AWS Region are connected through a hierarchy of network switches. Instances under the same switch communicate over fewer network hops. Traffic between instances under different switches crosses higher levels of the hierarchy. Tightly coupled multi-node jobs, such as Message Passing Interface (MPI) jobs, run faster when their nodes are close together.
With network topology-aware scheduling, AWS PCS tells Slurm where each compute node sits in
the network. Slurm's topology/tree
Slurm chooses among the nodes available at that time, so the allocation can still span
more switches than optimal. You can limit how many leaf switches a job uses with the
--switches option.
This topic describes how to enable network topology-aware scheduling on a queue, how AWS PCS discovers the topology, and what affects the result. For the topology inside a node, such as CPU topology and GPU affinity, see Configuring hardware topology in AWS PCS.
On compute nodes in compute node groups created before November 1, 2026, the network topology might not match where the node sits in the network. AWS PCS will correct the network topology of these compute nodes over the coming weeks. This page will be updated when that is complete.
Requirements
-
The cluster uses Slurm 26.05 or later.
-
The queue has no UltraServer compute node groups. UltraServer queues use block topology instead. For more information, see UltraServer queues.
-
To get a full switch path for each node, the compute node groups of the queue use instance types that support Amazon EC2 instance topology. For more information, see Supported instance types.
Enable network topology-aware scheduling on a queue
Network topology-aware scheduling is off by default. You enable it per queue with the
Topology custom Slurm setting, which accepts the following values:
-
network-tree– Slurm allocates the jobs of the queue by network topology. -
flat– Slurm treats all nodes of the queue as equally close. This is the same as not settingTopology.
You can set Topology when you create or update a queue. For the full queue
update procedure, see Updating an AWS PCS queue.
The change takes effect when the queue update completes. The update doesn't affect
running jobs or replace running nodes. AWS PCS assigns their topology shortly after the update. To
disable network topology-aware scheduling, set Topology to flat or
remove the setting.
A compute node group can belong both to a queue that uses network-tree and
to a queue that doesn't. The topology of its nodes only affects jobs in the
network-tree queue.
Network topology discovery
When a compute node launches, AWS PCS reads its position in the network from Amazon EC2 and assigns it to the Slurm node. The position is a switch path from the root of the tree to the switch the node is attached to:
-
sw-root– The root of the tree, shared by all nodes. -
Region and Availability Zone ID – The AWS Region and Availability Zone of the node. Nodes in different Availability Zones share only the top of the tree.
-
Network nodes – The network nodes that Amazon EC2 returns for the instance under its Availability Zone, from the broadest to the narrowest. For more information, see Amazon EC2 instance topology in the Amazon Elastic Compute Cloud User Guide.
For example, a node in the euw1-az1 Availability Zone of eu-west-1 has the
following topology:
network-tree:sw-root:eu-west-1:euw1-az1:nn-bb:nn-cc
AWS PCS assigns the topology asynchronously, on a best-effort basis, and doesn't delay scheduling for it.
Until AWS PCS assigns topology to a compute node, the node is under a default switch,
sw-default, with the other compute nodes that don't have topology yet. Slurm
treats those nodes as equally close, and can schedule jobs on them in the meantime.
When a node powers down, it goes back under sw-default, and AWS PCS assigns
its topology again the next time it launches. The switches that AWS PCS added for the node
stay in the output of scontrol show topology with no nodes, until the Slurm
controller reloads its configuration.
To see the switch tree and the topology of a node, run the following commands on the cluster:
scontrol show topology network-tree scontrol show nodenode-name
Supported instance types
Amazon EC2 returns network topology only for some instance types. For the list, see Prerequisites for Amazon EC2 instance topology in the Amazon Elastic Compute Cloud User Guide.
AWS PCS places nodes of other instance types under a single switch in their Availability Zone, named after the Availability Zone ID, for example:
network-tree:sw-root:eu-west-1:euw1-az1:euw1-az1-standard
Slurm treats all of these compute nodes as one hop apart, regardless of their actual position in the network, and only separates them by Availability Zone.
Mixed instance type queues
If a network-tree queue includes both instance types that support
instance topology and types that don't, Slurm allocates jobs less precisely than in a
queue that has only supported instance types:
-
Because all compute nodes of unsupported instance types in an Availability Zone appear one hop apart, Slurm can prefer them over supported nodes for multi-node jobs.
-
Slurm allocates a job that spans both kinds of nodes through the Availability Zone switch.
-
On compute nodes of unsupported instance types,
--switchesdoesn't keep a job close together in the network. Slurm counts all of these compute nodes in an Availability Zone as being under one switch, so any allocation of them within one Availability Zone meets the limit.
All nodes stay schedulable. To get the most from network topology-aware scheduling,
use separate queues for supported and unsupported instance types, or use
--constraint to keep tightly coupled jobs on supported instance types.
Best practices
To get the most from network topology-aware scheduling, follow these practices:
-
Use a cluster placement group – A cluster placement group packs instances close together in one Availability Zone, so Slurm has more nodes under the same switches to choose from. For more information, see Placement groups for EC2 instances in AWS PCS.
-
Keep a queue in one Availability Zone – If a queue spans Availability Zones and one Availability Zone doesn't have enough available nodes, Slurm can allocate a multi-node job across Availability Zones. Traffic between Availability Zones has higher latency.
-
Limit the number of switches for a job – Use the
--switches=option ofcount[@max-time]sbatch,salloc, orsrunto ask Slurm to allocate a job under at mostcountleaf switches. Slurm waits up tomax-timefor them. This is best effort, because AWS PCS assigns topology asynchronously. Nodes that don't have their topology yet count as being under the same default switch. Slurm also allocates idle nodes that are running before nodes that are powered down, even if the powered-down nodes are closer together in the network. For more information, see --switchesin the Slurm documentation.
UltraServer queues
A Slurm partition uses one topology. Queues with UltraServer compute node groups use block topology, so that jobs stay within an UltraServer. For more information, see Configure UltraServer instances.
AWS PCS rejects the Topology setting on a queue with UltraServer compute node
groups. AWS PCS also rejects a compute node group update that would add UltraServer capacity
to a queue that sets Topology.