Hyperthreading for CFD

Background

Plenty of noise has been made online about the use of hyperthreading  in CFD, the most vocal oppose the use of hyperthreading, very few seem to advocate the use of hyperthreading, and fewer still offer anything to substantiate their arguments. With very few studies available this little experiment was undertaken to understand the benefits or drawbacks to hyperthreading.

What is Hyperthreading?

Hyperthreading is an Intel technology that creates virtual processors. Typically each physical processor is split into two, so a dual core CPU has four threads, a quad core CPU has eight threads, and so on. Although this doesn’t increase the peak processing power of the processor it enables tasks to be performed simultaneously if the entire resource hasn’t been used.

Test Setup

Software

Software

  • OS: Fedora 23, 64 Bit
  • Solver: OpenFOAM 3.0.1
  • Compiler: GCC 5.3.1
  • MPI: Open MPI 1.8.8

Hardware

Hardware

  • CPU: Intel Core i7 950 – Quad Core – 8 Thread – 3.07 GHz
  • RAM: 14 GB RAM


Mesh & Solver Settings

The study was performed using the OpenFOAM motorcycle tutorial case with a refined mesh. The base (blockmesh) was increased in resolution so that the final volume mesh (snappyhexmesh) contained 1.9 million cells. Cell aspect ratio was maintained at unity. Flow solver parameters do not differ from the tutorial: 20 m/s velocity, RANS k-omega SST and respective wall functions for k and omega.

OpenFOAM's Motorcycle Test Case

The Experiment

The experiment was simple, using the same mesh create two solution to decompose the case to run using MPI for four (per-core) and eight (per-thread) processes. The decomposition was performed using Scotch, which balances the number of cells per processor. OpenFOAM uses Message Passing Interface (MPI) that allows explicit control of the number of ‘processors’ to be used. This was set to four and eight in order to test per-core and per-thread performance respectively. The solution was carried for 4000 iterations, the convergence/residual history was similar for both cases.

[wp_charts title=”barchart” type=”bar” align=”aligncenter” margin=”0 auto” datasets=”100,94.84″ labels=”Per-Core,Per-Thread”]

When comparing absolute time there is a saving of 1971 seconds/ 33 minutes. Without  hyperthreading the solution took 10.6 hours to reach 4000 iterations, with hyperthreading it took 10 hours.

When comparing percentage difference, there was approximately a 6% time saving by using hyperthreading over not using hyperthreading.

The Literature

A team working for NASA’s Advanced Supercomputing Division at the Ames facility wrote a paper in 2011 titled: “The Impact of Hyper-Threading on Processor Resource Utilization in Production Applications“.  They conclude that generally speaking hyperthreading is beneficial for a range of CFD solvers, particularly in the case of unstructured grid compared to structured.

tl:dr (synopsis)

Although hyperthreading does not linearly improve the solution time, that is to say a two thread run isn’t twice the speed of a single core run, there is still a small saving. It can be concluded that hyperthreading isn’t of critical importance to the performance of a CFD solution, but when available should be utilised for a small performance gain.