Some HPC workloads—particularly those sensitive to memory bandwidth or CPU cache contention—perform better when Hyper-Threading (HT) is disabled, reducing the active vCPU count to match the physical core count. This topic describes how to disable HT on compute nodes in an E-HPC cluster.
Limitations
Check which method applies to your instance type before proceeding:
| Instance type | HT behavior | Action required |
|---|---|---|
| Enterprise-level x86 compute-optimized ECS instances | Can be disabled only at instance creation time. Cannot be changed after the instance is created. | Configure HT when adding nodes to the cluster. |
| ECS Bare Metal Instances | Cannot be disabled directly at the hardware level. | Use a software-level method described in this topic. |
| Super Computing Cluster (SCC) instances | HT is disabled by default. | No action required. |
For the full list of enterprise-level x86 instance types that support disabling HT, see Instance type limits.
Background
Each compute node in an E-HPC cluster runs as an Elastic Compute Service (ECS) instance. By default, HT is enabled on every ECS instance. HT creates two virtual processing cores (vCPUs) per physical core, letting two threads run concurrently on a single core. Disabling HT reduces the vCPU count to match the physical core count.
Disable HT on enterprise-level x86 compute-optimized ECS instances
HT cannot be disabled on enterprise-level x86 compute-optimized ECS instances after they are created. Configure the HT setting when adding compute nodes to the cluster.
Manual scale-out
Auto scaling
Disable HT on ECS Bare Metal Instances
Physically disabling HT on bare metal servers requires BIOS configuration and a hardware restart, which is complex and disruptive. Instead, use one of the following software-level methods to achieve the same effect within the guest operating system.
These methods may affect running workloads. Evaluate the impact in a test environment before applying them in production.
Each physical core maps to two vCPUs. Both methods work by deactivating one vCPU per physical core, leaving one active vCPU per physical core—the same effective result as disabling HT at the hardware level.
Choose a method
Set nr_cpus | Change vCPU status | |
|---|---|---|
| Restart required | Yes | No |
lscpu output | Shows only active CPUs | Shows all CPUs, including offline ones |
| Persistence | Survives restarts | Resets on restart |
| Software licensing risk | Low | Some licenses count all CPUs, including offline ones |
| Custom image note | Delete nr_cpus before creating a custom image, or other instance types may not recognize all physical cores | No special action needed |
Setnr_cpus
Change vCPU status
This method takes vCPUs offline at runtime without restarting the instance. The settings reset if the instance is restarted. To restore all vCPUs, run the following command for each offline vCPU:
echo 1 > /sys/devices/system/cpu/cpu$cpunum/onlineThe following steps use an ecs.ebmc6me.16xlarge instance (64 vCPUs, CentOS 7) as an example.
Confirm that HT is enabled:
lscpuIn the output,
CPU(s)equals the full vCPU count andThread(s) per coreis2.~]# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 64 On-line CPU(s) list: 0-63 Thread(s) per core: 2 Core(s) per socket: 16 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 85 Model name: Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz Stepping: 7 CPU MHz: 2799.896 CPU max MHz: 3900.0000 CPU min MHz: 1000.0000 BogoMIPS: 4600.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 1024K L3 cache: 22528K NUMA node0 CPU(s): 0-15,32-47 NUMA node1 CPU(s): 16-31,48-63 Flags: fpu vme de pse tsc msr pae mce cx8 apic seCreate a script to take the second thread on each physical core offline:
vim test.shPaste the following content:
#!/bin/bash for cpunum in $(cat /sys/devices/system/cpu/cpu*/topology/thread_siblings_list | cut -s -d, -f2- | tr ',' '\n' | sort -un) do echo 0 > /sys/devices/system/cpu/cpu$cpunum/online doneRun the script:
sh test.shVerify the result:
lscpuThe expected output shows 32 vCPUs offline and
Thread(s) per core: 1. The response indicates that HT is disabled for the instance. To verify vCPU distribution across physical cores:lscpu --extendThe expected output shows 32 online vCPUs distributed across 32 physical cores.
# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 64 On-line CPU(s) list: 0-31 Off-line CPU(s) list: 32-63 Thread(s) per core: 1 Core(s) per socket: 16 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 85 Model name: Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz Stepping: 7 CPU MHz: 2800.036 CPU max MHz: 3900.0000 CPU min MHz: 1000.0000 BogoMIPS: 4600.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 1024K L3 cache: 22528K NUMA node0 CPU(s): 0-15 NUMA node1 CPU(s): 16-31 Flags: fpu vme de pse tsc msr pae mce cx8 apic s pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg f[root@iZuf6d2vgqoyhr~]# lscpu --extend CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE MAXMHZ MINMHZ 0 0 0 0 0:0:0:0 yes 3900.0000 1000.0000 1 0 0 1 1:1:1:0 yes 3900.0000 1000.0000 2 0 0 2 2:2:2:0 yes 3900.0000 1000.0000 3 0 0 3 3:3:3:0 yes 3900.0000 1000.0000 4 0 0 4 4:4:4:0 yes 3900.0000 1000.0000 5 0 0 5 5:5:5:0 yes 3900.0000 1000.0000 6 0 0 6 6:6:6:0 yes 3900.0000 1000.0000 7 0 0 7 7:7:7:0 yes 3900.0000 1000.0000 8 0 0 8 8:8:8:0 yes 3900.0000 1000.0000 9 0 0 9 9:9:9:0 yes 3900.0000 1000.0000 10 0 0 10 10:10:10:0 yes 3900.0000 1000.0000 11 0 0 11 11:11:11:0 yes 3900.0000 1000.0000 12 0 0 12 12:12:12:0 yes 3900.0000 1000.0000 13 0 0 13 13:13:13:0 yes 3900.0000 1000.0000 14 0 0 14 14:14:14:0 yes 3900.0000 1000.0000 15 0 0 15 15:15:15:0 yes 3900.0000 1000.0000 16 1 1 16 16:16:16:1 yes 3900.0000 1000.0000 17 1 1 17 17:17:17:1 yes 3900.0000 1000.0000 18 1 1 18 18:18:18:1 yes 3900.0000 1000.0000 19 1 1 19 19:19:19:1 yes 3900.0000 1000.0000 20 1 1 20 20:20:20:1 yes 3900.0000 1000.0000 21 1 1 21 21:21:21:1 yes 3900.0000 1000.0000 22 1 1 22 22:22:22:1 yes 3900.0000 1000.0000 23 1 1 23 23:23:23:1 yes 3900.0000 1000.0000 24 1 1 24 24:24:24:1 yes 3900.0000 1000.0000 25 1 1 25 25:25:25:1 yes 3900.0000 1000.0000 26 1 1 26 26:26:26:1 yes 3900.0000 1000.0000 27 1 1 27 27:27:27:1 yes 3900.0000 1000.0000 28 1 1 28 28:28:28:1 yes 3900.0000 1000.0000 29 1 1 29 29:29:29:1 yes 3900.0000 1000.0000 30 1 1 30 30:30:30:1 yes 3900.0000 1000.0000 31 1 1 31 31:31:31:1 yes 3900.0000 1000.0000 32 - - - ::: no - - 33 - - - ::: no - - 34 - - - ::: no - - 35 - - - ::: no - - 36 - - - ::: no - - 37 - - - ::: no - - 38 - - - ::: no - - 39 - - - ::: no - - 40 - - - ::: no - - 41 - - - ::: no - - 42 - - - ::: no - - 43 - - - ::: no - - 44 - - - ::: no - - 45 - - - ::: no - - 46 - - - ::: no - - 47 - - - ::: no - - 48 - - - ::: no - - 49 - - - ::: no - - 50 - - - ::: no - - 51 - - - ::: no - - 52 - - - ::: no - - 53 - - - ::: no - - 54 - - - ::: no - - 55 - - - ::: no - - 56 - - - ::: no - - 57 - - - ::: no - - 58 - - - ::: no - - 59 - - - ::: no - - 60 - - - ::: no - - 61 - - - ::: no - - 62 - - - ::: no - - 63 - - - ::: no - -