support for non-standard CUDA paths with GPU package

After a long time since I compiled LAMMPS I decided to give a try to and I found it very useful. Since I need the GPU package, I had the problem of specifying a non-standard path to CUDA (where by “standard” I mean /usr/local/cuda) without manually tweaking the package makefiles since this in my opinion defeats the purpose of
Attached you can find a slightly modified version that takes the optional field “dir” for the “-gpu” option and allows to enter the value for CUDA_HOME variable in In addition it also updates the gpu_SYSPATH value in Makefile.lammps..
Since in the GPU package is only the first of all the packages I want to build for LAMMPS, I may implement the same for other packages. If you are interested I will be happy to send future updates.

Davide (71.3 KB)


thanks for your contribution. i've integrated it into the LAMMPS-ICMS
branch and will eventually forward it and any future improvements to
steve for inclusion into the official version. please note that there
have been some minor improvements to very recently, and that
when submitting code, especially if you send a whole file instead of a
patch, please make sure you reference which specific version of LAMMPS
this is taken from or - even better - update to the very latest
development version first.
if you work with git, you may also send in pull requests via the
github or bitbucket mirrors of the LAMMPS repo.