mir-group / flare

An open-source Python package for creating fast and accurate interatomic potentials.
https://mir-group.github.io/flare
MIT License
294 stars 71 forks source link

Compilation error when building LAMMPS pair_flare_kokkos #427

Open namehta4 opened 2 weeks ago

namehta4 commented 2 weeks ago

Hi,

I am trying to build pair flare inside a lammps container for our users on Perlmutter. I have encountered the following error during compilation:

[ 95%] Building CXX object CMakeFiles/lammps.dir/opt/lammps/src/KOKKOS/pair_flare_kokkos.cpp.o
/opt/lammps/build/_deps/kokkoskernels-src/common/src/Kokkos_ArithTraits.hpp(871): error: class "Kokkos::Experimental::finite_min<Kokkos::Experimental::half_t>" has no member "value"

/opt/lammps/build/_deps/kokkoskernels-src/common/src/Kokkos_ArithTraits.hpp(871): error: class "Kokkos::Experimental::finite_max<Kokkos::Experimental::half_t>" has no member "value"

with more similar error messages.

I am using Kokkos kernel :

================================
Kokkos Kernels version: 4.4.1
================================
Kokkos Kernels ETI Types
   Devices:  <Cuda,CudaSpace>
   Scalars:  
   Ordinals: 
   Offsets:  
   Layouts:  

Kokkos Kernels components
   COMMON:    ON
   BATCHED:   ON
   BLAS:      ON
   LAPACK:    ON
   GRAPH:     ON
   SPARSE:    ON
   ODE:       ON

Kokkos Kernels TPLs
   CUBLAS:      /usr/local/cuda/lib64/stubs/libcublas.so
   CUSPARSE:    /usr/local/cuda/lib64/stubs/libcusparse.so
   CUSOLVER:    /usr/local/cuda/lib64/stubs/libcusolver.so
================================

My build instructions are as follows:

git clone -b stable_2Aug2023_update2 --depth 1 https://github.com/lammps/lammps.git lammps

#Installing Eigen 
WORKDIR /opt
git clone https://gitlab.com/libeigen/eigen.git
cd /opt/eigen                                        && \
    mkdir build                                          && \
    cd /opt/eigen/build                                  && \
    cmake -DCMAKE_INSTALL_PREFIX=/opt/eigen/install ..   && \
    make install
PATH=$PATH:/opt/eigen/install/bin
PATH=$PATH:/opt/eigen/install/include
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/eigen/install/lib 

#Patching FLARE
WORKDIR /opt
git clone https://github.com/mir-group/flare.git
cd /opt/flare/lammps_plugins                         && \
    ./install.sh /opt/lammps

cp -r /opt/eigen/Eigen /opt/lammps/src
cmake -DMKL_INCLUDE_DIR=$CONDA_PREFIX/include -DMKL_LIBRARY=$CONDA_PREFIX/lib -D CMAKE_BUILD_TYPE=Release \
          -D CMAKE_PREFIX_PATH=/opt/libtorch-gpu \
          -D CMAKE_INSTALL_PREFIX=/opt/lammps/install -D CMAKE_CXX_STANDARD=17 -D CMAKE_CXX_STANDARD_REQUIRED=ON \
          -D BUILD_MPI=ON -D CMAKE_CXX_COMPILER=/opt/lammps/lib/kokkos/bin/nvcc_wrapper -D BUILD_SHARED_LIBS=ON \
          -D PKG_MANYBODY=ON -D PKG_MOLECULE=ON -D PKG_KSPACE=ON -D PKG_REPLICA=ON -D PKG_REAXFF=ON -D PKG_QEQ=ON \
          -D PKG_PHONON=ON -D PKG_ELECTRODE=yes -D PKG_PLUMED=yes -D DOWNLOAD_PLUMED=yes -D PLUMED_MODE=shared \
          -D BUILD_SHARED_LIBS=ON -D PKG_KOKKOS=yes -D Kokkos_ARCH_AMPERE80=ON -D Kokkos_ENABLE_CUDA=yes \
          -D CMAKE_PREFIX_PATH=/opt/libtorch-gpu ../cmake
make -j 4
make install

May I please request your help with this error?

Thank you! Neil Mehta

anjohan commented 2 weeks ago

Hi Neil,

This is, indirectly, caused by the old LAMMPS version, see #366.

The easiest solution is to use a newer version of LAMMPS; our weekly CI pulls the latest release. Alternatively, you can modify CMakeLists.txt as shown in the above issue.

namehta4 commented 1 week ago

Hi Anders,

Thank you for your comment. I will retry building the image.

Thank you! Neil Mehta