MPI installation issue (kernel_generator)

Hello,

I have an issue on installing ngsolve with MPI recently on my laptop.
In particular, the kernel generator in ngsolve could not find my local mpi library. This error message seems to be only appearing after version 6.2.2009.
Well, the installation went through in my local cluster, where the exactly same installation procedure is performed. Quite strange… Is there any quick fix?

[  6%] Built target kernel_generator
[  6%] Generating matkernel.hpp
./kernel_generator: error while loading shared libraries: libmpi.so.12: cannot open shared object file: No such file or directory

Best,
Guosheng

Hi, Guosheng,

The kernel_generator is a small executable

ngsolve_build/ngsolve/basiclinalg/kernel_generator

So it seems that this executable links against the MPI library but cannot find it when it is executed.
You can “ldd” the executable to confirm this, you should get a line like:

libmpi.so.12 => not found

Maybe the path to your MPI library is not in your LD_LIBRARY_PATH?

You could try to put the MPI library into LD_PRELOAD for the build. That should force it to load.

Best,
Lukas

libmpi.so was not found in kernel_generator
I have already PATH set to find MPI in my bashrc, otherwise cmake does not work.

Now I exported LD_PRELOAD/LD_LIBRARY_PATH in bashrc, but it still didn’t find the MPI library…

Can you try to manually execute the kernel_generator with the MPI library preloaded?

LD_PRELOAD=<your_mpi_library>:$LD_PRELOAD ./kernel_generator 

And add the preload path in the shell and ldd the executable?

export LD_LIBRARY_PATH=<path_to_mpi_library>:$LD_LIBRARY_PATH
ldd kernel_generator

Maybe the output can give some indication where the problem lies.

Best, Lukas

It magically worked after I manually preload MPI library on the command line…
Thanks!