The final command line for compiling simpleMPI is
mpicxx -o simpleMPI simpleMPI_mpi.o simpleMPI.o -L//usr/lib/cuda/lib64 -lcudart
which produces the following linker errors
/bin/ld: cannot find -lmpi_cxx
/bin/ld: cannot find -lmpi
/bin/ld: cannot find -lopen-rte
/bin/ld: cannot find -lopen-pal
/bin/ld: cannot find -lhwloc
/bin/ld: cannot find -levent
/bin/ld: cannot find -levent_pthreads
I heard that
-L can tell the linker where to find libraries, so I add
-L/the/path/to/my/mpi/libraries argument in the command line. But the same errors repeat itself. I have double checked that the above path is correct that indeed contains mpi libraries in the error message. So, can you please help me figure out how to solve this issue? Thank you.
PS, the machine is a remote Linux for which I don’t have root privilege. It just behaves like ubuntu we are all familiar with.
mpicxx is designed to automatically “know” the proper include paths to pick up for example
mpi.h and the proper paths to pick up necessary libraries. When you invoke
mpicxx ... it is as if you invoked something like
g++ -I/mpi/include/paths -L/mpi/lib/paths -lmpi_libs ...
In order for this to work correctly, you need to:
- properly build and use your own MPI (or)
- install the
-dev (e.g. debian/ubuntu) or
-devel (rhel/centos) version of the MPI packages
That is the reason why that Makefile line doesn’t call out any MPI libraries (which are obviously necessary at link time) - the
mpicxx knows to link against those libraries automatically.
The suggestion I have then is to:
- download and build your own MPI (since you can’t install new packages)
- before issuing the
make command, adjust your
PATH env variable so that the
mpicxx selected is the one you built in step 1.
I made a similar suggestion in a comment here.
I’m sure there are probably other approaches. I don’t happen to know much about other approaches, so if the above is not the kind of suggestion you are looking for, please just disregard this comment. My suggestion here is what I would do if I were faced with the problem you seem to be describing.
Is downloading a deb file of MPI-dev package and extracting it “properly build”?
I don’t know, you could try that. It’s not what I would do. It’s pretty easy to build your own MPI.