The problem I faced has been solved here: Loading shared library in open-mpi/ mpi-run
I know not how, setting LD_LIBRARY_PATH
or specifying -x LD_LIBRARY_PATH
fixes the problem, when my installation itself specifies the necessary -L arguments. My installation is in ~/mpi/
I have also included my compile-link configs.
$ mpic++ -showme:version
mpic++: Open MPI 1.6.3 (Language: C++)
$ mpic++ -showme
g++ -I/home/vigneshwaren/mpi/include -pthread -L/home/vigneshwaren/mpi/lib
-lmpi_cxx -lmpi -ldl -lm -Wl,--export-dynamic -lrt -lnsl -lutil -lm -ldl
$ mpic++ -showme:libdirs
/home/vigneshwaren/mpi/lib
$ mpic++ -showme:libs
mpi_cxx mpi dl m rt nsl util m dl % Notice mpi_cxx here %
When I compiled with mpic++ <file>
and ran with mpirun a.out
I got a (shared library) linker error
error while loading shared libraries: libmpi_cxx.so.1:
cannot open shared object file: No such file or directory
The error has been fixed by setting LD_LIBRARY_PATH
. The question is how and why? What am i missing? Why is LD_LIBRARY_PATH
required when my installation looks just fine.
LD_LIBRARY_PATH
isn't being overwitten in your.bashrc
like mine was with CUDA. You want something likeexport LD_LIBRARY_PATH=/lib64/openmpi/lib:$LD_LIBRARY_PATH
– Priceless