August 20, 2021 By Seetharami Seelam 2 min read

How to disable hyper-threading in IBM Cloud — best practices for HPC workloads.

Some high-performance computing (HPC) applications in EDA, weather, oil and natural gas and simulations in various domains benefit from running with hyper-threading (HT) disabled in the guest operating system. MPI application experts typically have handy tools to bind their MPI tasks to primary threads and leave the secondary threads idle. Software licensing issues and interference from OS threads that run these secondary threads cause issues for HPC applications, so some HPC experts prefer to disable hyper-threading altogether inside the guest virtual machines.

We have written a detailed document on how to disable HT through two different methods:  

  1. A user-level script that one could run inside the virtual machine
  2. Commands to disable at the boot time

The goal of this blog post is to give a short summary of these steps.

How to check if hyper-threading (HT) is on or off

Simply run the lscpu command and notice the output:

 [root@seelam-q-test ~]# lscpu
...
CPU(s):              8
On-line CPU(s) list: 0-7
Thread(s) per core:  2
...

Two threads per core indicate that the HT is on. If it is off, you will have one thread per core. 

How to turn hyper-threading off and on — the dynamic way

You can disable HT by simply writing a zero into the online field of the sys fs location for a given CPU. To turn off HT of core 0, the command would be: echo 0 > /sys/devices/system/cpu/cpu1/online

This disables HT on core 0 but the other cores are still running in HT mode. You can repeat the above process for all cores or use the handy script provided in the documentation.

Turning on HT requires writing a “1” into the `online` field. 

This gives full control to the end user as to when to turn on and off the HT mode and which cores to turn on and off.

How to turn hyper-threading off — the static way

In situations where you know up front that these nodes are used for HPC applications exclusively or they are created and destroyed dynamically, and the end user should not be bothered with such changes, HT can be disabled at boot time by posting the script below in the cloud-init User Data field:

#cloud-config
bootcmd:
 - 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; done

Conclusion

In this post, we showed how to disable hyper-threading in IBM Cloud virtual servers either by the end users or by the sys admins. Please refer to IBM Docs for detailed instructions. Try your HPC workloads on IBM Cloud directly or by using the HPC service and give us your feedback.

Was this article helpful?
YesNo

More from Cloud

Attention new clients: exciting financial incentives for VMware Cloud Foundation on IBM Cloud

4 min read - New client specials: Get up to 50% off when you commit to a 1- or 3-year term contract on new VCF-as-a-Service offerings, plus an additional value of up to USD 200K in credits through 30 June 2025 when you migrate your VMware workloads to IBM Cloud®.1 Low starting prices: On-demand VCF-as-a-Service deployments begin under USD 200 per month.2 The IBM Cloud benefit: See the potential for a 201%3 return on investment (ROI) over 3 years with reduced downtime, cost and…

24 IBM offerings winning TrustRadius 2024 Top Rated Awards

2 min read - TrustRadius is a buyer intelligence platform for business technology. Comprehensive product information, in-depth customer insights and peer conversations enable buyers to make confident decisions. “Earning a Top Rated Award means the vendor has excellent customer satisfaction and proven credibility. It’s based entirely on reviews and customer sentiment,” said Becky Susko, TrustRadius, Marketing Program Manager of Awards. Top Rated Awards have to be earned: Gain 10+ new reviews in the past 12 months Earn a trScore of 7.5 or higher from…

IBM Tech Now: April 8, 2024

< 1 min read - ​Welcome IBM Tech Now, our video web series featuring the latest and greatest news and announcements in the world of technology. Make sure you subscribe to our YouTube channel to be notified every time a new IBM Tech Now video is published. IBM Tech Now: Episode 96 On this episode, we're covering the following topics: IBM Cloud Logs A collaboration with IBM watsonx.ai and Anaconda IBM offerings in the G2 Spring Reports Stay plugged in You can check out the…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters