mala-project / mala

Materials Learning Algorithms. A framework for machine learning materials properties from first-principles data.
https://mala-project.github.io/mala/
BSD 3-Clause "New" or "Revised" License
81 stars 25 forks source link

lammps Python binding: documentation needs update #455

Closed elcorto closed 1 year ago

elcorto commented 1 year ago

The instructions on how to build the lammps Python module are a bit brief for people not used to building lammps from source.

Compiler

One needs to

So something like

$ ml gcc/7.3.0
$ ml openmpi/4.1.1

if

$ python -VV
Python 3.11.2 (main, Mar 10 2023, 09:40:18) [GCC 7.3.0]

Using lammps' install.py script

Using the mala branch (https://github.com/mala-project/lammps/commit/e16932716293dab2e0dbed8b666e7f9854b93a5f) of https://github.com/mala-project/lammps

$ python3 install.py -p lammps -l ../src/liblammps.so

fails

(mala-sys) schmer52@ga001:~/soft/git/mala-project/lammps/python$ python3 install.py -p lammps -l ../src/liblammps.so
usage: install.py [-h] -p PACKAGE -l LIB [-n] [-w WHEELDIR] -v VERSIONFILE
install.py: error: the following arguments are required: -v/--versionfile

One needs to add -v ../src/version.h.

elcorto commented 1 year ago

As detailed in #456, the call to install.py should read

$ cd /path/to/lammps/python
$ python install.py -p lammps -l ../src/liblammps.so -v ../src/version.h -w $(pwd)

Replace ../src/liblammps.so with ../build/liblammps.so when using cmake instead of make.

elcorto commented 1 year ago

Re. compilers, here is a working example using cmake to build liblammps.so (HZDR hemera cluster module names). This also uses -j32 jobs. We build an OpenMP version w/o MPI.

$ ml python/3.11.2
$ python -VV
Python 3.11.2 (main, Mar 10 2023, 09:40:18) [GCC 7.3.0]

$ ml gcc/7.3.0 cmake/3.26.1

$ cd /path/to/lammps
$ mkdir build
$ cd build
$ cmake ../cmake/ -D BUILD_MPI=no -D BUILD_OMP=yes -D BUILD_SHARED_LIBS=yes -D PKG_ML-SNAP=yes
$ cmake --build . -j32 --clean-first

$ cd ../python/
$ python install.py -p lammps -l ../build/liblammps.so -v ../src/version.h -w $(pwd)
elcorto commented 1 year ago

I won't send a PR to update the docs at this point since @RandomDefaultUser is working on documenting the build for the GPU version of lammps. Once that is done, maybe we can integrate the above as a CPU-only fallback.

elcorto commented 1 year ago

-w $(pwd) is fixed on lammps side and is not needed any longer.

RandomDefaultUser commented 1 year ago

Will be closed by #467