HMatrix/BEM in FreeFem++ on Mac: MPI error ‘Attempting to use an MPI routine before initializing or after finalizing MPICH'

Hello,

I am trying to run a 2D BEM (Boundary Element Method) simulation in FreeFem++ v4.15 on my Mac. My code uses HMatrix<complex> to assemble the system and solve for the boundary unknowns. When I run the script normally, it fails with the following error:

“Attempting to use an MPI routine (internal_Comm_size) before initializing or after finalizing MPICH”

I have tried running it with mpirun -np 1, but the same error appears. I suspect the issue comes from the bem plugin or the HMatrix operator trying to call MPI routines without proper initialization. I have installed all dependencies, including LAPACK, BLAS, and Boost, but I cannot get past this error. I am looking for guidance on how to correctly run BEM/HMatrix computations in FreeFem++ on macOS, especially regarding MPI usage.

Any help or suggestions would be greatly appreciated.

Thank you in advance!

Use ff-mpirun, not mpirun. You likely have multiple MPI implementations mixed up in your system.

thank you for your response !