CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Hardware

About hyperthreading in CFD

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By flotus1
  • 1 Post By flotus1

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 11, 2023, 11:48
Default About hyperthreading in CFD
  #1
Member
 
Song Young Ik
Join Date: Apr 2022
Location: South Korea
Posts: 57
Rep Power: 4
songyi719 is on a distinguished road
I heard that hyperthreading doesn't help in CFD, including openfoam


So, for example lets say that I have 8 core 16 thread cpu.
Then If I use MPI and set core to n=8, does it show almost same effect with n=16? Or former one use 4 core with HT and latter use 8 core with HT so make difference?


In hardware info thread, it explains about core, and in graph they show x axis as thread but actually used # of core, so I am very confused now...


songyi719 is offline   Reply With Quote

Old   July 11, 2023, 12:43
Default
  #2
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,399
Rep Power: 46
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
X-axis in my graphs is usually threads. Which is supposed to mean software threads.
It is further implied that each software thread runs on its own physical core exclusively.

Simultaneous multi-threading (SMT) or Hyperthreading does not add many compute resources to a physical core. It's mostly a few additional registers, to have two or more threads running on the same physical core, at the same time.
Without going into an unnecessary amount of detail: SMT generally doesn't help with CFD. It can improve calculation speed a bit, with low core count CPUs. I.e. in situations where the memory subsystem is not a limiting factor.
But when given the choice between a 4-core CPU with SMT2, and a similar CPU with 8 physical cores, the latter will always be faster. Not just for CFD.
wkernkamp and songyi719 like this.
flotus1 is offline   Reply With Quote

Old   July 12, 2023, 05:51
Default
  #3
Member
 
Song Young Ik
Join Date: Apr 2022
Location: South Korea
Posts: 57
Rep Power: 4
songyi719 is on a distinguished road
Quote:
Originally Posted by flotus1 View Post
X-axis in my graphs is usually threads. Which is supposed to mean software threads.
It is further implied that each software thread runs on its own physical core exclusively.

Simultaneous multi-threading (SMT) or Hyperthreading does not add many compute resources to a physical core. It's mostly a few additional registers, to have two or more threads running on the same physical core, at the same time.
Without going into an unnecessary amount of detail: SMT generally doesn't help with CFD. It can improve calculation speed a bit, with low core count CPUs. I.e. in situations where the memory subsystem is not a limiting factor.
But when given the choice between a 4-core CPU with SMT2, and a similar CPU with 8 physical cores, the latter will always be faster. Not just for CFD.
Thank you very much!

I have one question related to this. I saw many people suggest to turn off hyperthreading form BIOS. But when we use program such as openfoam with MPI, MPI doesn't use hyperthreaded cores, but only one slot per physical core. Does it make difference too?
songyi719 is offline   Reply With Quote

Old   July 12, 2023, 06:23
Default
  #4
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,399
Rep Power: 46
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
With everything installed correctly, all software and hardware versions being compatible to each other, and running your software the "right" way, disabling SMT should not be necessary these days.
Caveat here is "should". Turning it off is just one thing less to worry about, when you have a dedicated CFD/FEA machine.
Chris2337 likes this.
flotus1 is offline   Reply With Quote

Old   July 15, 2023, 16:09
Default
  #5
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
MPI does not know which core is physical and which is virtual. MPI cannot tell threads to only use physical cores. The job scheduler decides which cores (physical or hyperthreaded) to use. And more importantly, you must know the correct number of threads to tell the mpi to launch.

Hyperthreading can be on or off but you need to understand the differences for each case as a user. For example, with hyperthreading on, you should only launch 1-8, or 16 mpithreads and never 9-15. With hyperthreading off, you should only launch 1-8 threads and never 9-16 (or over 9000). Using the wrong number will make the case run slower with HT or without HT.

Hyperthreading is recommended to be off because it simplifies things and makes everything idiot proof. It doesn't help anyway and it is much easier to explain to someone, always use 8 threads. There is simply less to explain.
LuckyTran is offline   Reply With Quote

Old   July 16, 2023, 15:54
Default
  #6
Senior Member
 
Will Kernkamp
Join Date: Jun 2014
Posts: 316
Rep Power: 12
wkernkamp is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
MPI does not know which core is physical and which is virtual. MPI cannot tell threads to only use physical cores. The job scheduler decides which cores (physical or hyperthreaded) to use. And more importantly, you must know the correct number of threads to tell the mpi to launch.

Hyperthreading can be on or off but you need to understand the differences for each case as a user. For example, with hyperthreading on, you should only launch 1-8, or 16 mpithreads and never 9-15. With hyperthreading off, you should only launch 1-8 threads and never 9-16 (or over 9000). Using the wrong number will make the case run slower with HT or without HT.

Hyperthreading is recommended to be off because it simplifies things and makes everything idiot proof. It doesn't help anyway and it is much easier to explain to someone, always use 8 threads. There is simply less to explain.
The mpi job scheduler on linux does know which threads to launch. It will automatically distribute one thread per core first. You can check which threads are running using htop. It is not complicated.
wkernkamp is offline   Reply With Quote

Old   July 20, 2023, 16:51
Default
  #7
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
You are mixing up an mpi which is just a protocol and a job scheduler. And yes of course every job scheduler (as I clearly said) desires to spread out jobs. But consider that you are a typical office analyst with 100 browser tabs open, youtube videos playing, spotify sreaming music to your headset, CREO open trying to rebuild a model, your manager is telling you to finish your timesheet, and now you go launch your CFD,and more and more. How does the job scheduler know you want to spread your job out across only physical cores when your machine is already 100% loaded? The answer is the infamous "Warning: processor affinity not set"
LuckyTran is offline   Reply With Quote

Old   July 23, 2023, 20:07
Default
  #8
Senior Member
 
Will Kernkamp
Join Date: Jun 2014
Posts: 316
Rep Power: 12
wkernkamp is on a distinguished road
If that is your problem then you can tell mpi exactly where you want your threads to run.
wkernkamp is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cfd to ansys thermal to ansys structural interface ssixr ANSYS 17 July 31, 2015 15:18
STAR-Works : Mainstream CAD with CFD CD adapco Group Marketing Siemens 0 February 13, 2002 12:23
Where do we go from here? CFD in 2001 John C. Chien Main CFD Forum 36 January 24, 2001 21:10
ASME CFD Symposium, Atlanta, July 2001 Chris R. Kleijn Main CFD Forum 0 August 21, 2000 04:49
Which is better to develop in-house CFD code or to buy a available CFD package. Tareq Al-shaalan Main CFD Forum 10 June 12, 1999 23:27


All times are GMT -4. The time now is 02:31.