Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docker image - Include LAMMPS #210

Merged
merged 9 commits into from
Nov 10, 2024

Conversation

naik-aakash
Copy link
Collaborator

@naik-aakash naik-aakash commented Nov 9, 2024

Hi @YuanbinLiu, Following up on your comment in PR #203 (#203 (comment)), I have now tried to include LAMMPs in our CI workflow setup (lammps is compiled with PACE and python package). I tested whether the installation was working or not. It seems to run fine when I try to execute the examples from the source code. I mainly checked demo.py and mc.py (https://github.com/lammps/lammps/tree/develop/python/examples).

These are commands used for compiling the lammps from source code in the docker image

# Install LAMMPS (rss)
RUN curl -fsSL https://download.lammps.org/tars/lammps.tar.gz -o /opt/lammps.tar.gz \
    && tar -xf /opt/lammps.tar.gz -C /opt \
    && rm /opt/lammps.tar.gz \
    && cd /opt/lammps-* \
    && mkdir build \
    && cd build \
    && cmake -D PKG_ML-PACE=yes -D PKG_PYTHON=on -D BUILD_LIB=on -D BUILD_SHARED_LIBS=on ../cmake \
    && cmake --build . \
    && make -j 4 install \
    && make install-python

# Add LAMMPS to PATH
ENV PATH="${PATH}:/root/.local/bin"

The compilation runs through successfully, and the lmp binary is accessible on the system PATH. Python package imports also work fine . So I have the following questions

  1. Is there any specific version of lammps you are using?
  2. Do Any other flags need to be switched on when compiling?
  3. the current RSS test, in general, is not working with J-ACE and needs to be updated
  4. Is there anything else that needs to be added to LD_LIBRARY_PATH or system PATH?

Because enabling the commented-out test of J-ACE in the tests/rss/test_rss.py fails with a bunch of fatal Python errors.

I see there are few lines commented out, here

# ace_label = os.path.join(mlip_path,'acemodel.json')
? Is this the reason for failing tests as well?

Todos

  • Restrict docker image publish workflows to run only on main repo after the lammps compilation flags are confirmed

@naik-aakash naik-aakash marked this pull request as draft November 9, 2024 13:28
@naik-aakash naik-aakash added the dependencies Pull requests that update a dependency file label Nov 9, 2024
@JaGeo
Copy link
Collaborator

JaGeo commented Nov 9, 2024

Do you know if you need to build it with QUIP support? https://docs.lammps.org/Build_extras.html#ml-quip

@naik-aakash
Copy link
Collaborator Author

Do you know if you need to build it with QUIP support? https://docs.lammps.org/Build_extras.html#ml-quip

I saw this, but as QUIP support was not mentioned, I did not enable that. But I think currently inferace with J-ACE is also not complete for RSS after looking at commented out lines

@naik-aakash naik-aakash changed the title [WIP] Update docker image - Include LAMMPS Update docker image - Include LAMMPS Nov 9, 2024
@naik-aakash naik-aakash marked this pull request as ready for review November 9, 2024 17:17
@JaGeo
Copy link
Collaborator

JaGeo commented Nov 10, 2024

@naik-aakash should I merge it?

@naik-aakash
Copy link
Collaborator Author

@naik-aakash should I merge it?

Not sure, if there are other flags to be added in lammps compilation. Better to wait for tomorrow ?

@JaGeo
Copy link
Collaborator

JaGeo commented Nov 10, 2024

Yeah. Let's wait for conformation. Thanks anyway 😀

@JaGeo
Copy link
Collaborator

JaGeo commented Nov 10, 2024

@YuanbinLiu Can you please help us with the flags needed for the lammps compilation? Then, we can also add a test for LAMMPS in #203 . Thanks!

@naik-aakash naik-aakash requested a review from JaGeo November 10, 2024 16:02
@naik-aakash
Copy link
Collaborator Author

@JaGeo , This PR could be merged

@naik-aakash naik-aakash merged commit 5a10a1b into autoatml:main Nov 10, 2024
13 checks passed
@YuanbinLiu
Copy link
Collaborator

Do you know if you need to build it with QUIP support? https://docs.lammps.org/Build_extras.html#ml-quip

We don't QUIP for julia-ACE

@YuanbinLiu
Copy link
Collaborator

YuanbinLiu commented Nov 10, 2024

@naik-aakash, thanks for the great job. For the compilation, we need libpace.tar.gz. Here is my recipe on our HPC for compiling lammps-ace:

git clone -b release https://github.com/lammps/lammps
cd lammps
mkdir build
cd build
wget -O libpace.tar.gz https://github.com/wcwitt/lammps-user-pace/archive/main.tar.gz

cmake  -C ../cmake/presets/clang.cmake -D BUILD_SHARED_LIBS=on -D BUILD_MPI=yes \
-DMLIAP_ENABLE_PYTHON=yes -D PKG_PYTHON=on -D PKG_KOKKOS=yes -D Kokkos_ARCH_ZEN3=yes \
-D PKG_PHONON=yes -D PKG_MOLECULE=yes -D PKG_MANYBODY=yes \
-D Kokkos_ENABLE_OPENMP=yes -D BUILD_OMP=yes -D LAMMPS_EXCEPTIONS=yes \
-D PKG_ML-PACE=yes -D PACELIB_MD5=$(md5sum libpace.tar.gz | awk '{print $1}') \
-D CMAKE_INSTALL_PREFIX=$LAMMPS_INSTALL -D CMAKE_EXE_LINKER_FLAGS:STRING="-lgfortran" \
../cmake

make -j 16
make install-python

$LAMMPS_INSTALL is the conda environment for installing the lammps-python interface.

After the installation is completed, enter the following commands in the Python environment. If you get the same output, it means the installation was successful.

from lammps import lammps; lmp = lammps()
LAMMPS (27 Jun 2024)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98)
  using 1 OpenMP thread(s) per MPI task
Total wall time: 0:02:22

@YuanbinLiu
Copy link
Collaborator

If it still doesn't work, I would suggest commenting out this part for now. After the paper is sent out, we can revisit it later.

@naik-aakash
Copy link
Collaborator Author

Hi @YuanbinLiu, thanks for sharing the details, It seems a lot of other flags are added that are not enabled by default,

But at this point, in the docker image, without including all the other flags you mentioned, I actually have the same output for the above-mentioned Python command to check if the installation is working.

So, does it mean there are other dependencies in the flags you shared, or are they not really necessary?

@JaGeo
Copy link
Collaborator

JaGeo commented Nov 10, 2024

@naik-aakash I guess those two are not required and cannot be enabled as we do not have these files: PKG_ML-QUIP=yes \ -D QUIP_LIBRARY=/u/vld/applications/lammps-reqs/QUIP-lammps/build/linux_x86_64_gfortran/libquip.a \

@YuanbinLiu
Copy link
Collaborator

@naik-aakash have you included -D PACELIB_MD5=$(md5sum libpace.tar.gz | awk '{print $1}')? Without this, even if you have successfully installed lammps, it is for pacemaker-ace not julia-ace. We specifically need libpace.tar.gz for julia-ace.

@YuanbinLiu
Copy link
Collaborator

YuanbinLiu commented Nov 10, 2024

@naik-aakash I guess those two are not required and cannot be enabled as we do not have these files: PKG_ML-QUIP=yes \ -D QUIP_LIBRARY=/u/vld/applications/lammps-reqs/QUIP-lammps/build/linux_x86_64_gfortran/libquip.a \

yes, we don't need them

@naik-aakash
Copy link
Collaborator Author

@naik-aakash have you included -D PACELIB_MD5=$(md5sum libpace.tar.gz | awk '{print $1}')? Without this, even if you have successfully installed lammps, it is for pacemaker-ace not julia-ace. We specifically need libpace.tar.gz for julia-ace.

Ah okay, will try to include it then. This could be missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants