su2code/SU2

Potential crash for the OpenMP multi-thread running

Closed this issue · 2 comments

A crash may occur when the number of threads is larger than the number of points in OpenMP mode. For example, a boundary condition marker has a few edge elements, and the model runs on a 10-core CPU (20 threads).

One of the crash places is at
InverseDiagonalBlock_ILUMatrix(end-1, &invM[(end-1)*nVar*nVar]);
The value end-1 could be a random value due to the skipped value assignment in vector omp_partitions.

It seems that the logic for setting and using omp_partitions needs to be revised. The reproducing script is provided.

Win11 + VS2022
SU2 7.3.1

omp_crash_su2.cfg.txt
mesh.su2.txt

My local fix is to initialize all elements in vector omp_partitions with value nPointDomain. Then 'continue' the for loop if omp_partitions[thread] == omp_partitions[thread+1] at several places.

Sounds like a sensible fix. Please open a PR.
We should also warn or throw an error if that condition happens because the performance is not going to be good with very few nodes per thread.