bddc preconditioner in parallel on Linux

Hello,

I am trying to use multiple instances of NGSolve. However, I have run into an issue whilst using the bddc preconditioner on Ubuntu. The problem occurs when assembling the matrix whilst using a bddc preconditioner, I have attached a simple example to demonstrate this.

When calling the script once on Ubuntu the simulation takes 17.759102821350098 seconds. However, calling two copies of the script in quick succession they take 655.858645439148 and 659.8631296157837 seconds respectively.

This only appears to happen on Ubuntu, whilst running the simulation once on Mac takes 15.266962051391602 seconds, whereas, running two copies of the script takes 20.856684684753418 and 21.241539001464844 respectively.

We wish to run multiple examples using multiprocessing which amplifies this problem.

Kind regards,

Ben

Attachment: BDDCTestCase.py

Hi Ben,

BDDC relies on LAPACK to invert dense matrices. I guess that these functions run in parallel, which leads to a slowdown if you run multiple instances. Depending on which library is used (openblas, mkl, etc.), you could try settings following environment variables:

OMP_NUM_THREADS=1
MKL_NUM_THREADS=1
MKL_THREADING_LAYER=sequential

Best,
Matthias

Hi Matthias,

That’s excellent, that’s solved the problem. Thank you so much.

Kind regards,

Ben