Error while building LAMMPS with gpu

we followed LAMMPS instruction as given in:

https://sites.google.com/site/rangsiman1993/comp-chem/program-install/install-lammps-pk-gpu#h.p_RCyrlWsvLVS5

The error given below pops up while executing command “make gpu”

errors starts as:

…/…/lib/gpu/libgpu.a(lal_ans.o): In function LAMMPS_AL::Answer<float, double>::acc_timers()': lal_answer.cpp:(.text._ZN9LAMMPS_AL6AnswerIfdE10acc_timersEv[_ZN9LAMMPS_AL6AnswerIfdE10acc_timersEv]+0xc1): undefined reference to ompi_mpi_comm_world’
lal_answer.cpp:(.text._ZN9LAMMPS_AL6AnswerIfdE10acc_timersEv[_ZN9LAMMPS_AL6AnswerIfdE10acc_timersEv]+0x11d): undefined reference to `ompi_mpi_comm_world’

the last line of error is:

collect2: error: ld returned 1 exit status
Makefile:89: recipe for target ‘…/lmp_gpu’ failed
make[1]: *** […/lmp_gpu] Error 1
make[1]: Leaving directory ‘/home/suleman/programs/lammps-7Aug19/src/Obj_gpu’
Makefile:201: recipe for target ‘gpu’ failed
make: *** [gpu] Error 2

we followed LAMMPS instruction as given in:

https://sites.google.com/site/rangsiman1993/comp-chem/program-install/install-lammps-pk-gpu#h.p_RCyrlWsvLVS5

why not follow the instructions given in the LAMMPS manual??
how do you know the instructions on that website are not outdated?

The error given below pops up while executing command “make gpu”

errors starts as:

…/…/lib/gpu/libgpu.a(lal_ans.o): In function LAMMPS_AL::Answer<float, double>::acc_timers()': lal_answer.cpp:(.text._ZN9LAMMPS_AL6AnswerIfdE10acc_timersEv[_ZN9LAMMPS_AL6AnswerIfdE10acc_timersEv]+0xc1): undefined reference to ompi_mpi_comm_world’
lal_answer.cpp:(.text._ZN9LAMMPS_AL6AnswerIfdE10acc_timersEv[_ZN9LAMMPS_AL6AnswerIfdE10acc_timersEv]+0x11d): undefined reference to `ompi_mpi_comm_world’

the last line of error is:

collect2: error: ld returned 1 exit status
Makefile:89: recipe for target ‘…/lmp_gpu’ failed
make[1]: *** […/lmp_gpu] Error 1
make[1]: Leaving directory ‘/home/suleman/programs/lammps-7Aug19/src/Obj_gpu’
Makefile:201: recipe for target ‘gpu’ failed
make: *** [gpu] Error 2

this kind of error message will happen, when you use a different MPI library to compile libgpu.a from when you compile LAMMPS in the src folder. This is a user error, not a LAMMPS issue.
if you use the CMake based build system, that kind of inconsistency would be avoided, since both compilation steps are integrated into a single makefile. You may need to update to the latest patch version of LAMMPS, though, for having all the latest improvements and bugfixes included (and there were fixes and improvements for the GPU package since the last stable release), which is the 4 Feb 2020 version.

Axel.