Sunday, 22 January 2023

Test Hyperthreading on/off in Fluent

Hyperthreading is intel's brand name for simultaneous multithreading. For the purposes of this test, I'm not going to get too deep into the technical specifics. It is in basic terms a way for each of a computer's CPU cores to do two things at once. Because most windows PCs use intel chips, most PCs come with hyperthreading. This is why the number of CPU "cores" displayed on windows computers, for example, in "device manager", is typically double the number of physcial cores that actually exist on the CPU. For example a CPU with 8 physical cores will display as 16 cores in device manager when hyperthreading is turned on. 

Reportedly, Fluent can perform better with hyperthreading turned off. However, there is conflicting information online about whether this is actually true. Reportedly, Ansys have also made recent improvements to the software so that Fluent can exploit hyperthreading. I've recently come into posession of an old workstation PC, which I am setting up for running CFD simulations. As part of this setup I decided to check whether turning hyperthreading on/off actually changed the performance. This is by no means a thorough test. Reportedly, the difference turning hyperthreading on/off makes to Fluent is also case-dependent, and the only way to know is to try it for yourself. It is difficult, going by what you read online, to know whether or not turning off hyperthreading is something you should consider when running large CFD simulations. I decided to check it quickly for myself. It is not my intention to convince you whether or not to turn off hyperthreading yourself or to make any arguments about what is the best. I'm not even totally sure if the rough test I've conducted is representative. However, some evidence is better than none I guess.

The test used a PC with a xeon-2640-v3 CPU and 32GB RAM. A recent version of fluent software was used. The simulation was a basic steady-state case with a k-e RANS turbulence model. The domain has 3million cells. The case took up ~20GB of RAM* while running. For time taken to run 100 iterations following initialisation, I get: 

- hyperthreading on. using 8/16 "cores". 13min:40sec

- hyperthreading on. using 15/16 "cores". 11min:52sec

- hyperthreading off. using 8/8 cores. 10min:24sec

During the runs, task manager showed 56% CPU utilisation in the first case and 100% CPU utilisation in the second and third case.

 Overall, turning off hyperthreading has led to a slight improvement in speed, in my case, I will be keeping hyperthreading turned off for the workstation PC I am using only for CFD.

 I will caveat this by saying that it's only really worth doing for large simulations. When running CFD simulations the computer also needs to do background tasks, for things like the operating system. In the second case you will see I've set it to 15 not 16 cores: (the idea is to leave one core free for this type of thing.). Reportedly, For computers with small CPUs, this should be taken into account before you consider turning off hyperthreading. I think for the time being, on my laptop I use day-to-day, I will keep hyperthreading on.  Also, you need to enter bios to turn hyperthreading off. I would not do this to a computer without backing up harddrive contents and so on, as there's a danger it might not boot properly again after the change is made.

* (This is important because if fluent uses up all of the RAM, it switches to virtual memory, which affects the speed of the simulations a lot more than things like hyperthreading do.)


No comments:

Post a Comment