OpenFOAM performance comparison between built-from-source and precompiled code

OpenFOAM is an open source CFD code. The OpenFOAM team provides both binaries (for Linux and other platforms) and source files. We present a test which has been performed to analyse the performances of OpenFOAM in two cases, namely, by using the precompiled binaries and executables built from the source code. We made a 64 bit compilation for Linux on x86_64 Dual-Core AMD Opteron core. Both serial and parallel runs have been taken into account to better understand to what extent one takes advantage in compiling OpenFOAM from source instead of using precompiled binaries. We studied a 2 dimensional problem of simplified dam break. The feature of the problem is a transient flow of two fluids separated by a sharp interface. The OpenFOAM solver uses a specie transport equation to determine the relative volume fraction of the two phases. The physics of the problem is described in the OpenFOAM tutorial.

A column of water at rest is located behind a membrane on the left side of a tank. At time t = 0 the membrane is removed and the column of water collapses. During the collapse, the water impacts an obstacle at the bottom of the tank and creates a complicated flow structure, including several captured pockets of air. The geometry and the initial setup are shown on the left.

We studied the problem in two situations: in the former we used 1000 time steps and the mesh was generated by splitting the geometry in 5 blocks for a total of 56700 cells, in the latter we used 100 time steps but a finer mesh of 1108800 cells. The results of the test are shown below. In the case of the compiled code, a considerable higher speedup (defined as a ratio of serial to parallel execution time) has been observed.



With 1000 time steps and 56700 cells, the serial execution times are comparable. Parallel scaling occurs from 4 to 12 processors. However in the case of the compiled code, the speedup keeps higher over the full scaling region.

Execution time (s)
1000 time steps, 56700 cells
Compiled Precompiled
serial: 23416.10 23371.80
4 cores: 6180.46 6047.30
8 cores: 3068.98 3977.06
12 cores: 2166.88 3671.00
16 cores: 5589.82 3684.20



With 100 time steps and 1108800 cells, for the compiled code the serial run terminates 817 seconds earlier and the speedup is higher independently on the number of processors.

Execution time (s)
100 time steps, 1108800 cells
Compiled Precompiled
serial: 31116.40 31933.20
16 cores: 2796.68 2908.76
24 cores: 1950.83 2115.44
32 cores: 1371.43 1550.11
40 cores: 1112.44 1314.84
48 cores: 855.74 1082.74
56 cores: 1735.95 2086.74



The conclusion of these measurements is that it is better to use OpenFOAM compiled from source because the efficiency gain is not negligible.

Cookies Policy